https://sourceware.org/bugzilla/show_bug.cgi?id=33260

--- Comment #5 from Thiago Macieira <thiago at kde dot org> ---
With the patch, without the -z option:

$ objdump -R a.so 

a.so:     file format elf64-x86-64

DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE
0000000000003de8 R_X86_64_RELATIVE  *ABS*+0x0000000000001120
0000000000003df0 R_X86_64_RELATIVE  *ABS*+0x00000000000010e0
0000000000004010 R_X86_64_RELATIVE  *ABS*+0x0000000000004010
0000000000004020 R_X86_64_RELATIVE  *ABS*+0x0000000000001140
0000000000003fc8 R_X86_64_GLOB_DAT  _ITM_deregisterTMCloneTable@Base
0000000000003fd0 R_X86_64_GLOB_DAT  __gmon_start__@Base
0000000000003fd8 R_X86_64_GLOB_DAT  _ITM_registerTMCloneTable@Base
0000000000003fe0 R_X86_64_GLOB_DAT  __cxa_finalize@GLIBC_2.2.5
0000000000004028 R_X86_64_64       my_func_overridable@@Base
0000000000004000 R_X86_64_JUMP_SLOT  my_func_overridable@@Base

$ objdump -d a.so | sed -n '/<f>/,/^$/p'
0000000000001150 <f>:
    1150:       48 83 ec 08             sub    $0x8,%rsp
    1154:       e8 e7 ff ff ff          call   1140 <my_func>
    1159:       e8 d2 fe ff ff          call   1030 <my_func_overridable@plt>
    115e:       48 8d 05 bb 2e 00 00    lea    0x2ebb(%rip),%rax        # 4020
<vtable>
    1165:       48 83 c4 08             add    $0x8,%rsp
    1169:       c3                      ret

$ readelf -j .data a.so

Hex dump of section '.data':
  0x00004010 10400000 00000000 00000000 00000000 .@..............
  0x00004020 40110000 00000000 00000000 00000000 @...............

$ readelf -n a.so 

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000030       NT_GNU_PROPERTY_TYPE_0
      Properties: 1_needed: indirect external access
        x86 feature used: x86
        x86 ISA used: x86-64-baseline

Everything looks fine:
* the call to <my_func> is PC-relative, no relocation
* the call to <my_func_overridable> (added to b.c) goes through the PLT
* the vtable[] array has two relocations: 
  * an R_X86_64_RELATIVE for 0x0000000000001140 (<my_func>)
  * an R_X86_64_64 for <my_func_overridable>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to