910600e9c7
* config.bfd (sparc-*-vxworks*): New stanza. * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza. (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo. * configure: Regenerate. * elf32-sparc.c: Include elf-vxworks.h. (elf32_sparc_vxworks_link_hash_table_create: New. (elf32_sparc_vxworks_final_write_processing): New. (TARGET_BIG_SYM): Override for VxWorks. (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise. (bfd_elf32_bfd_link_hash_table_create): Likewise. (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise. (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise. (elf_backend_link_output_symbol_hook): Likewise. (elf_backend_emit_relocs): Likewise. (elf_backend_final_write_processing, elf32_bed): Likewise. * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h. (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New. (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New. (_bfd_sparc_elf_link_hash_table_create): Don't initialize build_plt_entry here. (create_got_section): Initialize sgotplt for VxWorks. (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry, plt_header_size and plt_entry_size, with new VxWorks-specific settings. Call elf_vxworks_create_dynamic_sections for VxWorks. (allocate_dynrelocs): Use plt_header_size and plt_entry_size. Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks. (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt for VxWorks. Check for the .got.plt section. (sparc_vxworks_build_plt_entry): New function. (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs. Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_ absolute on VxWorks. (sparc32_finish_dyn): Add special handling for DT_RELASZ and DT_PLTGOT on VxWorks. (sparc_vxworks_finish_exec_plt): New. (sparc_vxworks_finish_shared_plt): New. (_bfd_sparc_elf_finish_dynamic_sections): Call them. Use plt_header_size and plt_entry_size. * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks, srelplt2, sgotplt, plt_header_size and plt_entry_size fields. * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h. (elf32-sparc.lo): Likewise. * Makefile.in: Regenerate. * targets.c (bfd_elf32_sparc_vxworks_vec): Declare. (_bfd_target_vector): Add a pointer to it. gas/ * config/tc-sparc.c (sparc_target_format): Handle TE_VXWORKS. (GOTT_BASE, GOTT_INDEX): New. (tc_gen_reloc): Don't alter relocations against GOTT_BASE and GOTT_INDEX when generating VxWorks PIC. * configure.tgt (sparc*-*-vxworks*): Remove this special case; use the generic *-*-vxworks* stanza instead. gas/testsuite/ * gas/sparc/vxworks-pic.s, gas/sparc/vxworks-pic.d: New test. * gas/sparc/sparc.exp: Run it. Remove sparc*-*-vxworks* XFAILs. ld/ * configure.tgt (sparc*-*-vxworks*): New stanza. * emulparams/elf32_sparc_vxworks.sh: New file. * Makefile.am (ALL_EMULATIONS): Add eelf32_sparc_vxworks.o. (eelf32_sparc_vxworks.c): New rule. * Makefile.in: Regenerate. ld/testsuite/ * ld-sparc/vxworks1.dd, ld-sparc/vxworks1.ld, ld-sparc/vxworks1-lib.dd, * ld-sparc/vxworks1-lib.nd, ld-sparc/vxworks1-lib.rd, * ld-sparc/vxworks1-lib.s, ld-sparc/vxworks1.rd, ld-sparc/vxworks1.s, * ld-sparc/vxworks1-static.d, ld-sparc/vxworks2.s, * ld-sparc/vxworks2.sd, ld-sparc/vxworks2-static.sd: New tests. * ld-sparc/sparc.exp: Run them.
122 lines
5 KiB
Text
122 lines
5 KiB
Text
# Expect script for ld-sparc tests
|
|
# Copyright (C) 2002, 2003, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
|
|
# Test SPARC linking; all types of relocs. This tests the assembler and
|
|
# tools like objdump as well as the linker.
|
|
|
|
if {[istarget "sparc-*-vxworks"]} {
|
|
set sparcvxworkstests {
|
|
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
|
|
"-KPIC" {vxworks1-lib.s}
|
|
{{readelf --relocs vxworks1-lib.rd} {objdump -dr vxworks1-lib.dd}
|
|
{readelf --symbols vxworks1-lib.nd}}
|
|
"libvxworks1.so"}
|
|
{"VxWorks executable test 1 (dynamic)" \
|
|
"tmpdir/libvxworks1.so -Tvxworks1.ld -q --force-dynamic"
|
|
"" {vxworks1.s}
|
|
{{readelf --relocs vxworks1.rd} {objdump -dr vxworks1.dd}}
|
|
"vxworks1"}
|
|
{"VxWorks executable test 2 (dynamic)" \
|
|
"-Tvxworks1.ld -q --force-dynamic"
|
|
"" {vxworks2.s}
|
|
{{readelf --segments vxworks2.sd}}
|
|
"vxworks2"}
|
|
{"VxWorks executable test 2 (static)"
|
|
"-Tvxworks1.ld"
|
|
"" {vxworks2.s}
|
|
{{readelf --segments vxworks2-static.sd}}
|
|
"vxworks2"}
|
|
}
|
|
run_ld_link_tests $sparcvxworkstests
|
|
run_dump_test "vxworks1-static"
|
|
}
|
|
|
|
if { !([istarget "sparc*-*-elf*"]
|
|
|| [istarget "sparc*-sun-solaris*"]
|
|
|| ([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 {
|
|
{"32-bit: 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"}
|
|
{"32-bit: Helper shared library" "-shared -melf32_sparc"
|
|
"--32 -K PIC" {tlslib.s} {} "libtlslib32.so"}
|
|
{"32-bit: Another helper shared library" "-shared -melf32_sparc"
|
|
"--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"}
|
|
{"32-bit: 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"}
|
|
{"32-bit: 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"}
|
|
{"32-bit: TLS in debug sections" "-melf32_sparc"
|
|
"--32" {tlsg32.s}
|
|
{{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
|
|
}
|
|
set sparc64tests {
|
|
{"64-bit: 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"}
|
|
{"64-bit: Helper shared library" "-shared -melf64_sparc"
|
|
"--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"}
|
|
{"64-bit: Another helper shared library" "-shared -melf64_sparc"
|
|
"--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"}
|
|
{"64-bit: 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"}
|
|
{"64-bit: 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"}
|
|
{"64-bit: TLS in debug sections" "-melf64_sparc"
|
|
"--64 -Av9" {tlsg64.s}
|
|
{{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
|
|
}
|
|
|
|
if { ![istarget "sparc64-*-elf*"] } {
|
|
run_ld_link_tests $sparctests
|
|
}
|
|
if { !([istarget "sparc-*-elf*"]
|
|
|| [istarget "sparc-sun-solaris2.5*"]
|
|
|| [istarget "sparc-sun-solaris2.6"]) } {
|
|
run_ld_link_tests $sparc64tests
|
|
}
|