mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
b9734f3572
* elf32-sparc.c (_bfd_sparc_elf_howto_table): Add TLS relocs. (elf32_sparc_rev32_howto): New variable. (sparc_reloc_map): Add TLS relocs. (elf32_sparc_reloc_type_lookup, elf32_sparc_info_to_howto): Handle REV32. (sparc_elf_hix22_reloc, sparc_elf_lox10_reloc, elf32_sparc_mkobject): New functions. (struct elf32_sparc_dyn_relocs, struct elf32_sparc_link_hash_entry, struct elf32_sparc_link_hash_table): New structures. (elf32_sparc_tdata, elf32_sparc_local_got_tls_type, elf32_sparc_hash_table): Define. (link_hash_newfunc, elf32_sparc_link_hash_table_create, create_got_section, elf32_sparc_create_dynamic_sections, elf32_sparc_copy_indirect_symbol, elf32_sparc_tls_transition): New functions. (elf32_sparc_check_relocs): Handle TLS relocs. Add dynamic reloc reference counting. (elf32_sparc_gc_sweep_hook): Likewise. (elf32_sparc_adjust_dynamic_symbol): Likewise. (elf32_sparc_size_dynamic_sections): Likewise. (elf32_sparc_relocate_section): Likewise. (allocate_dynrelocs, readonly_dynrelocs, dtpoff_base, tpoff): New functions. (elf32_sparc_object_p): Allocate backend private object data. (bfd_elf32_bfd_link_hash_table_create, elf_backend_copy_indirect_symbol, bfd_elf32_mkobject, elf_backend_can_refcount): Define. (elf_backend_create_dynamic_sections): Define to elf32_sparc_create_dynamic_sections. * reloc.c: Add SPARC TLS relocs. * bfd-in2.h, libbfd.h: Rebuilt. * elf64-sparc.c (sparc64_elf_howto_table): Add TLS relocs. (sparc_reloc_map): Likewise. gas/ * config/tc-sparc.c (sparc_ip): Handle TLS % operators. (tc_gen_reloc): Handle TLS relocs. (sparc_cons, cons_fix_new_sparc): Handle %r_tls_dtpoff. * config/tc-sparc.h (tc_fix_adjustable): Don't adjust TLS relocs. * config/obj-elf.c (obj_elf_section_word): Handle tls. (obj_elf_type): Handle tls_object. include/ * elf/sparc.h: Add TLS relocs. Move R_SPARC_REV32 to 252. ld/testsuite/ * ld-sparc/sparc.exp: New. * ld-sparc/tlsg32.s: New test. * ld-sparc/tlsg32.sd: Likewise. * ld-sparc/tlsg64.s: Likewise. * ld-sparc/tlsg64.sd: Likewise. * ld-sparc/tlslib.s: Likewise. * ld-sparc/tlsnopic.s: Likewise. * ld-sparc/tlspic.s: Likewise. * ld-sparc/tlssunbin32.dd: Likewise. * ld-sparc/tlssunbin32.rd: Likewise. * ld-sparc/tlssunbin32.s: Likewise. * ld-sparc/tlssunbin32.sd: Likewise. * ld-sparc/tlssunbin32.td: Likewise. * ld-sparc/tlssunbin64.dd: Likewise. * ld-sparc/tlssunbin64.rd: Likewise. * ld-sparc/tlssunbin64.s: Likewise. * ld-sparc/tlssunbin64.sd: Likewise. * ld-sparc/tlssunbin64.td: Likewise. * ld-sparc/tlssunbinpic32.s: Likewise. * ld-sparc/tlssunbinpic64.s: Likewise. * ld-sparc/tlssunnopic32.dd: Likewise. * ld-sparc/tlssunnopic32.rd: Likewise. * ld-sparc/tlssunnopic32.s: Likewise. * ld-sparc/tlssunnopic32.sd: Likewise. * ld-sparc/tlssunnopic64.dd: Likewise. * ld-sparc/tlssunnopic64.rd: Likewise. * ld-sparc/tlssunnopic64.s: Likewise. * ld-sparc/tlssunnopic64.sd: Likewise. * ld-sparc/tlssunpic32.dd: Likewise. * ld-sparc/tlssunpic32.rd: Likewise. * ld-sparc/tlssunpic32.s: Likewise. * ld-sparc/tlssunpic32.sd: Likewise. * ld-sparc/tlssunpic32.td: Likewise. * ld-sparc/tlssunpic64.dd: Likewise. * ld-sparc/tlssunpic64.rd: Likewise. * ld-sparc/tlssunpic64.s: Likewise. * ld-sparc/tlssunpic64.sd: Likewise. * ld-sparc/tlssunpic64.td: Likewise.
119 lines
2.6 KiB
ArmAsm
119 lines
2.6 KiB
ArmAsm
.section ".tbss"
|
|
.align 4
|
|
.globl bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8
|
|
bg1: .word 0
|
|
bg2: .word 0
|
|
bg3: .word 0
|
|
bg4: .word 0
|
|
bg5: .word 0
|
|
bg6: .word 0
|
|
bg7: .word 0
|
|
bg8: .word 0
|
|
bl1: .word 0
|
|
bl2: .word 0
|
|
bl3: .word 0
|
|
bl4: .word 0
|
|
bl5: .word 0
|
|
bl6: .word 0
|
|
bl7: .word 0
|
|
bl8: .word 0
|
|
.text
|
|
.globl _start
|
|
.type _start,#function
|
|
.proc 04
|
|
_start:
|
|
save %sp, -160, %sp
|
|
.hidden _GLOBAL_OFFSET_TABLE_
|
|
sethi %hh(_GLOBAL_OFFSET_TABLE_), %l1
|
|
sethi %lm(_GLOBAL_OFFSET_TABLE_), %l2
|
|
or %l1, %hm(_GLOBAL_OFFSET_TABLE_), %l1
|
|
or %l2, %lo(_GLOBAL_OFFSET_TABLE_), %l2
|
|
sllx %l1, 32, %l1
|
|
add %l1, %l2, %l4
|
|
nop;nop;nop;nop
|
|
|
|
/* IE against global var */
|
|
sethi %tie_hi22(sG6), %o3
|
|
add %o3, %tie_lo10(sG6), %o3
|
|
ldx [%l4 + %o3], %o2, %tie_ldx(sG6)
|
|
add %g7, %o2, %o4, %tie_add(sG6)
|
|
nop;nop;nop;nop
|
|
|
|
/* IE -> LE against global var defined in exec */
|
|
sethi %tie_hi22(bg6), %o3
|
|
add %o3, %tie_lo10(bg6), %o5
|
|
ldx [%l4 + %o5], %o2, %tie_ldx(bg6)
|
|
add %g7, %o2, %o4, %tie_add(bg6)
|
|
nop;nop;nop;nop
|
|
|
|
/* IE -> LE against local var */
|
|
sethi %tie_hi22(bl6), %o3
|
|
add %o3, %tie_lo10(bl6), %o5
|
|
ldx [%l4 + %o5], %l2, %tie_ldx(bl6)
|
|
add %g7, %l2, %l2, %tie_add(bl6)
|
|
nop;nop;nop;nop
|
|
|
|
/* direct %g7 access IE -> LE against local var */
|
|
sethi %tie_hi22(bl8), %o3
|
|
add %o3, %tie_lo10(bl8), %o5
|
|
ldx [%l4 + %o5], %l2, %tie_ldx(bl8)
|
|
ldsw [%g7 + %l2], %l2, %tie_add(bl8)
|
|
nop;nop;nop;nop
|
|
|
|
/* IE -> LE against hidden but not local var */
|
|
sethi %tie_hi22(sh6), %o3
|
|
add %o3, %tie_lo10(sh6), %o5
|
|
ldx [%l4 + %o5], %l2, %tie_ldx(sh6)
|
|
add %g7, %l2, %l2, %tie_add(sh6)
|
|
nop;nop;nop;nop
|
|
|
|
/* direct %g7 access IE -> LE against hidden but not local var */
|
|
sethi %tie_hi22(bl8), %o3
|
|
add %o3, %tie_lo10(bl8), %o5
|
|
ldx [%l4 + %o5], %l2, %tie_ldx(bl8)
|
|
stb %l1, [%g7 + %l2], %tie_add(bl8)
|
|
nop;nop;nop;nop
|
|
|
|
/* LE, global var defined in exec */
|
|
sethi %tle_hix22(sg2), %l1
|
|
nop
|
|
xor %l1, %tle_lox10(sg2), %l2
|
|
nop
|
|
add %g7, %l2, %l3
|
|
nop;nop;nop;nop
|
|
|
|
/* LE, local var */
|
|
sethi %tle_hix22(bl2+2), %o0
|
|
xor %o0, %tle_lox10(bl2+2), %o0
|
|
add %g7, %o0, %o0
|
|
nop;nop;nop;nop
|
|
|
|
/* LE, hidden var defined in exec */
|
|
sethi %tle_hix22(sh2+1), %l1
|
|
xor %l1, %tle_lox10(sh2+1), %o5
|
|
add %g7, %o5, %o1
|
|
nop;nop;nop;nop
|
|
|
|
/* Direct %g7 access */
|
|
|
|
/* LE, global var defined in exec */
|
|
sethi %tle_hix22(sg3), %l1
|
|
xor %l1, %tle_lox10(sg3), %o5
|
|
ldx [%g7 + %o5], %o1
|
|
nop;nop;nop;nop
|
|
|
|
/* LE, local var */
|
|
sethi %tle_hix22(bl3 + 3), %o0
|
|
xor %o0, %tle_lox10(bl3 + 3), %o0
|
|
stb %o1, [%g7 + %o0]
|
|
nop;nop;nop;nop
|
|
|
|
/* LE, hidden var defined in exec */
|
|
sethi %tle_hix22(sh3 + 3), %o2
|
|
xor %o2, %tle_lox10(sh3 + 3), %o4
|
|
ldstub [%g7 + %o4], %o5
|
|
nop;nop;nop;nop
|
|
|
|
ret
|
|
restore
|