binutils-gdb/ld/testsuite/ld-aarch64/aarch64-elf.exp

352 lines
12 KiB
Plaintext
Raw Normal View History

# Expect script for various AARCH64 ELF tests.
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program 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 3 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.
# Exclude non-aarch64-ELF targets.
if { ![is_elf_format] || ![istarget "aarch64*-*-*"] } {
return
}
# List contains test-items with 3 items followed by 2 lists:
* lib/ld-lib.exp (run_ld_link_tests): Add another argument, pass its contents to ar_simple_create and ld_simple_link after objfiles. * ld-aarch64/aarch64-elf.exp: Adjust accordingly. * ld-alpha/alpha.exp: Likewise. * ld-arm/arm-elf.exp: Likewise. * ld-arm/export-class.exp: Likewise. * ld-elf/comm-data.exp: Likewise. * ld-elf/eh-group.exp: Likewise. * ld-elf/elf.exp: Likewise. * ld-elf/export-class.exp: Likewise. * ld-elfvers/vers.exp: Likewise. * ld-frv/tls.exp: Likewise. * ld-i386/export-class.exp: Likewise. * ld-i386/i386.exp: Likewise. * ld-ia64/ia64.exp: Likewise. * ld-libs/libs.exp: Likewise. * ld-m68k/m68k.exp: Likewise. * ld-metag/metag.exp: Likewise. * ld-mips-elf/comm-data.exp: Likewise. * ld-mips-elf/export-class.exp: Likewise. * ld-mips-elf/mips-elf.exp: Likewise. * ld-mn10300/mn10300.exp: Likewise. * ld-pe/pe-compile.exp: Likewise. * ld-pe/pe.exp: Likewise. * ld-plugin/plugin.exp: Likewise. * ld-powerpc/aix52.exp: Likewise. * ld-powerpc/export-class.exp: Likewise. * ld-powerpc/powerpc.exp: Likewise. * ld-s390/s390.exp: Likewise. * ld-sh/sh-vxworks.exp: Likewise. * ld-sh/sh64/sh64.exp: Likewise. * ld-sparc/sparc.exp: Likewise. * ld-tic6x/tic6x.exp: Likewise. * ld-tilegx/tilegx.exp: Likewise. * ld-tilepro/tilepro.exp: Likewise. * ld-undefined/entry.exp: Likewise. * ld-vax-elf/vax-elf.exp: Likewise. * ld-x86-64/dwarfreloc.exp: Likewise. * ld-x86-64/export-class.exp: Likewise. * ld-x86-64/x86-64.exp: Likewise. * ld-xc16x/xc16x.exp: Likewise. * ld-xstormy16/xstormy16.exp: Likewise. * ld-xtensa/xtensa.exp: Likewise.
2013-02-19 09:10:06 +08:00
# 0:name 1:ld early options 2:ld late options 3:assembler options
# 4:filenames of assembler files 5: action and options. 6: 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 aarch64elftests {
[AArch64] Cortex-A53 erratum 835769 linker workaround 2014-10-22 Tejas Belagod <tejas.belagod@arm.com> bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New.
2014-10-24 18:39:35 +08:00
{"Erratum 835769 dump test"
"--fix-cortex-a53-835769" "" "" {erratum835769.s}
{{objdump -dr erratum835769.d}}
"erratum835769"}
{"Erratum 835769 dump test -shared"
"--fix-cortex-a53-835769 -shared" "" "" {erratum835769.s}
{{objdump -dr erratum835769.d}}
"erratum835769"}
}
proc aarch64_choose_ilp32_emul {} {
if [istarget *linux*] then {
if [istarget aarch64_be-*] {
return "aarch64linux32b"
}
return "aarch64linux32"
}
if [istarget aarch64_be-*] {
return "aarch64elf32b"
}
return "aarch64elf32"
}
proc aarch64_choose_lp64_emul {} {
if [istarget *linux*] then {
if [istarget aarch64_be-*] {
return "aarch64linuxb"
}
return "aarch64linux"
}
if [istarget aarch64_be-*] {
return "aarch64elfb"
}
return "aarch64elf"
}
proc run_dump_test_lp64 { testname } {
run_dump_test $testname \
[list [list as "-mabi=lp64"] \
[list ld [concat "-m " [aarch64_choose_lp64_emul]]]]
}
set eh-frame-merge-lp64 [list [list "EH Frame merge" \
[concat "-m " [aarch64_choose_lp64_emul] \
" -Ttext 0x8000"] \
"" "-mabi=lp64" {eh-frame-bar.s eh-frame-foo.s} \
{{objdump --dwarf=frames eh-frame.d}} \
"eh-frame"]]
run_ld_link_tests $aarch64elftests
run_ld_link_tests eh-frame-merge-lp64
run_dump_test "erratum843419"
# Relocation Tests
run_dump_test_lp64 "weak-undefined"
run_dump_test "emit-relocs-28"
run_dump_test "emit-relocs-86"
run_dump_test "emit-relocs-86-overflow"
[AArch64][4/6] LD support TLSLD move/add relocation types 2015-08-19 Jiong Wang <jiong.wang@arm.com> bfd/ PR ld/18276 * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2. (elfNN_aarch64_final_link_relocate): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-87.s: New testcase. * ld-aarch64/emit-relocs-88.s: Likewise. * ld-aarch64/emit-relocs-88-overflow.s: Likewise. * ld-aarch64/emit-relocs-89.s: Likewise. * ld-aarch64/emit-relocs-90.s: Likewise. * ld-aarch64/emit-relocs-90-overflow.s: Likewise. * ld-aarch64/emit-relocs-523.s: Likewise. * ld-aarch64/emit-relocs-524.s: Likewise. * ld-aarch64/emit-relocs-525.s: Likewise. * ld-aarch64/emit-relocs-527.s: Likewise. * ld-aarch64/emit-relocs-526.s: Likewise. * ld-aarch64/emit-relocs-528.s: Likewise. * ld-aarch64/emit-relocs-528-overflow.s: Likewise. * ld-aarch64/emit-relocs-87.d: New expectation file. * ld-aarch64/emit-relocs-88.d: Likewise. * ld-aarch64/emit-relocs-88-overflow.d: Likewise. * ld-aarch64/emit-relocs-89.d: Likewise. * ld-aarch64/emit-relocs-90.d: Likewise. * ld-aarch64/emit-relocs-90-overflow.d: Likewise. * ld-aarch64/emit-relocs-91.d: Likewise. * ld-aarch64/emit-relocs-523.d: Likewise. * ld-aarch64/emit-relocs-524.d: Likewise. * ld-aarch64/emit-relocs-525.d: Likewise. * ld-aarch64/emit-relocs-526.d: Likewise. * ld-aarch64/emit-relocs-527.d: Likewise. * ld-aarch64/emit-relocs-528.d: Likewise. * ld-aarch64/emit-relocs-528-overflow.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new testcases.
2015-08-19 18:18:25 +08:00
run_dump_test "emit-relocs-87"
run_dump_test "emit-relocs-88"
run_dump_test "emit-relocs-88-overflow"
run_dump_test "emit-relocs-89"
run_dump_test "emit-relocs-90"
run_dump_test "emit-relocs-90-overflow"
run_dump_test "emit-relocs-92"
run_dump_test_lp64 "emit-relocs-257"
run_dump_test_lp64 "emit-relocs-257-be"
# 258 is tested in 257
# 259 is tested in 257
run_dump_test_lp64 "emit-relocs-258-dyn-bad"
run_dump_test_lp64 "emit-relocs-259-dyn-bad"
run_dump_test_lp64 "emit-relocs-260"
run_dump_test_lp64 "emit-relocs-260-be"
# 261 is tested by 260
run_dump_test_lp64 "emit-relocs-262"
run_dump_test_lp64 "emit-relocs-263"
run_dump_test_lp64 "emit-relocs-264"
run_dump_test_lp64 "emit-relocs-264-bad"
run_dump_test_lp64 "emit-relocs-265"
run_dump_test_lp64 "emit-relocs-266"
run_dump_test_lp64 "emit-relocs-266-bad"
run_dump_test_lp64 "emit-relocs-267"
run_dump_test_lp64 "emit-relocs-268"
run_dump_test_lp64 "emit-relocs-268-bad"
run_dump_test_lp64 "emit-relocs-269"
run_dump_test_lp64 "emit-relocs-269-bad"
run_dump_test_lp64 "emit-relocs-270"
run_dump_test_lp64 "emit-relocs-270-bad"
run_dump_test_lp64 "emit-relocs-270-overflow"
run_dump_test_lp64 "emit-relocs-271"
run_dump_test_lp64 "emit-relocs-271-overflow"
run_dump_test_lp64 "emit-relocs-272"
run_dump_test_lp64 "emit-relocs-272-overflow"
run_dump_test_lp64 "emit-relocs-273"
run_dump_test_lp64 "emit-relocs-274"
run_dump_test_lp64 "emit-relocs-275"
run_dump_test_lp64 "emit-relocs-276"
run_dump_test_lp64 "emit-relocs-277"
run_dump_test_lp64 "emit-relocs-278"
run_dump_test_lp64 "emit-relocs-279"
run_dump_test_lp64 "emit-relocs-279-bad"
run_dump_test_lp64 "emit-relocs-280"
# 281 is unused
run_dump_test_lp64 "emit-relocs-282"
run_dump_test_lp64 "emit-relocs-283"
run_dump_test_lp64 "emit-relocs-284"
run_dump_test_lp64 "emit-relocs-285"
run_dump_test_lp64 "emit-relocs-286"
run_dump_test_lp64 "emit-relocs-286-bad"
# 287-298 are not done yet
run_dump_test_lp64 "emit-relocs-299"
# 300 is not done yet
run_dump_test_lp64 "emit-relocs-301"
run_dump_test_lp64 "emit-relocs-301-be"
run_dump_test_lp64 "emit-relocs-302"
run_dump_test_lp64 "emit-relocs-302-be"
# 303-308 are not done yet
run_dump_test_lp64 "emit-relocs-309-up"
run_dump_test_lp64 "emit-relocs-309-low"
run_dump_test_lp64 "emit-relocs-309-up-bad"
run_dump_test_lp64 "emit-relocs-309-low-bad"
run_dump_test_lp64 "emit-relocs-310"
run_dump_test_lp64 "emit-relocs-310-be"
run_dump_test_lp64 "emit-relocs-311"
run_dump_test_lp64 "emit-relocs-312"
run_dump_test_lp64 "emit-relocs-313"
run_dump_test_lp64 "emit-relocs-515"
run_dump_test_lp64 "emit-relocs-515-be"
run_dump_test_lp64 "emit-relocs-516"
run_dump_test_lp64 "emit-relocs-516-be"
run_dump_test_lp64 "emit-relocs-523"
run_dump_test_lp64 "emit-relocs-524"
run_dump_test_lp64 "emit-relocs-525"
run_dump_test_lp64 "emit-relocs-526"
run_dump_test_lp64 "emit-relocs-526-overflow"
run_dump_test_lp64 "emit-relocs-527"
run_dump_test_lp64 "emit-relocs-528"
run_dump_test_lp64 "emit-relocs-528-overflow"
run_dump_test_lp64 "emit-relocs-529"
run_dump_test_lp64 "emit-relocs-529-overflow"
run_dump_test_lp64 "emit-relocs-530"
run_dump_test_lp64 "emit-relocs-531"
run_dump_test_lp64 "emit-relocs-531-overflow"
run_dump_test_lp64 "emit-relocs-532"
run_dump_test_lp64 "emit-relocs-533"
run_dump_test_lp64 "emit-relocs-533-overflow"
run_dump_test_lp64 "emit-relocs-534"
run_dump_test_lp64 "emit-relocs-535"
run_dump_test_lp64 "emit-relocs-535-overflow"
run_dump_test_lp64 "emit-relocs-536"
run_dump_test_lp64 "emit-relocs-537"
run_dump_test_lp64 "emit-relocs-537-overflow"
run_dump_test_lp64 "emit-relocs-538"
run_dump_test "reloc-overflow-bad"
2014-07-08 16:29:06 +08:00
# test addend correctness when --emit-relocs specified for non-relocatable obj.
run_dump_test_lp64 "emit-relocs-local-addend"
2014-07-08 16:29:06 +08:00
# test addend correctness when -r specified.
run_dump_test_lp64 "local-addend-r"
# test error handling on pcrel relocation for shared libraries.
run_dump_test_lp64 "pcrel_pic_undefined"
run_dump_test_lp64 "pcrel_pic_defined"
run_dump_test "limit-b"
run_dump_test "limit-bl"
run_dump_test "farcall-back"
run_dump_test "farcall-b-defsym"
run_dump_test "farcall-bl-defsym"
run_dump_test "farcall-b-gsym"
run_dump_test "farcall-b-plt"
run_dump_test "farcall-bl-plt"
run_dump_test "farcall-bl"
run_dump_test "farcall-b"
run_dump_test "farcall-b-none-function"
run_dump_test "farcall-bl-none-function"
run_dump_test "farcall-b-section"
run_dump_test "farcall-bl-section"
run_dump_test "tls-relax-all"
run_dump_test "tls-relax-all-ilp32"
run_dump_test "tls-relax-gd-le"
run_dump_test "tls-relax-gd-le-ilp32"
run_dump_test "tls-relax-gdesc-le"
run_dump_test "tls-relax-gdesc-le-ilp32"
run_dump_test "tls-relax-gd-ie"
run_dump_test "tls-relax-gd-ie-ilp32"
run_dump_test_lp64 "tls-relax-large-gd-ie"
run_dump_test_lp64 "tls-relax-large-gd-ie-be"
run_dump_test_lp64 "tls-relax-large-gd-le"
run_dump_test_lp64 "tls-relax-large-gd-le-be"
run_dump_test_lp64 "tls-relax-large-desc-ie"
run_dump_test_lp64 "tls-relax-large-desc-ie-be"
run_dump_test_lp64 "tls-relax-large-desc-le"
run_dump_test_lp64 "tls-relax-large-desc-le-be"
run_dump_test "tls-relax-gdesc-ie"
run_dump_test "tls-relax-ie-le"
run_dump_test "tls-relax-ie-le-ilp32"
run_dump_test "tls-relax-ld-le-small"
run_dump_test "tls-relax-ld-le-small-ilp32"
run_dump_test "tls-relax-ld-le-tiny"
run_dump_test "tls-relax-ld-le-tiny-ilp32"
run_dump_test "tls-desc-ie"
run_dump_test "tls-desc-ie-ilp32"
run_dump_test "tls-relax-gdesc-ie-2"
run_dump_test "tls-relax-gdesc-le-2"
run_dump_test "tls-relax-gdesc-le-2-ilp32"
run_dump_test "tls-relax-ie-le-2"
run_dump_test "tls-relax-ie-le-2-ilp32"
run_dump_test "tls-relax-ie-le-3"
run_dump_test "tls-relax-ie-le-3-ilp32"
2015-02-19 17:10:11 +08:00
run_dump_test "tls-tiny-gd"
run_dump_test "tls-tiny-gd-ie"
run_dump_test "tls-tiny-gd-ie-ilp32"
2015-02-19 17:10:11 +08:00
run_dump_test "tls-tiny-gd-le"
run_dump_test "tls-tiny-gd-le-ilp32"
2015-02-19 17:52:24 +08:00
run_dump_test "tls-tiny-desc"
run_dump_test "tls-tiny-desc-ie"
run_dump_test "tls-tiny-desc-ie-ilp32"
2015-02-19 17:52:24 +08:00
run_dump_test "tls-tiny-desc-le"
run_dump_test "tls-tiny-desc-le-ilp32"
2015-02-19 02:10:59 +08:00
run_dump_test "tls-tiny-ie"
run_dump_test_lp64 "tls-large-ie"
run_dump_test_lp64 "tls-large-ie-be"
run_dump_test_lp64 "tls-large-desc"
run_dump_test_lp64 "tls-large-desc-be"
run_dump_test "tls-tiny-ld"
run_dump_test "tls-small-ld"
run_dump_test_lp64 "tlsle"
run_dump_test "tlsle-symbol-offset"
run_dump_test "gc-got-relocs"
run_dump_test "gc-tls-relocs"
run_dump_test_lp64 "gc-plt-relocs"
run_dump_test_lp64 "gc-relocs-257-dyn"
run_dump_test_lp64 "gc-relocs-257"
run_dump_test "implicit_got_section_1"
run_dump_test "pr17415"
run_dump_test_lp64 "tprel_g2_overflow"
run_dump_test "tprel_add_lo12_overflow"
run_dump_test "protected-data"
aarch64: Add support for GNU indirect functions. Add support for STT_GNU_IFUNC symbols to the AArch64 bfd backend. The tests are ported from the ld-ifunc tests but are enabled for cross builds so can be run easily without hardware or a simulator. bfd/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * configure: Regenerate. * configure.in: Build elf-ifunc.o for AArch64. * elfnn-aarch64.c: Include objalloc.h. (elfNN_aarch64_local_htab_hash): New function. (elfNN_aarch64_local_htab_eq): New function. (elfNN_aarch64_get_local_sym_hash): New function. (elfNN_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC symbol hash. (elfNN_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash. (elfNN_aarch64_final_link_relocate): Add sym argument. Add support for handling STT_GNU_IFUNC symbols. (elfNN_aarch64_gc_sweep_hook): Add support for garbage collecting references to STT_GNU_IFUNC symbols. (elfNN_aarch64_adjust_dynamic_symbol): Add support for handling STT_GNU_IFUNC symbols. (elfNN_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC symbols. Ensure we don't increase plt.refcount from -1 to 0. (elfNN_aarch64_post_process_headers): Call _bfd_elf_set_osabi. (elfNN_aarch64_is_function_type): Remove function. (elfNN_aarch64_allocate_dynrelocs): Handle STT_GNU_IFUNC symbols. (elfNN_aarch64_allocate_ifunc_dynrelocs): New function. (elfNN_aarch64_allocate_local_dynrelocs): New function. (elfNN_aarch64_allocate_local_ifunc_dynrelocs): New function. (elfNN_aarch64_size_dynamic_sections): Call elfNN_aarch64_allocate_local_dynrelocs. (elfNN_aarch64_create_small_pltn_entry): Add info argument. Add support for creating .iplt entries for STT_GNU_IFUNC symbols. (elfNN_aarch64_finish_dynamic_symbol): Add support for handling STT_GNU_IFUNC symbols and .iplt. (elfNN_aarch64_finish_local_dynamic_symbol): New function. (elfNN_aarch64_finish_dynamic_sections): Call elfNN_aarch64_finish_local_dynamic_symbol. ld/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * emulparams/aarch64elf.sh: Add IREL_IN_PLT. * emulparams/aarch64elf32.sh: Likewise. ld/testsuite/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64. * ld-aarch64/aarch64-elf.exp: Run ifunc tests. * ld-aarch64/ifunc-1-local.d: New file. * ld-aarch64/ifunc-1-local.s: Likewise. * ld-aarch64/ifunc-1.d: Likewise. * ld-aarch64/ifunc-1.s: Likewise. * ld-aarch64/ifunc-10.d: Likewise. * ld-aarch64/ifunc-10.s: Likewise. * ld-aarch64/ifunc-11.d: Likewise. * ld-aarch64/ifunc-11.s: Likewise. * ld-aarch64/ifunc-12.d: Likewise. * ld-aarch64/ifunc-12.s: Likewise. * ld-aarch64/ifunc-13.d: Likewise. * ld-aarch64/ifunc-13a.s: Likewise. * ld-aarch64/ifunc-13b.s: Likewise. * ld-aarch64/ifunc-14a.d: Likewise. * ld-aarch64/ifunc-14a.s: Likewise. * ld-aarch64/ifunc-14b.d: Likewise. * ld-aarch64/ifunc-14b.s: Likewise. * ld-aarch64/ifunc-14c.d: Likewise. * ld-aarch64/ifunc-14c.s: Likewise. * ld-aarch64/ifunc-14d.d: Likewise. * ld-aarch64/ifunc-14e.d: Likewise. * ld-aarch64/ifunc-14f.d: Likewise. * ld-aarch64/ifunc-15.d: Likewise. * ld-aarch64/ifunc-15.s: Likewise. * ld-aarch64/ifunc-16.d: Likewise. * ld-aarch64/ifunc-16.s: Likewise. * ld-aarch64/ifunc-17a.d: Likewise. * ld-aarch64/ifunc-17a.s: Likewise. * ld-aarch64/ifunc-17b.d: Likewise. * ld-aarch64/ifunc-17b.s: Likewise. * ld-aarch64/ifunc-18a.d: Likewise. * ld-aarch64/ifunc-18a.s: Likewise. * ld-aarch64/ifunc-18b.d: Likewise. * ld-aarch64/ifunc-18b.s: Likewise. * ld-aarch64/ifunc-19a.d: Likewise. * ld-aarch64/ifunc-19a.s: Likewise. * ld-aarch64/ifunc-19b.d: Likewise. * ld-aarch64/ifunc-19b.s: Likewise. * ld-aarch64/ifunc-2-local.d: Likewise. * ld-aarch64/ifunc-2-local.s: Likewise. * ld-aarch64/ifunc-2.d: Likewise. * ld-aarch64/ifunc-2.s: Likewise. * ld-aarch64/ifunc-20.d: Likewise. * ld-aarch64/ifunc-20.s: Likewise. * ld-aarch64/ifunc-3.s: Likewise. * ld-aarch64/ifunc-3a.d: Likewise. * ld-aarch64/ifunc-3b.d: Likewise. * ld-aarch64/ifunc-4.d: Likewise. * ld-aarch64/ifunc-4.s: Likewise. * ld-aarch64/ifunc-4a.d: Likewise. * ld-aarch64/ifunc-5-local.s: Likewise. * ld-aarch64/ifunc-5.s: Likewise. * ld-aarch64/ifunc-5a-local.d: Likewise. * ld-aarch64/ifunc-5a.d: Likewise. * ld-aarch64/ifunc-5b-local.d: Likewise. * ld-aarch64/ifunc-5b.d: Likewise. * ld-aarch64/ifunc-5r-local.d: Likewise. * ld-aarch64/ifunc-6.s: Likewise. * ld-aarch64/ifunc-6a.d: Likewise. * ld-aarch64/ifunc-6b.d: Likewise. * ld-aarch64/ifunc-7.s: Likewise. * ld-aarch64/ifunc-7a.d: Likewise. * ld-aarch64/ifunc-7b.d: Likewise. * ld-aarch64/ifunc-7c.d: Likewise. * ld-aarch64/ifunc-8.d: Likewise. * ld-aarch64/ifunc-8a.s: Likewise. * ld-aarch64/ifunc-8b.s: Likewise. * ld-aarch64/ifunc-9.d: Likewise. * ld-aarch64/ifunc-9.s: Likewise.
2013-10-03 22:46:09 +08:00
# ifunc tests
run_dump_test "ifunc-1"
run_dump_test "ifunc-1-local"
run_dump_test "ifunc-2"
run_dump_test "ifunc-2-local"
run_dump_test "ifunc-3a"
run_dump_test "ifunc-3b"
run_dump_test "ifunc-4"
run_dump_test "ifunc-4a"
run_dump_test "ifunc-5a"
run_dump_test "ifunc-5b"
run_dump_test "ifunc-5a-local"
run_dump_test "ifunc-5b-local"
run_dump_test "ifunc-5r-local"
run_dump_test "ifunc-6a"
run_dump_test "ifunc-6b"
run_dump_test "ifunc-7a"
run_dump_test "ifunc-7b"
run_dump_test "ifunc-7c"
run_dump_test "ifunc-8"
run_dump_test_lp64 "ifunc-9"
run_dump_test_lp64 "ifunc-10"
run_dump_test_lp64 "ifunc-11"
run_dump_test_lp64 "ifunc-12"
run_dump_test_lp64 "ifunc-13"
aarch64: Add support for GNU indirect functions. Add support for STT_GNU_IFUNC symbols to the AArch64 bfd backend. The tests are ported from the ld-ifunc tests but are enabled for cross builds so can be run easily without hardware or a simulator. bfd/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * configure: Regenerate. * configure.in: Build elf-ifunc.o for AArch64. * elfnn-aarch64.c: Include objalloc.h. (elfNN_aarch64_local_htab_hash): New function. (elfNN_aarch64_local_htab_eq): New function. (elfNN_aarch64_get_local_sym_hash): New function. (elfNN_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC symbol hash. (elfNN_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash. (elfNN_aarch64_final_link_relocate): Add sym argument. Add support for handling STT_GNU_IFUNC symbols. (elfNN_aarch64_gc_sweep_hook): Add support for garbage collecting references to STT_GNU_IFUNC symbols. (elfNN_aarch64_adjust_dynamic_symbol): Add support for handling STT_GNU_IFUNC symbols. (elfNN_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC symbols. Ensure we don't increase plt.refcount from -1 to 0. (elfNN_aarch64_post_process_headers): Call _bfd_elf_set_osabi. (elfNN_aarch64_is_function_type): Remove function. (elfNN_aarch64_allocate_dynrelocs): Handle STT_GNU_IFUNC symbols. (elfNN_aarch64_allocate_ifunc_dynrelocs): New function. (elfNN_aarch64_allocate_local_dynrelocs): New function. (elfNN_aarch64_allocate_local_ifunc_dynrelocs): New function. (elfNN_aarch64_size_dynamic_sections): Call elfNN_aarch64_allocate_local_dynrelocs. (elfNN_aarch64_create_small_pltn_entry): Add info argument. Add support for creating .iplt entries for STT_GNU_IFUNC symbols. (elfNN_aarch64_finish_dynamic_symbol): Add support for handling STT_GNU_IFUNC symbols and .iplt. (elfNN_aarch64_finish_local_dynamic_symbol): New function. (elfNN_aarch64_finish_dynamic_sections): Call elfNN_aarch64_finish_local_dynamic_symbol. ld/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * emulparams/aarch64elf.sh: Add IREL_IN_PLT. * emulparams/aarch64elf32.sh: Likewise. ld/testsuite/ChangeLog: 2013-10-03 Will Newton <will.newton@linaro.org> * ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64. * ld-aarch64/aarch64-elf.exp: Run ifunc tests. * ld-aarch64/ifunc-1-local.d: New file. * ld-aarch64/ifunc-1-local.s: Likewise. * ld-aarch64/ifunc-1.d: Likewise. * ld-aarch64/ifunc-1.s: Likewise. * ld-aarch64/ifunc-10.d: Likewise. * ld-aarch64/ifunc-10.s: Likewise. * ld-aarch64/ifunc-11.d: Likewise. * ld-aarch64/ifunc-11.s: Likewise. * ld-aarch64/ifunc-12.d: Likewise. * ld-aarch64/ifunc-12.s: Likewise. * ld-aarch64/ifunc-13.d: Likewise. * ld-aarch64/ifunc-13a.s: Likewise. * ld-aarch64/ifunc-13b.s: Likewise. * ld-aarch64/ifunc-14a.d: Likewise. * ld-aarch64/ifunc-14a.s: Likewise. * ld-aarch64/ifunc-14b.d: Likewise. * ld-aarch64/ifunc-14b.s: Likewise. * ld-aarch64/ifunc-14c.d: Likewise. * ld-aarch64/ifunc-14c.s: Likewise. * ld-aarch64/ifunc-14d.d: Likewise. * ld-aarch64/ifunc-14e.d: Likewise. * ld-aarch64/ifunc-14f.d: Likewise. * ld-aarch64/ifunc-15.d: Likewise. * ld-aarch64/ifunc-15.s: Likewise. * ld-aarch64/ifunc-16.d: Likewise. * ld-aarch64/ifunc-16.s: Likewise. * ld-aarch64/ifunc-17a.d: Likewise. * ld-aarch64/ifunc-17a.s: Likewise. * ld-aarch64/ifunc-17b.d: Likewise. * ld-aarch64/ifunc-17b.s: Likewise. * ld-aarch64/ifunc-18a.d: Likewise. * ld-aarch64/ifunc-18a.s: Likewise. * ld-aarch64/ifunc-18b.d: Likewise. * ld-aarch64/ifunc-18b.s: Likewise. * ld-aarch64/ifunc-19a.d: Likewise. * ld-aarch64/ifunc-19a.s: Likewise. * ld-aarch64/ifunc-19b.d: Likewise. * ld-aarch64/ifunc-19b.s: Likewise. * ld-aarch64/ifunc-2-local.d: Likewise. * ld-aarch64/ifunc-2-local.s: Likewise. * ld-aarch64/ifunc-2.d: Likewise. * ld-aarch64/ifunc-2.s: Likewise. * ld-aarch64/ifunc-20.d: Likewise. * ld-aarch64/ifunc-20.s: Likewise. * ld-aarch64/ifunc-3.s: Likewise. * ld-aarch64/ifunc-3a.d: Likewise. * ld-aarch64/ifunc-3b.d: Likewise. * ld-aarch64/ifunc-4.d: Likewise. * ld-aarch64/ifunc-4.s: Likewise. * ld-aarch64/ifunc-4a.d: Likewise. * ld-aarch64/ifunc-5-local.s: Likewise. * ld-aarch64/ifunc-5.s: Likewise. * ld-aarch64/ifunc-5a-local.d: Likewise. * ld-aarch64/ifunc-5a.d: Likewise. * ld-aarch64/ifunc-5b-local.d: Likewise. * ld-aarch64/ifunc-5b.d: Likewise. * ld-aarch64/ifunc-5r-local.d: Likewise. * ld-aarch64/ifunc-6.s: Likewise. * ld-aarch64/ifunc-6a.d: Likewise. * ld-aarch64/ifunc-6b.d: Likewise. * ld-aarch64/ifunc-7.s: Likewise. * ld-aarch64/ifunc-7a.d: Likewise. * ld-aarch64/ifunc-7b.d: Likewise. * ld-aarch64/ifunc-7c.d: Likewise. * ld-aarch64/ifunc-8.d: Likewise. * ld-aarch64/ifunc-8a.s: Likewise. * ld-aarch64/ifunc-8b.s: Likewise. * ld-aarch64/ifunc-9.d: Likewise. * ld-aarch64/ifunc-9.s: Likewise.
2013-10-03 22:46:09 +08:00
run_dump_test "ifunc-14a"
run_dump_test "ifunc-14b"
run_dump_test "ifunc-14c"
run_dump_test "ifunc-14d"
run_dump_test "ifunc-14e"
run_dump_test "ifunc-14f"
run_dump_test "ifunc-15"
run_dump_test "ifunc-16"
run_dump_test "ifunc-17a"
run_dump_test "ifunc-17b"
run_dump_test_lp64 "ifunc-18a"
run_dump_test_lp64 "ifunc-18b"
run_dump_test_lp64 "ifunc-19a"
run_dump_test_lp64 "ifunc-19b"
run_dump_test_lp64 "ifunc-20"
run_dump_test_lp64 "ifunc-21"
run_dump_test_lp64 "ifunc-22"
run_dump_test "relasz"
run_dump_test_lp64 "relocs-1027-symbolic-func"
run_dump_test_lp64 "dt_textrel"
run_dump_test "plt_mapping_symbol"
run_dump_test_lp64 "rela-abs-relative"
run_dump_test_lp64 "rela-abs-relative-be"
run_dump_test_lp64 "rela-abs-relative-opt"
run_dump_test_lp64 "pie-bind-locally"
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
{"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
{copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
[AArch64] Allow COPY relocation elimination As discussed at the PR, this patch tries to avoid COPY relocation generation and propagate the original relocation into runtime if it was relocating on writable section. The ELIMINATE_COPY_RELOCS has been set to true and it's underlying infrastructure has been improved so that the COPY reloc elimination at least working on absoluate relocations (ABS64) on AArch64. BFD linker copy relocation elimination framwork requires the backend to always allocate dynrelocs for all those relocation types that are possible to introduce copy relocations. This is for adjust_dynamic_symbol hook to be able to get all symbol reference information. Should one symbol is referenced by more than one relocations, if there is any of them needs copy relocation then linker should generate it. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for if there needs copy relocation elimination. (need_copy_relocation_p): New function. Return true for symbol with pc-relative references and if it's against read-only sections. (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p. (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types that are related with accessing external objects. (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change in elfNN_aarch64_check_relocs. ld/ * testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file. * testsuite/ld-aarch64/copy-reloc-2.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects. * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
2017-06-15 23:51:01 +08:00
{"ld-aarch64/exe with copy relocation 2" "-e0 tmpdir/copy-reloc-so.so" "" ""
{copy-reloc-exe-2.s} {{objdump -R copy-reloc-2.d}} "copy-reloc-2"}
{"ld-aarch64/exe with copy relocation elimination" "-e0 tmpdir/copy-reloc-so.so" "" ""
{copy-reloc-exe-eliminate.s} {{objdump -R copy-reloc-eliminate.d}} "copy-reloc-elimination"}
{"ld-aarch64/so with global func" "-shared" "" "" {func-in-so.s}
{} "func-in-so.so"}
{"ld-aarch64/func sym hash opt for exe"
"-e0 --hash-style=gnu tmpdir/func-in-so.so" "" ""
{func-sym-hash-opt.s} {{readelf --dyn-sym func-sym-hash-opt.d}} "hash-opt"}
}
run_ld_link_tests $aarch64elflinktests