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.
88 lines
3.9 KiB
Text
88 lines
3.9 KiB
Text
# Expect script for ld-sparc tests
|
|
# Copyright (C) 2002, 2003 Free Software Foundation
|
|
#
|
|
# This file is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
#
|
|
|
|
# Test i386 linking; all types of relocs. This tests the assembler and
|
|
# tools like objdump as well as the linker.
|
|
|
|
if { !([istarget "sparc*-*-elf*"]
|
|
|| ([istarget "sparc*-*-linux*"]
|
|
&& ![istarget "*-*-*aout*"]
|
|
&& ![istarget "*-*-*oldld*"])) } {
|
|
return
|
|
}
|
|
|
|
# List contains test-items with 3 items followed by 2 lists:
|
|
# 0:name 1:ld options 2:assembler options
|
|
# 3:filenames of assembler files 4: action and options. 5: name of output file
|
|
|
|
# Actions:
|
|
# objdump: Apply objdump options on result. Compare with regex (last arg).
|
|
# nm: Apply nm options on result. Compare with regex (last arg).
|
|
# readelf: Apply readelf options on result. Compare with regex (last arg).
|
|
|
|
set sparctests {
|
|
{"TLS -fpic -shared transitions" "-shared -melf32_sparc"
|
|
"--32 -K PIC" {tlssunpic32.s tlspic.s}
|
|
{{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd}
|
|
{objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}}
|
|
"libtlssunpic32.so"}
|
|
{"Helper shared library" "-shared -melf32_sparc"
|
|
"--32 -K PIC" {tlslib.s} {} "libtlslib32.so"}
|
|
{"Another helper shared library" "-shared -melf32_sparc"
|
|
"--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"}
|
|
{"TLS -fpic and -fno-pic exec transitions"
|
|
"-melf32_sparc tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o"
|
|
"--32" {tlssunbin32.s}
|
|
{{readelf -WSsrl tlssunbin32.rd} {objdump -drj.text tlssunbin32.dd}
|
|
{objdump -sj.got tlssunbin32.sd} {objdump -sj.tdata tlssunbin32.td}}
|
|
"tlssunbin32"}
|
|
{"TLS -fno-pic -shared" "-shared -melf32_sparc"
|
|
"--32" {tlssunnopic32.s tlsnopic.s}
|
|
{{readelf -WSsrl tlssunnopic32.rd} {objdump -drj.text tlssunnopic32.dd}
|
|
{objdump -sj.got tlssunnopic32.sd}} "libtlssunnopic32.so"}
|
|
{"TLS in debug sections" "-melf32_sparc"
|
|
"--32" {tlsg32.s}
|
|
{{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
|
|
}
|
|
set sparc64tests {
|
|
{"TLS -fpic -shared transitions" "-shared -melf64_sparc"
|
|
"--64 -Av9 -K PIC" {tlssunpic64.s tlspic.s}
|
|
{{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd}
|
|
{objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}}
|
|
"libtlssunpic64.so"}
|
|
{"Helper shared library" "-shared -melf64_sparc"
|
|
"--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"}
|
|
{"Another helper shared library" "-shared -melf64_sparc"
|
|
"--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"}
|
|
{"TLS -fpic and -fno-pic exec transitions"
|
|
"-melf64_sparc tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o"
|
|
"--64 -Av9" {tlssunbin64.s}
|
|
{{readelf -WSsrl tlssunbin64.rd} {objdump -drj.text tlssunbin64.dd}
|
|
{objdump -sj.got tlssunbin64.sd} {objdump -sj.tdata tlssunbin64.td}}
|
|
"tlssunbin64"}
|
|
{"TLS -fno-pic -shared" "-shared -melf64_sparc"
|
|
"--64 -Av9" {tlssunnopic64.s tlsnopic.s}
|
|
{{readelf -WSsrl tlssunnopic64.rd} {objdump -drj.text tlssunnopic64.dd}
|
|
{objdump -sj.got tlssunnopic64.sd}} "libtlssunnopic64.so"}
|
|
{"TLS in debug sections" "-melf64_sparc"
|
|
"--64 -Av9" {tlsg64.s}
|
|
{{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
|
|
}
|
|
|
|
run_ld_link_tests $sparctests
|
|
# run_ld_link_tests $sparc64tests
|