zoukankan      html  css  js  c++  java
  • gcc fPIC

    -fPIC产生位置无关代码(PIC),一般创建共享库时用到。

    在x86上,PIC的代码的符号引用都是通过ebx进行操作的。

    (gdb) disassemble main
    Dump of assembler code for function main:
       0x0804840a <+0>:        push   %ebp
       0x0804840b <+1>:        mov    %esp,%ebp
       0x0804840d <+3>:        push   %ebx
       0x0804840e <+4>:        and    $0xfffffff0,%esp
       0x08048411 <+7>:        call   0x804842b <__i686.get_pc_thunk.bx>
       0x08048416 <+12>:        add    $0x1bde,%ebx    //ebx里面存放着是GOT表的地址
       0x0804841c <+18>:        call   0x80483e4 <hi>
       0x08048421 <+23>:        mov    $0x0,%eax
       0x08048426 <+28>:        mov    -0x4(%ebp),%ebx
       0x08048429 <+31>:        leave  
       0x0804842a <+32>:        ret    
    End of assembler dump.

    http://www.xfocus.net/articles/200112/320.html

  • 相关阅读:
    对于dll(动态链接库)的理解
    Java中异常发生时代码执行流程
    使用Gitea搭建git服务
    python-grpc
    Docker环境变量设置
    pandas操作excel
    docker笔记
    flask笔记
    索引原理
    视图、触发器、事务、存储过程
  • 原文地址:https://www.cnblogs.com/moonflow/p/2485955.html
Copyright © 2011-2022 走看看