mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-26 03:24:41 +08:00
40937810e1
bfd/ Add TLS support for 64-bit Sparc ELF. * elf64-sparc.c (sparc64_elf_dyn_relocs, sparc64_elf_link_hash_entry, sparc64_elf_obj_tdata): New structs. (GOT_UNKNOWN, GOT_NORMAL, GOT_TLD_GD, GOT_TLD_IE, sparc64_elf_hash_entry, sparc64_elf_tdata, sparc64_elf_local_got_tls_type): New defines. (sparc64_elf_mkobject): New function. (sparc64_elf_link_hash_table): Add members for dynamic linker sections PLT, RELPLT, DYNBSS, and RELBSS. Add tls_ldm_got uion to track TLS GOT references. Add sym_sec to cache mappings from local sym to section. (link_hash_newfunc): New function. (sparc64_elf_bfd_link_hash_table_create): Rename to sparc64_elf_link_hash_table_create for consistency. Pass link_hash_newfunc to _bfd_elf_link_hash_table_init. (sparc64_elf_create_dynamic_sections): Initialize new section members of sparc64_elf_link_hash_table. Only init srelbss if not-shared. (sparc64_elf_copy_indirect_symbol, sparc64_elf_tls_transition): New functions. (SPARC_NOP): Define. (sparc64_elf_build_plt, sparc64_elf_plt_entry_offset, sparc64_elf_plt_ptr_offset): Delete. (sparc64_plt_entry_build): New function to build PLT entries gradually instread of all at once at the end of linking. (sparc64_elf_check_relocs): Delete dynobj, sgot, and srelgot local vars. Get them from sparc64_elf_hash_table instead. Check early on if r_symndx is in bounds. Handle TLS transitions. Account for TLS GOT references and DF_STATIC_TLS, as needed. For TLS relocs, record the tls_type in either sparc64_elf_local_got_tls_type or sparc64_elf_hash_entry as appropriate. For R_SPARC_TLS_{GD,LDM}_CALL, emit a reference to the __tls_get_addr symbol. For PLT relocs, track references via h->plt.refcount. When R_SPARC_{PC10,PC22,PC_HH22,PC_HM10, PC_LM22} and h not-NULL, set h->non_got_ref. For global data symbol references, count the number of relocations needed for that symbol. For default switch case, don't error, this lets the TLS relocs not explicitly handled by this function get accepted. (sparc64_elf_gc_mark_hook, sparc64_gc_sweep_hook): New functions. (sparc64_elf_adjust_dynamic_symbol): Remove dynobj local var, get it from sparc64_elf_hash_table. Store the real PLT offset in h->plt.offset, and build PLT entries one at a time. Also get .dynbss section pointer from htab. (allocate_dynrelocs, readonly_dynrelocs, sparc64_omit_section_dynsym): New functions. (sparc64_elf_omit_section_dynsym): Use these new functions as helpers. (dtpoff_base, tpoff): New functions. (sparc64_elf_relocate_section): Kill dynobj, sgot, and splt locals, get them from sparc64_elf_hash_table. Handle TLS relocations and refcounting in main relocation loop. (sparc64_elf_finish_dynamic_symbol): Use sparc64_elf_link_hash_table. Build PLT entries as we see them. Handle TLS GOT relocations. (sparc64_elf_finish_dynamic_sections): Get sgot and dynobj from sparc64_elf_hash_table. Initialize only PLT header not all entries since we not build PLT entries one by one. (elf_backend_copy_indirect_symbol, bfd_elf64_mkobject, elf_backend_gc_mark_hook, elf_backend_gc_sweep_hook, elf_backend_can_gc_sections, elf_backend_can_refcount): Define. ld/testsuite/ * ld-selective/sel-dump.exp: Do not exclude sparc64-*. * ld-selective/selective.exp: Likewise. * ld-sparc/sparc.exp: Add {32,64}-bit prefix to test names so we know which one is failing. Run sparc64 TLS tests on multi-arch sparc platforms. * ld-sparc/tls64.sd, ld-sparc/tlssunbin64.dd, ld-sparc/tlssunbin64.rd, ld/testsuite/ld-sparc/tlssunbin64.sd, ld-sparc/tlssunbin64.td, ld-sparc/tlssunnopic64.dd, ld-sparc/tlssunnopic64.rd, ld-sparc/tlssunnopic64.sd, ld-sparc/tlssunpic64.dd, ld-sparc/tlssunpic64.rd, ld-sparc/tlssunpic64.sd, ld-sparc/tlssunpic64.td): Update now that sparc64 ELF does support TLS.
278 lines
9.3 KiB
Plaintext
278 lines
9.3 KiB
Plaintext
#source: tlssunbin64.s
|
|
#as: --64
|
|
#ld: -shared -melf64_sparc tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o
|
|
#objdump: -drj.text
|
|
#target: sparc*-*-*
|
|
|
|
.*: +file format elf64-sparc
|
|
|
|
Disassembly of section .text:
|
|
|
|
0+101000 <fn2-0x8>:
|
|
+101000: 81 c3 e0 08 retl *
|
|
+101004: ae 03 c0 17 add %o7, %l7, %l7
|
|
|
|
0+101008 <fn2>:
|
|
+101008: 9d e3 bf 60 save %sp, -160, %sp
|
|
+10100c: 2f 00 04 04 sethi %hi\(0x101000\), %l7
|
|
+101010: 7f ff ff fc call 101000 <.*>
|
|
+101014: ae 05 e2 f8 add %l7, 0x2f8, %l7 ! 1012f8 <.*>
|
|
+101018: 01 00 00 00 nop *
|
|
+10101c: 01 00 00 00 nop *
|
|
+101020: 01 00 00 00 nop *
|
|
+101024: 01 00 00 00 nop *
|
|
+101028: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+10102c: 01 00 00 00 nop *
|
|
+101030: a4 04 60 20 add %l1, 0x20, %l2
|
|
+101034: 01 00 00 00 nop *
|
|
+101038: d0 5d c0 12 ldx \[ %l7 \+ %l2 \], %o0
|
|
+10103c: 01 00 00 00 nop *
|
|
+101040: 90 01 c0 08 add %g7, %o0, %o0
|
|
+101044: 01 00 00 00 nop *
|
|
+101048: 01 00 00 00 nop *
|
|
+10104c: 01 00 00 00 nop *
|
|
+101050: 01 00 00 00 nop *
|
|
+101054: 01 00 00 00 nop *
|
|
+101058: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+10105c: 92 02 20 10 add %o0, 0x10, %o1 ! 10 <.*>
|
|
+101060: d0 5d c0 09 ldx \[ %l7 \+ %o1 \], %o0
|
|
+101064: 90 01 c0 08 add %g7, %o0, %o0
|
|
+101068: 01 00 00 00 nop *
|
|
+10106c: 01 00 00 00 nop *
|
|
+101070: 01 00 00 00 nop *
|
|
+101074: 01 00 00 00 nop *
|
|
+101078: 01 00 00 00 nop *
|
|
+10107c: 21 00 00 00 sethi %hi\(0\), %l0
|
|
+101080: aa 1c 3f 60 xor %l0, -160, %l5
|
|
+101084: 90 01 c0 15 add %g7, %l5, %o0
|
|
+101088: 01 00 00 00 nop *
|
|
+10108c: 01 00 00 00 nop *
|
|
+101090: 01 00 00 00 nop *
|
|
+101094: 01 00 00 00 nop *
|
|
+101098: 01 00 00 00 nop *
|
|
+10109c: 01 00 00 00 nop *
|
|
+1010a0: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+1010a4: 92 1a 3f 80 xor %o0, -128, %o1
|
|
+1010a8: 90 01 c0 09 add %g7, %o1, %o0
|
|
+1010ac: 01 00 00 00 nop *
|
|
+1010b0: 01 00 00 00 nop *
|
|
+1010b4: 01 00 00 00 nop *
|
|
+1010b8: 01 00 00 00 nop *
|
|
+1010bc: 01 00 00 00 nop *
|
|
+1010c0: 01 00 00 00 nop *
|
|
+1010c4: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+1010c8: 92 1a 3f a0 xor %o0, -96, %o1
|
|
+1010cc: 90 01 c0 09 add %g7, %o1, %o0
|
|
+1010d0: 01 00 00 00 nop *
|
|
+1010d4: 01 00 00 00 nop *
|
|
+1010d8: 01 00 00 00 nop *
|
|
+1010dc: 01 00 00 00 nop *
|
|
+1010e0: 01 00 00 00 nop *
|
|
+1010e4: 01 00 00 00 nop *
|
|
+1010e8: 01 00 00 00 nop *
|
|
+1010ec: 01 00 00 00 nop *
|
|
+1010f0: 01 00 00 00 nop *
|
|
+1010f4: 01 00 00 00 nop *
|
|
+1010f8: 01 00 00 00 nop *
|
|
+1010fc: 01 00 00 00 nop *
|
|
+101100: 90 10 00 00 mov %g0, %o0
|
|
+101104: 01 00 00 00 nop *
|
|
+101108: 27 00 00 00 sethi %hi\(0\), %l3
|
|
+10110c: 01 00 00 00 nop *
|
|
+101110: a8 1c ff 80 xor %l3, -128, %l4
|
|
+101114: 01 00 00 00 nop *
|
|
+101118: aa 01 c0 14 add %g7, %l4, %l5
|
|
+10111c: 01 00 00 00 nop *
|
|
+101120: 25 00 00 00 sethi %hi\(0\), %l2
|
|
+101124: 01 00 00 00 nop *
|
|
+101128: a6 1c bf 86 xor %l2, -122, %l3
|
|
+10112c: 01 00 00 00 nop *
|
|
+101130: ec 11 c0 13 lduh \[ %g7 \+ %l3 \], %l6
|
|
+101134: 01 00 00 00 nop *
|
|
+101138: 01 00 00 00 nop *
|
|
+10113c: 01 00 00 00 nop *
|
|
+101140: 01 00 00 00 nop *
|
|
+101144: 01 00 00 00 nop *
|
|
+101148: 27 00 00 00 sethi %hi\(0\), %l3
|
|
+10114c: 01 00 00 00 nop *
|
|
+101150: 25 00 00 00 sethi %hi\(0\), %l2
|
|
+101154: 01 00 00 00 nop *
|
|
+101158: a8 1c ff a0 xor %l3, -96, %l4
|
|
+10115c: 90 10 00 00 mov %g0, %o0
|
|
+101160: a6 1c bf a5 xor %l2, -91, %l3
|
|
+101164: aa 01 c0 14 add %g7, %l4, %l5
|
|
+101168: ec 09 c0 13 ldub \[ %g7 \+ %l3 \], %l6
|
|
+10116c: 01 00 00 00 nop *
|
|
+101170: 01 00 00 00 nop *
|
|
+101174: 01 00 00 00 nop *
|
|
+101178: 01 00 00 00 nop *
|
|
+10117c: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+101180: 01 00 00 00 nop *
|
|
+101184: a4 04 60 10 add %l1, 0x10, %l2
|
|
+101188: 01 00 00 00 nop *
|
|
+10118c: e4 5d c0 12 ldx \[ %l7 \+ %l2 \], %l2
|
|
+101190: 01 00 00 00 nop *
|
|
+101194: a4 01 c0 12 add %g7, %l2, %l2
|
|
+101198: 01 00 00 00 nop *
|
|
+10119c: 01 00 00 00 nop *
|
|
+1011a0: 01 00 00 00 nop *
|
|
+1011a4: 01 00 00 00 nop *
|
|
+1011a8: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+1011ac: 96 1a ff 60 xor %o3, -160, %o3
|
|
+1011b0: 94 10 00 0b mov %o3, %o2
|
|
+1011b4: 98 01 c0 0a add %g7, %o2, %o4
|
|
+1011b8: 01 00 00 00 nop *
|
|
+1011bc: 01 00 00 00 nop *
|
|
+1011c0: 01 00 00 00 nop *
|
|
+1011c4: 01 00 00 00 nop *
|
|
+1011c8: 29 00 00 00 sethi %hi\(0\), %l4
|
|
+1011cc: a2 1d 3f 80 xor %l4, -128, %l1
|
|
+1011d0: a6 10 00 11 mov %l1, %l3
|
|
+1011d4: a6 01 c0 13 add %g7, %l3, %l3
|
|
+1011d8: 01 00 00 00 nop *
|
|
+1011dc: 01 00 00 00 nop *
|
|
+1011e0: 01 00 00 00 nop *
|
|
+1011e4: 01 00 00 00 nop *
|
|
+1011e8: 13 00 00 00 sethi %hi\(0\), %o1
|
|
+1011ec: 96 1a 7f a0 xor %o1, -96, %o3
|
|
+1011f0: 90 10 00 0b mov %o3, %o0
|
|
+1011f4: 96 01 c0 08 add %g7, %o0, %o3
|
|
+1011f8: 01 00 00 00 nop *
|
|
+1011fc: 01 00 00 00 nop *
|
|
+101200: 01 00 00 00 nop *
|
|
+101204: 01 00 00 00 nop *
|
|
+101208: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+10120c: 96 02 e0 08 add %o3, 8, %o3 ! 8 <.*>
|
|
+101210: d4 5d c0 0b ldx \[ %l7 \+ %o3 \], %o2
|
|
+101214: d8 59 c0 0a ldx \[ %g7 \+ %o2 \], %o4
|
|
+101218: 01 00 00 00 nop *
|
|
+10121c: 01 00 00 00 nop *
|
|
+101220: 01 00 00 00 nop *
|
|
+101224: 01 00 00 00 nop *
|
|
+101228: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+10122c: 96 1a ff 90 xor %o3, -112, %o3
|
|
+101230: 94 10 00 0b mov %o3, %o2
|
|
+101234: d8 29 c0 0a stb %o4, \[ %g7 \+ %o2 \]
|
|
+101238: 01 00 00 00 nop *
|
|
+10123c: 01 00 00 00 nop *
|
|
+101240: 01 00 00 00 nop *
|
|
+101244: 01 00 00 00 nop *
|
|
+101248: 1b 00 00 00 sethi %hi\(0\), %o5
|
|
+10124c: 96 1b 7f b0 xor %o5, -80, %o3
|
|
+101250: 94 10 00 0b mov %o3, %o2
|
|
+101254: d8 49 c0 0a ldsb \[ %g7 \+ %o2 \], %o4
|
|
+101258: 01 00 00 00 nop *
|
|
+10125c: 01 00 00 00 nop *
|
|
+101260: 01 00 00 00 nop *
|
|
+101264: 01 00 00 00 nop *
|
|
+101268: 81 cf e0 08 rett %i7 \+ 8
|
|
+10126c: 01 00 00 00 nop *
|
|
#...
|
|
|
|
0+102000 <_start>:
|
|
+102000: 9d e3 bf 60 save %sp, -160, %sp
|
|
+102004: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+102008: 25 00 08 08 sethi %hi\(0x202000\), %l2
|
|
+10200c: a2 14 60 00 mov %l1, %l1
|
|
+102010: a4 14 a3 08 or %l2, 0x308, %l2
|
|
+102014: a3 2c 70 20 sllx %l1, 0x20, %l1
|
|
+102018: a8 04 40 12 add %l1, %l2, %l4
|
|
+10201c: 01 00 00 00 nop *
|
|
+102020: 01 00 00 00 nop *
|
|
+102024: 01 00 00 00 nop *
|
|
+102028: 01 00 00 00 nop *
|
|
+10202c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+102030: 96 02 e0 18 add %o3, 0x18, %o3 ! 18 <.*>
|
|
+102034: d4 5d 00 0b ldx \[ %l4 \+ %o3 \], %o2
|
|
+102038: 98 01 c0 0a add %g7, %o2, %o4
|
|
+10203c: 01 00 00 00 nop *
|
|
+102040: 01 00 00 00 nop *
|
|
+102044: 01 00 00 00 nop *
|
|
+102048: 01 00 00 00 nop *
|
|
+10204c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+102050: 9a 1a ff d4 xor %o3, -44, %o5
|
|
+102054: 94 10 00 0d mov %o5, %o2
|
|
+102058: 98 01 c0 0a add %g7, %o2, %o4
|
|
+10205c: 01 00 00 00 nop *
|
|
+102060: 01 00 00 00 nop *
|
|
+102064: 01 00 00 00 nop *
|
|
+102068: 01 00 00 00 nop *
|
|
+10206c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+102070: 9a 1a ff f4 xor %o3, -12, %o5
|
|
+102074: a4 10 00 0d mov %o5, %l2
|
|
+102078: a4 01 c0 12 add %g7, %l2, %l2
|
|
+10207c: 01 00 00 00 nop *
|
|
+102080: 01 00 00 00 nop *
|
|
+102084: 01 00 00 00 nop *
|
|
+102088: 01 00 00 00 nop *
|
|
+10208c: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+102090: 9a 1a ff fc xor %o3, -4, %o5
|
|
+102094: a4 10 00 0d mov %o5, %l2
|
|
+102098: e4 41 c0 12 ldsw \[ %g7 \+ %l2 \], %l2
|
|
+10209c: 01 00 00 00 nop *
|
|
+1020a0: 01 00 00 00 nop *
|
|
+1020a4: 01 00 00 00 nop *
|
|
+1020a8: 01 00 00 00 nop *
|
|
+1020ac: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+1020b0: 9a 1a ff b4 xor %o3, -76, %o5
|
|
+1020b4: a4 10 00 0d mov %o5, %l2
|
|
+1020b8: a4 01 c0 12 add %g7, %l2, %l2
|
|
+1020bc: 01 00 00 00 nop *
|
|
+1020c0: 01 00 00 00 nop *
|
|
+1020c4: 01 00 00 00 nop *
|
|
+1020c8: 01 00 00 00 nop *
|
|
+1020cc: 17 00 00 00 sethi %hi\(0\), %o3
|
|
+1020d0: 9a 1a ff fc xor %o3, -4, %o5
|
|
+1020d4: a4 10 00 0d mov %o5, %l2
|
|
+1020d8: e2 29 c0 12 stb %l1, \[ %g7 \+ %l2 \]
|
|
+1020dc: 01 00 00 00 nop *
|
|
+1020e0: 01 00 00 00 nop *
|
|
+1020e4: 01 00 00 00 nop *
|
|
+1020e8: 01 00 00 00 nop *
|
|
+1020ec: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+1020f0: 01 00 00 00 nop *
|
|
+1020f4: a4 1c 7f 64 xor %l1, -156, %l2
|
|
+1020f8: 01 00 00 00 nop *
|
|
+1020fc: a6 01 c0 12 add %g7, %l2, %l3
|
|
+102100: 01 00 00 00 nop *
|
|
+102104: 01 00 00 00 nop *
|
|
+102108: 01 00 00 00 nop *
|
|
+10210c: 01 00 00 00 nop *
|
|
+102110: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+102114: 90 1a 3f e6 xor %o0, -26, %o0
|
|
+102118: 90 01 c0 08 add %g7, %o0, %o0
|
|
+10211c: 01 00 00 00 nop *
|
|
+102120: 01 00 00 00 nop *
|
|
+102124: 01 00 00 00 nop *
|
|
+102128: 01 00 00 00 nop *
|
|
+10212c: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+102130: 9a 1c 7f a5 xor %l1, -91, %o5
|
|
+102134: 92 01 c0 0d add %g7, %o5, %o1
|
|
+102138: 01 00 00 00 nop *
|
|
+10213c: 01 00 00 00 nop *
|
|
+102140: 01 00 00 00 nop *
|
|
+102144: 01 00 00 00 nop *
|
|
+102148: 23 00 00 00 sethi %hi\(0\), %l1
|
|
+10214c: 9a 1c 7f 68 xor %l1, -152, %o5
|
|
+102150: d2 59 c0 0d ldx \[ %g7 \+ %o5 \], %o1
|
|
+102154: 01 00 00 00 nop *
|
|
+102158: 01 00 00 00 nop *
|
|
+10215c: 01 00 00 00 nop *
|
|
+102160: 01 00 00 00 nop *
|
|
+102164: 11 00 00 00 sethi %hi\(0\), %o0
|
|
+102168: 90 1a 3f eb xor %o0, -21, %o0
|
|
+10216c: d2 29 c0 08 stb %o1, \[ %g7 \+ %o0 \]
|
|
+102170: 01 00 00 00 nop *
|
|
+102174: 01 00 00 00 nop *
|
|
+102178: 01 00 00 00 nop *
|
|
+10217c: 01 00 00 00 nop *
|
|
+102180: 15 00 00 00 sethi %hi\(0\), %o2
|
|
+102184: 98 1a bf ab xor %o2, -85, %o4
|
|
+102188: da 69 c0 0c ldstub \[ %g7 \+ %o4 \], %o5
|
|
+10218c: 01 00 00 00 nop *
|
|
+102190: 01 00 00 00 nop *
|
|
+102194: 01 00 00 00 nop *
|
|
+102198: 01 00 00 00 nop *
|
|
+10219c: 81 c7 e0 08 ret
|
|
+1021a0: 81 e8 00 00 restore
|