2004-01-06 21:47:38 +00:00
|
|
|
# Expect script for various ARM ELF tests.
|
|
|
|
# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
|
|
|
|
#
|
|
|
|
# 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
|
2005-05-12 07:32:09 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-06 21:47:38 +00:00
|
|
|
#
|
|
|
|
|
bfd/
* configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo.
(bfd_elf32_bigarm_symbian_vec): Likewise.
(bfd_elf32_bigarm_vxworks_vec): Likewise.
(bfd_elf32_littlearm_vec): Likewise.
(bfd_elf32_littlearm_symbian_vec): Likewise.
(bfd_elf32_littlearm_vxworks_vec): Likewise.
* configure: Regenerate.
* elf32-arm.c: Include libiberty.h and elf-vxworks.h.
(RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros.
(elf32_arm_vxworks_bed): Add forward declaration.
(elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12.
(elf32_arm_vxworks_exec_plt0_entry): New table.
(elf32_arm_vxworks_exec_plt_entry): Likewise.
(elf32_arm_vxworks_shared_plt_entry): Likewise.
(elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields.
(reloc_section_p): New function.
(create_got_section): Use RELOC_SECTION.
(elf32_arm_create_dynamic_sections): Likewise. Call
elf_vxworks_create_dynamic_sections for VxWorks targets.
Choose between the two possible values of plt_header_size
and plt_entry_size.
(elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2.
(elf32_arm_abs12_reloc): New function.
(elf32_arm_final_link_relocate): Call it. Allow the creation of
dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p,
RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the
r_addend fields of relocs. On rela targets, skip any code that
adjusts in-place addends. When using _bfd_link_final_relocate
to perform a final relocation, pass rel->r_addend as the addend
argument.
(elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks
object, ignore flags that are not standard on VxWorks.
(elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12
relocs on VxWorks. Use reloc_section_p.
(elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE.
(allocate_dynrelocs): Use RELOC_SIZE. Account for the size of
.rela.plt.unloaded relocs on VxWorks targets.
(elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for
.rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags
instead of DT_REL* tags on RELA targets.
(elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE
and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks
PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks.
(elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE
and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ
like DT_RELSZ. Handle the VxWorks form of initial PLT entry.
Correct the .rela.plt.unreloaded symbol indexes.
(elf32_arm_output_symbol_hook): Call the VxWorks version of this
hook on VxWorks targets.
(elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true.
Minor formatting tweak.
(elf32_arm_vxworks_final_write_processing): New function.
(elf_backend_add_symbol_hook): Override for VxWorks and reset
for Symbian.
(elf_backend_final_write_processing): Likewise.
(elf_backend_emit_relocs): Likewise.
(elf_backend_want_plt_sym): Likewise.
(ELF_MAXPAGESIZE): Likewise.
(elf_backend_may_use_rel_p): Minor formatting tweak.
(elf_backend_may_use_rela_p): Likewise.
(elf_backend_default_use_rela_p): Likewise.
(elf_backend_rela_normal): Likewise.
* Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h.
gas/
* config/tc-arm.c (md_apply_fix): Install a value of zero into a
BFD_RELOC_ARM_OFFSET_IMM field if we're going to generate a RELA
R_ARM_ABS12 reloc.
(tc_gen_reloc): Keep the original fx_offset for RELA pc-relative
relocs, but adjust by md_pcrel_from_section. Create R_ARM_ABS12
relocations for BFD_RELOC_ARM_OFFSET_IMM on RELA targets.
gas/testsuite/
* gas/arm/abs12.s, gas/arm/abs12.d: New test.
* gas/arm/pic.d: Skip for *-*-vxworks*...
* gas/arm/pic_vxworks.d: ...use this version instead.
* gas/arm/unwind_vxworks.d: Fix expected output.
ld/
* emulparams/armelf_vxworks.sh: Include vxworks.sh.
(MAXPAGESIZE): Define.
* emulparams/vxworks.sh: Undefine.
* Makefile.am (earmelf_vxworks.c): Depend on vxworks.sh and vxworks.em.
* Makefile.in: Regenerate.
ld/testsuite/
* ld-arm/vxworks1.dd, ld-arm/vxworks1.ld, ld-arm/vxworks1-lib.dd,
* ld-arm/vxworks1-lib.nd, ld-arm/vxworks1-lib.rd,
* ld-arm/vxworks1-lib.s, ld-arm/vxworks1.rd, ld-arm/vxworks1.s,
* ld-arm/vxworks1-static.d, ld-arm/vxworks2.s, ld-arm/vxworks2.sd,
* ld-arm/vxworks2-static.sd: New tests.
* ld-arm/arm-elf.exp: Run them.
2006-03-07 08:39:21 +00:00
|
|
|
if {[istarget "arm-*-vxworks"]} {
|
|
|
|
set armvxworkstests {
|
|
|
|
{"VxWorks shared library test 1" "-shared -Tvxworks1.ld"
|
|
|
|
"" {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 $armvxworkstests
|
|
|
|
run_dump_test "vxworks1-static"
|
|
|
|
}
|
|
|
|
|
2004-01-06 21:47:38 +00:00
|
|
|
# Exclude non-ARM-ELF targets.
|
|
|
|
|
|
|
|
if { ![is_elf_format] || ![istarget "arm*-*-*"] } {
|
|
|
|
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 armelftests {
|
|
|
|
{"Simple non-PIC shared library" "-shared" "" {arm-lib.s}
|
|
|
|
{{objdump -fdw arm-lib.d} {objdump -Rw arm-lib.r}}
|
|
|
|
"arm-lib.so"}
|
|
|
|
{"Simple PIC shared library" "-shared" "" {arm-lib-plt32.s}
|
|
|
|
{{objdump -fdw arm-lib-plt32.d} {objdump -Rw arm-lib-plt32.r}}
|
|
|
|
"arm-lib-plt32.so"}
|
|
|
|
{"Simple dynamic application" "tmpdir/arm-lib.so" "" {arm-app.s}
|
|
|
|
{{objdump -fdw arm-app.d} {objdump -Rw arm-app.r}}
|
|
|
|
"arm-app"}
|
2004-01-13 21:09:18 +00:00
|
|
|
{"Simple static application" "" "" {arm-static-app.s}
|
|
|
|
{{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}}
|
|
|
|
"arm-static-app"}
|
2004-01-23 16:51:39 +00:00
|
|
|
{"Non-pcrel function reference" "tmpdir/arm-lib.so" "" {arm-app-abs32.s}
|
|
|
|
{{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}}
|
|
|
|
"arm-app-abs32"}
|
bfd/
* elf32-arm.c (PLT_THUMB_STUB_SIZE): Define.
(elf32_arm_plt_thumb_stub): New.
(struct elf32_arm_link_hash_entry): Add plt_thumb_refcount
and plt_got_offset.
(elf32_arm_link_hash_traverse): Fix typo.
(elf32_arm_link_hash_table): Add obfd.
(elf32_arm_link_hash_newfunc): Initialize new fields.
(elf32_arm_copy_indirect_symbol): Copy plt_thumb_refcount.
(elf32_arm_link_hash_table_create): Initialize obfd.
(record_arm_to_thumb_glue): Mark the glue as a local ARM function.
(record_thumb_to_arm_glue): Mark the glue as a local Thumb function.
(bfd_elf32_arm_get_bfd_for_interworking): Verify that the
interworking BFD is not dynamic.
(bfd_elf32_arm_process_before_allocation): Handle R_ARM_PLT32. Do
not emit glue for PLT references.
(elf32_arm_final_link_relocate): Handle Thumb functions. Do not
emit glue for PLT references. Support the Thumb PLT prefix.
(elf32_arm_gc_sweep_hook): Handle R_ARM_THM_PC22 and
plt_thumb_refcount.
(elf32_arm_check_relocs): Likewise.
(elf32_arm_adjust_dynamic_symbol): Handle Thumb functions and
plt_thumb_refcount.
(allocate_dynrelocs): Handle Thumb PLT references.
(elf32_arm_finish_dynamic_symbol): Likewise.
(elf32_arm_symbol_processing): New function.
(elf_backend_symbol_processing): Define.
opcodes/
* arm-dis.c (WORD_ADDRESS): Define.
(print_insn): Use it. Correct big-endian end-of-section handling.
gas/testsuite/
* gas/arm/mapping.d: Expect F markers for Thumb code.
* gas/arm/unwind.d: Update big-endian pattern.
ld/
* emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Don't use
a dynamic object for stubs.
ld/testsuite/
* ld-arm/mixed-app.d, ld-arm/mixed-app.r, ld-arm/mixed-app.s,
ld-arm/mixed-app.sym, ld-arm/mixed-lib.d, ld-arm/mixed-lib.r,
ld-arm/mixed-lib.s, ld-arm/mixed-lib.sym, ld-arm/arm-dyn.ld,
ld-arm/arm-lib.ld: New files.
* ld-arm/arm-app-abs32.d, ld-arm/arm-app-abs32.r, ld-arm/arm-app.d,
ld-arm/arm-app.r, ld-arm/arm-lib-plt32.d, ld-arm/arm-lib-plt32.r,
ld-arm/arm-lib.d, ld-arm/arm-lib.r, ld-arm/arm-static-app.d,
ld-arm/arm-static-app.r: Update for big-endian.
* ld-arm/arm-elf.exp: Run the new tests.
2004-11-17 17:50:28 +00:00
|
|
|
{"Mixed ARM/Thumb shared library" "-shared -T arm-lib.ld" ""
|
|
|
|
{mixed-lib.s}
|
|
|
|
{{objdump -fdw mixed-lib.d} {objdump -Rw mixed-lib.r}
|
|
|
|
{readelf -Ds mixed-lib.sym}}
|
|
|
|
"mixed-lib.so"}
|
|
|
|
{"Mixed ARM/Thumb dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld" ""
|
|
|
|
{mixed-app.s}
|
|
|
|
{{objdump -fdw mixed-app.d} {objdump -Rw mixed-app.r}
|
|
|
|
{readelf -Ds mixed-app.sym}}
|
|
|
|
"mixed-app"}
|
2005-12-12 17:03:40 +00:00
|
|
|
{"Mixed ARM/Thumb arch5 dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" ""
|
|
|
|
{mixed-app.s}
|
|
|
|
{{objdump -fdw mixed-app-v5.d} {objdump -Rw mixed-app.r}
|
|
|
|
{readelf -Ds mixed-app.sym}}
|
|
|
|
"mixed-app-v5"}
|
2004-09-17 12:18:19 +00:00
|
|
|
{"target1-abs" "-static --target1-abs -T arm.ld" "" {arm-target1.s}
|
|
|
|
{{objdump -s arm-target1-abs.d}}
|
|
|
|
"arm-target1-abs"}
|
|
|
|
{"target1-rel" "-static --target1-rel -T arm.ld" "" {arm-target1.s}
|
|
|
|
{{objdump -s arm-target1-rel.d}}
|
|
|
|
"arm-target1-rel"}
|
|
|
|
{"target2-rel" "-static --target2=rel -T arm.ld" "" {arm-target2.s}
|
|
|
|
{{objdump -s arm-target2-rel.d}}
|
|
|
|
"arm-target2-rel"}
|
2004-09-30 17:03:53 +00:00
|
|
|
{"target2-abs" "-static --target2=abs -T arm.ld" "" {arm-target2.s}
|
|
|
|
{{objdump -s arm-target2-abs.d}}
|
|
|
|
"arm-target2-abs"}
|
2004-09-17 12:18:19 +00:00
|
|
|
{"target2-got-rel" "-static --target2=got-rel -T arm.ld" "" {arm-target2.s}
|
|
|
|
{{objdump -s arm-target2-got-rel.d}}
|
|
|
|
"arm-target2-got-rel"}
|
|
|
|
{"arm-rel31" "-static -T arm.ld" "" {arm-rel31.s}
|
|
|
|
{{objdump -s arm-rel31.d}}
|
|
|
|
"arm-rel31"}
|
2005-12-12 17:03:40 +00:00
|
|
|
{"arm-call" "-static -T arm.ld" "-meabi=4" {arm-call1.s arm-call2.s}
|
|
|
|
{{objdump -d arm-call.d}}
|
|
|
|
"arm-call"}
|
bfd/
* bfd-in2.h, libbfd.h: Regenerated.
* reloc.c: Add ARM TLS relocations.
* elf32-arm.c (elf32_arm_howto_table): Add dynamic TLS
relocations.
(elf32_arm_tls_gd32_howto, elf32_arm_tls_ldo32_howto)
(elf32_arm_tls_ldm32_howto, elf32_arm_tls_le32_howto)
(elf32_arm_tls_ie32_howto): New.
(elf32_arm_howto_from_type): Support TLS relocations.
(elf32_arm_reloc_map): Likewise.
(elf32_arm_reloc_type_lookup): Likewise.
(TCB_SIZE): Define.
(struct elf32_arm_obj_tdata): New.
(elf32_arm_tdata, elf32_arm_local_got_tls_type): Define.
(elf32_arm_mkobject): New function.
(struct elf32_arm_relocs_copied): Add pc_count.
(elf32_arm_hash_entry, GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD)
(GOT_TLS_IE): Define.
(struct elf32_arm_link_hash_table): Add tls_ldm_got.
(elf32_arm_link_hash_newfunc): Initialize tls_type.
(elf32_arm_copy_indirect_symbol): Copy pc_count and tls_type.
(elf32_arm_link_hash_table_create): Initialize tls_ldm_got.
(dtpoff_base, tpoff): New functions.
(elf32_arm_final_link_relocate): Handle TLS relocations.
(IS_ARM_TLS_RELOC): Define.
(elf32_arm_relocate_section): Warn about TLS mismatches.
(elf32_arm_gc_sweep_hook): Handle TLS relocations and pc_count.
(elf32_arm_check_relocs): Detect invalid symbol indexes. Handle
TLS relocations and pc_count.
(elf32_arm_adjust_dynamic_symbol): Check non_got_ref.
(allocate_dynrelocs): Handle TLS. Bind REL32 relocs to local
calls.
(elf32_arm_size_dynamic_sections): Handle TLS.
(elf32_arm_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject): Define.
gas/
* config/tc-arm.c (arm_parse_reloc): Add TLS relocations.
(md_apply_fix3): Mark TLS symbols.
(tc_gen_reloc): Handle TLS relocations.
(arm_fix_adjustable): Ignore TLS relocations.
(s_arm_elf_cons): Support expressions after decorated symbols.
gas/testuite/
* gas/arm/tls.s, gas/arm/tls.d: New files.
* gas/arm/arm.exp: Run TLS test.
include/elf/
* arm.h: Add TLS relocations.
ld/testsuite/
* ld-arm/tls-lib.s, ld-arm/tls-lib.d, ld-arm/tls-lib.r,
ld-arm/tls-app.s, ld-arm/tls-app.d, ld-arm/tls-app.r: New files.
* ld-arm/arm-lib.ld, ld-arm/arm-dyn.ld: Increase data segment
alignment.
* ld-arm/arm-elf.exp: Run TLS tests.
2005-03-29 16:54:22 +00:00
|
|
|
{"TLS shared library" "-shared -T arm-lib.ld" "" {tls-lib.s}
|
|
|
|
{{objdump -fdw tls-lib.d} {objdump -Rw tls-lib.r}}
|
|
|
|
"tls-lib.so"}
|
|
|
|
{"TLS dynamic application" "-T arm-dyn.ld tmpdir/tls-lib.so" "" {tls-app.s}
|
|
|
|
{{objdump -fdw tls-app.d} {objdump -Rw tls-app.r}}
|
|
|
|
"tls-app"}
|
2006-02-07 03:50:20 +00:00
|
|
|
{"Thumb entry point" "-T arm.ld" "" {thumb-entry.s}
|
|
|
|
{{readelf -h thumb-entry.d}}
|
|
|
|
"thumb-entry"}
|
2006-05-02 13:09:18 +00:00
|
|
|
{"thumb-rel32" "-static -T arm.ld" "" {thumb-rel32.s}
|
|
|
|
{{objdump -s thumb-rel32.d}}
|
|
|
|
"thumb-rel32"}
|
2006-05-11 15:17:34 +00:00
|
|
|
{"MOVW/MOVT" "-static -T arm.ld" "" {arm-movwt.s}
|
|
|
|
{{objdump -dw arm-movwt.d}}
|
|
|
|
"arm-movwt"}
|
2004-01-06 21:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_ld_link_tests $armelftests
|