• <legend id='6t63t'><style id='6t63t'><dir id='6t63t'><q id='6t63t'></q></dir></style></legend>

    <small id='6t63t'></small><noframes id='6t63t'>

    <i id='6t63t'><tr id='6t63t'><dt id='6t63t'><q id='6t63t'><span id='6t63t'><b id='6t63t'><form id='6t63t'><ins id='6t63t'></ins><ul id='6t63t'></ul><sub id='6t63t'></sub></form><legend id='6t63t'></legend><bdo id='6t63t'><pre id='6t63t'><center id='6t63t'></center></pre></bdo></b><th id='6t63t'></th></span></q></dt></tr></i><div id='6t63t'><tfoot id='6t63t'></tfoot><dl id='6t63t'><fieldset id='6t63t'></fieldset></dl></div>

      1. <tfoot id='6t63t'></tfoot>

        • <bdo id='6t63t'></bdo><ul id='6t63t'></ul>

        GCC -fPIC 选项

        时间:2023-09-19
        <i id='ItDio'><tr id='ItDio'><dt id='ItDio'><q id='ItDio'><span id='ItDio'><b id='ItDio'><form id='ItDio'><ins id='ItDio'></ins><ul id='ItDio'></ul><sub id='ItDio'></sub></form><legend id='ItDio'></legend><bdo id='ItDio'><pre id='ItDio'><center id='ItDio'></center></pre></bdo></b><th id='ItDio'></th></span></q></dt></tr></i><div id='ItDio'><tfoot id='ItDio'></tfoot><dl id='ItDio'><fieldset id='ItDio'></fieldset></dl></div>

          <tbody id='ItDio'></tbody>
        <legend id='ItDio'><style id='ItDio'><dir id='ItDio'><q id='ItDio'></q></dir></style></legend>

          1. <tfoot id='ItDio'></tfoot>
                  <bdo id='ItDio'></bdo><ul id='ItDio'></ul>

                  <small id='ItDio'></small><noframes id='ItDio'>

                • 本文介绍了GCC -fPIC 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我已阅读GCC 的代码选项生成约定,但无法理解生成位置无关代码(PIC)"的作用.请举例说明这是什么意思.

                  I have read about GCC's Options for Code Generation Conventions, but could not understand what "Generate position-independent code (PIC)" does. Please give an example to explain me what does it mean.

                  推荐答案

                  Position Independent Code 意味着生成的机器代码不依赖于位于特定地址才能工作.

                  Position Independent Code means that the generated machine code is not dependent on being located at a specific address in order to work.

                  例如跳转将作为相对而不是绝对生成.

                  E.g. jumps would be generated as relative rather than absolute.

                  伪组装:

                  PIC:无论代码在地址 100 还是 1000 处,这都有效

                  PIC: This would work whether the code was at address 100 or 1000

                  100: COMPARE REG1, REG2
                  101: JUMP_IF_EQUAL CURRENT+10
                  ...
                  111: NOP
                  

                  Non-PIC:仅当代码位于地址 100 时才有效

                  Non-PIC: This will only work if the code is at address 100

                  100: COMPARE REG1, REG2
                  101: JUMP_IF_EQUAL 111
                  ...
                  111: NOP
                  

                  回应评论.

                  如果您的代码是使用 -fPIC 编译的,则它适合包含在库中 - 该库必须能够从其在内存中的首选位置重定位到另一个地址,在您的库地址处可能有另一个已加载的库喜欢.

                  If your code is compiled with -fPIC, it's suitable for inclusion in a library - the library must be able to be relocated from its preferred location in memory to another address, there could be another already loaded library at the address your library prefers.

                  这篇关于GCC -fPIC 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:GCC 和预编译头文件 下一篇:将非 constexpr 标准库函数视为 constexpr 是否符合编

                  相关文章

                  最新文章

                  • <bdo id='qX3BJ'></bdo><ul id='qX3BJ'></ul>

                    <legend id='qX3BJ'><style id='qX3BJ'><dir id='qX3BJ'><q id='qX3BJ'></q></dir></style></legend>
                    <i id='qX3BJ'><tr id='qX3BJ'><dt id='qX3BJ'><q id='qX3BJ'><span id='qX3BJ'><b id='qX3BJ'><form id='qX3BJ'><ins id='qX3BJ'></ins><ul id='qX3BJ'></ul><sub id='qX3BJ'></sub></form><legend id='qX3BJ'></legend><bdo id='qX3BJ'><pre id='qX3BJ'><center id='qX3BJ'></center></pre></bdo></b><th id='qX3BJ'></th></span></q></dt></tr></i><div id='qX3BJ'><tfoot id='qX3BJ'></tfoot><dl id='qX3BJ'><fieldset id='qX3BJ'></fieldset></dl></div>
                    <tfoot id='qX3BJ'></tfoot>
                  1. <small id='qX3BJ'></small><noframes id='qX3BJ'>