00c5099111
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): For R_SPARC_GOTDATA_OP_HIX22 and R_SPARC_GOTDATA_OP_LOX10, only bump the GOT refcount for global symbols. (_bfd_sparc_elf_gc_sweep_hook): Likewise only decrement the GOT count for these relocs on global symbols. (gdopoff): New. (_bfd_sparc_elf_relocate_section): Perform GOTDATA optimizations on local symbol references which are not STT_GNU_IFUNC. Handle relocation of them like R_SPARC_HIX22 and R_SPARC_LOX10 respectively, and deal with negative vs. non-negative values properly. ld/testsuite * ld-sparc/gotop32.s: Add local symbol case. * ld-sparc/gotop64.s: Likewise. * ld-sparc/gotop32.rd: Adjust expected results. * ld-sparc/gotop32.td: Likewise. * ld-sparc/gotop64.dd: Likewise. * ld-sparc/gotop64.rd: Likewise. * ld-sparc/gotop64.td: Likewise.
37 lines
567 B
ArmAsm
37 lines
567 B
ArmAsm
.data
|
|
.align 4096
|
|
.globl sym
|
|
sym: .word 0x12345678
|
|
|
|
local_sym:
|
|
.word 0xdeadbeef
|
|
|
|
.text
|
|
.align 4096
|
|
.LLGETPC0:
|
|
retl
|
|
add %o7, %l7, %l7
|
|
|
|
.globl foo
|
|
.type foo,#function
|
|
.proc 04
|
|
foo:
|
|
save %sp, -104, %sp
|
|
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7
|
|
call .LLGETPC0
|
|
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
|
|
nop
|
|
sethi %gdop_hix22(sym), %l1
|
|
nop
|
|
xor %l1, %gdop_lox10(sym), %l1
|
|
nop
|
|
ld [%l7 + %l1], %i0, %gdop(sym)
|
|
nop
|
|
sethi %gdop_hix22(local_sym), %l1
|
|
nop
|
|
xor %l1, %gdop_lox10(local_sym), %l1
|
|
nop
|
|
ld [%l7 + %l1], %i0, %gdop(local_sym)
|
|
nop
|
|
ret
|
|
restore
|