mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
2a5684011e
"lea foo@GOT, %reg" is OK in PIC since it only loads the GOT offset into register, which can be used later with a GOT base register to get the value in the GOT entry. bfd/ PR ld/21168 * elf32-i386.c (elf_i386_relocate_section): Allow "lea foo@GOT, %reg" in PIC. ld/ PR ld/21168 * testsuite/ld-i386/i386.exp: Run pr21168. * testsuite/ld-i386/pr21168a.c: New file. * testsuite/ld-i386/pr21168b.S: Likewise.
30 lines
670 B
ArmAsm
30 lines
670 B
ArmAsm
.text
|
|
.globl bar
|
|
.type bar, @function
|
|
bar:
|
|
call __x86.get_pc_thunk.ax
|
|
addl $_GLOBAL_OFFSET_TABLE_, %eax
|
|
lea foo@GOT, %ecx
|
|
mov (%eax,%ecx,1), %eax
|
|
ret
|
|
.globl bar_ifunc
|
|
.type bar_ifunc, @function
|
|
bar_ifunc:
|
|
call __x86.get_pc_thunk.ax
|
|
addl $_GLOBAL_OFFSET_TABLE_, %eax
|
|
lea ifunc@GOT, %ecx
|
|
mov (%eax,%ecx,1), %eax
|
|
ret
|
|
.type ifunc, @gnu_indirect_function
|
|
ifunc:
|
|
mov $0xbadbeef, %eax
|
|
ret
|
|
.section .text.__x86.get_pc_thunk.ax,"axG",@progbits,__x86.get_pc_thunk.ax,comdat
|
|
.globl __x86.get_pc_thunk.ax
|
|
.hidden __x86.get_pc_thunk.ax
|
|
.type __x86.get_pc_thunk.ax, @function
|
|
__x86.get_pc_thunk.ax:
|
|
movl (%esp), %eax
|
|
ret
|
|
.section .note.GNU-stack,"",@progbits
|