R_386_RELATIVE question

Gregory Shtrasberg shtras@gmail.com
Thu Jan 27 09:51:00 GMT 2011


Hello. I've got a question about the purpose of R_386_RELATIVE relocation
Here's a part of disassemble of a library, built as follows:
g++ -fPIC -c test.cpp -o test.o
g++ -shared -Wl,-q -o libtest.so test.o

At 0x1bcc there is a R_386_RELATIVE relocation, and the data in this address
is 0x1c08, which is an address of __dso_handle. As far as I understand, it's
not the job of R_386_RELATIVE to fix the value, so there should have been a
linker relocation on 0x1bcc, pointing to 0x1c08. Am I right? (There is no
other relocation on 0x1bcc besides R_386_RELATIVE)
Thanks in advance

Disassembly of section .got:

00001bcc <.got>:
    1bcc:       08 1c 00                or     %bl,(%eax,%eax,1)
                        1bcc: R_386_RELATIVE    *ABS*
        ...
                        1bd0: R_386_GLOB_DAT    __cxa_finalize
                        1bd4: R_386_GLOB_DAT    _Jv_RegisterClasses
                        1bd8: R_386_GLOB_DAT    __gmon_start__
Disassembly of section .got.plt:

00001bdc <.got.plt>:
    1bdc:       f4                      hlt
    1bdd:       1a 00                   sbb    (%eax),%al
        ...
    1be7:       00 42 06                add    %al,0x6(%edx)
                        1be8: R_386_JUMP_SLOT   _ZNSt8ios_base4InitC1Ev
    1bea:       00 00                   add    %al,(%eax)
    1bec:       52                      push   %edx
                        1bec: R_386_JUMP_SLOT   __cxa_atexit
    1bed:       06                      push   %es
    1bee:       00 00                   add    %al,(%eax)
    1bf0:       62 06                   bound  %eax,(%esi)
                        1bf0: R_386_JUMP_SLOT   _ZNKSsixEj
    1bf2:       00 00                   add    %al,(%eax)
    1bf4:       72 06                   jb     1bfc <.got.plt+0x20>
                        1bf4: R_386_JUMP_SLOT   _ZNKSs4sizeEv
    1bf6:       00 00                   add    %al,(%eax)
    1bf8:       82                      (bad)
                        1bf8: R_386_JUMP_SLOT   printf
    1bf9:       06                      push   %es
    1bfa:       00 00                   add    %al,(%eax)
    1bfc:       92                      xchg   %eax,%edx
                        1bfc: R_386_JUMP_SLOT   _ZSt3minIjERKT_S2_S2_
    1bfd:       06                      push   %es
    1bfe:       00 00                   add    %al,(%eax)
    1c00:       a2 06 00 00 b2          mov    %al,0xb2000006
                        1c00: R_386_JUMP_SLOT   __cxa_finalize
                        1c04: R_386_JUMP_SLOT   _ZNSt8ios_base4InitD1Ev
    1c05:       06                      push   %es
        ...
Disassembly of section .data:

00001c08 <__dso_handle>:
    1c08:       08 1c 00                or     %bl,(%eax,%eax,1)
                        1c08: R_386_RELATIVE    *ABS*
        ...


-- 
View this message in context: http://old.nabble.com/R_386_RELATIVE-question-tp30775689p30775689.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list