old-cross-binutils/ld/testsuite/ld-sparc/gotop64.dd
David S. Miller 00c5099111 bfd/
* 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.
2010-02-11 19:57:40 +00:00

34 lines
976 B
Text

#source: gotop64.s
#as: --64 -K PIC
#ld: -shared -melf64_sparc
#objdump: -drj.text
#target: sparc*-*-*
.*: +file format elf64-sparc
Disassembly of section .text:
0000000000001000 <foo-0x8>:
+1000: 81 c3 e0 08 retl *
+1004: ae 03 c0 17 add %o7, %l7, %l7
0000000000001008 <foo>:
+1008: 9d e3 bf 60 save %sp, -160, %sp
+100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7
+1010: 7f ff ff fc call 1000 <_.*>
+1014: ae 05 e0 d0 add %l7, 0xd0, %l7 ! 1010d0 <.*>
+1018: 01 00 00 00 nop *
+101c: 23 00 00 00 sethi %hi\(0\), %l1
+1020: 01 00 00 00 nop *
+1024: a2 1c 60 08 xor %l1, 8, %l1
+1028: 01 00 00 00 nop *
+102c: f0 5d c0 11 ldx \[ %l7 \+ %l1 \], %i0
+1030: 01 00 00 00 nop *
+1034: 23 00 00 03 sethi %hi\(0xc00\), %l1
+1038: 01 00 00 00 nop *
+103c: a2 1c 63 24 xor %l1, 0x324, %l1
+1040: 01 00 00 00 nop *
+1044: b0 05 c0 11 add %l7, %l1, %i0
+1048: 01 00 00 00 nop *
+104c: 81 c7 e0 08 ret
+1050: 81 e8 00 00 restore
#pass