https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65612
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-03-29 CC| |tmsriram at google dot com Ever confirmed|0 |1 --- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> --- (gdb) bt #0 0x0000000000000706 in ?? () #1 0x0000555555554b69 in foo () at /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/ext/mv1.C:32 #2 0x00007ffff7de76b8 in _dl_relocate_object () from /lib64/ld-linux-x86-64.so.2 #3 0x00007ffff7ddea4a in dl_main () from /lib64/ld-linux-x86-64.so.2 #4 0x00007ffff7df28d5 in _dl_sysdep_start () from /lib64/ld-linux-x86-64.so.2 #5 0x00007ffff7ddfce1 in _dl_start () from /lib64/ld-linux-x86-64.so.2 #6 0x00007ffff7ddbcd8 in _start () from /lib64/ld-linux-x86-64.so.2 #7 0x0000000000000001 in ?? () #8 0x00007fffffffe18d in ?? () #9 0x0000000000000000 in ?? () (gdb) f 1 #1 0x0000555555554b69 in foo () at /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/ext/mv1.C:32 32 int (*p)() = &foo; (gdb) disass Dump of assembler code for function _Z3foov.resolver(void): 0x0000555555554b60 <+0>: sub $0x8,%rsp 0x0000555555554b64 <+4>: callq 0x555555554700 <__cpu_indicator_init@plt> => 0x0000555555554b69 <+9>: mov 0x200740(%rip),%rsi # 0x5555557552b0 0x0000555555554b70 <+16>: mov 0xc(%rsi),%edx 0x0000555555554b73 <+19>: mov %edx,%eax 0x0000555555554b75 <+21>: mov %edx,%ecx 0x0000555555554b77 <+23>: and $0x400,%eax 0x0000555555554b7c <+28>: and $0x40,%ecx 0x0000555555554b7f <+31>: cmp %ecx,%eax 0x0000555555554b81 <+33>: cmovg %ecx,%eax 0x0000555555554b84 <+36>: test %eax,%eax 0x0000555555554b86 <+38>: jle 0x555555554b98 <_Z3foov.resolver(void)+56> 0x0000555555554b88 <+40>: lea -0xbf(%rip),%rax # 0x555555554ad0 <_Z3foov.avx2_ssse3> 0x0000555555554b8f <+47>: add $0x8,%rsp 0x0000555555554b93 <+51>: retq 0x0000555555554b94 <+52>: nopl 0x0(%rax) 0x0000555555554b98 <+56>: cmpl $0x8,0x8(%rsi) 0x0000555555554b9c <+60>: jne 0x555555554bb0 <_Z3foov.resolver(void)+80---Type <return> to continue, or q <return> to quit---q Quit (gdb) disass 0x0000555555554700,+16 Dump of assembler code from 0x555555554700 to 0x555555554710: 0x0000555555554700 <__cpu_indicator_init@plt+0>: jmpq *0x200be2(%rip) # 0x5555557552e8 <__cpu_indicator_i...@got.plt> 0x0000555555554706 <__cpu_indicator_init@plt+6>: pushq $0x2 0x000055555555470b <__cpu_indicator_init@plt+11>: jmpq 0x5555555546c0 End of assembler dump. (gdb) We can't call __cpu_indicator_init in PIE while PIE is being relocated. Its .got.plt section hasn't been updated. It works for non-PIE since no update on .got.plt section is required. Can we move __cpu_indicator_init to main executable?