- moved all the BTI and PAC tests into a new subfolder: "protections".
bti-far-*
bti-plt-*
bti-pac-plt-*
- move several procedures used only for AArch64 linker tests to a new exp
library file aarch64-elf-lib.exp in ld/testsuite/ld-aarch64/lib.
- use aarch64-elf-lib.exp in aarch64-ld.exp and aarch64-protections.exp.
return
}
+load_lib $srcdir/$subdir/lib/aarch64-elf-lib.exp
+
# List contains test-items with 3 items followed by 2 lists:
# 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
}
if [check_shared_lib_support] { append aarch64elftests $tmp }
-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 *nto*] then {
- return "aarch64nto"
- }
- 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"] \
run_dump_test_lp64 "pie-bind-locally"
-run_dump_test "property-bti-pac1"
-run_dump_test "property-bti-pac2"
-run_dump_test "property-bti-pac3"
-run_dump_test "property-bti-pac4-a"
-run_dump_test "property-bti-pac4-b"
-run_dump_test "bti-plt-1"
-run_dump_test "bti-plt-2"
-
run_dump_test_lp64 "variant_pcs-r"
run_dump_test_lp64 "variant_pcs-shared"
run_dump_test_lp64 "variant_pcs-now"
{"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"}
- {"Build bti-plt-so for PLT tests" "-shared" "" "" {bti-plt-so.s}
- {} "libbti-plt-so.so"}
}
set aarch64elfcclinktests [list \
run_cc_link_tests $aarch64elfcclinktests
}
-run_dump_test "bti-plt-3"
-run_dump_test "bti-plt-4"
-run_dump_test "bti-plt-5"
-run_dump_test "bti-plt-6"
-run_dump_test "bti-plt-7"
-
-run_dump_test "pac-plt-1"
-run_dump_test "pac-plt-2"
-run_dump_test "bti-pac-plt-1"
-run_dump_test "bti-pac-plt-2"
-
-run_dump_test "bti-warn"
run_dump_test "weak-tls"
run_dump_test "undef-tls"
-run_dump_test_lp64 "bti-far-1"
-run_dump_test_lp64 "bti-far-2"
-run_dump_test_lp64 "bti-far-opt"
-run_dump_test_lp64 "bti-far-3"
-
if { [supports_dt_relr] } {
run_dump_test_lp64 "relr-align"
run_dump_test_lp64 "relr-data-pie"
--- /dev/null
+# Expect library used by AArch64 ELF test scripts.
+# Copyright (C) 2009-2024 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
+}
+
+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 *nto*] then {
+ return "aarch64nto"
+ }
+ 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]]]]
+}
\ No newline at end of file
--- /dev/null
+# Expect script for AARCH64 ELF tests related to GNU properties.
+# Copyright (C) 2009-2024 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
+}
+
+load_lib $srcdir/$subdir/../lib/aarch64-elf-lib.exp
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+set test_lp64_list [lsort [glob -nocomplain $srcdir/$subdir/bti-far-*.d]]
+
+# Remove lp64 tests from test_list to avoid executing them twice.
+foreach test_lp64 $test_lp64_list {
+ set idx [lsearch $test_list $test_lp64]
+ set test_list [lreplace $test_list $idx $idx]
+ unset idx
+}
+
+# See definition of run_ld_link_tests in testsuite/lib/ld-lib.exp for more
+# details.
+set aarch64elflinktests {
+ {"Build bti-plt-so for PLT tests"
+ "-shared" ""
+ ""
+ {bti-plt-so.s} {} "libbti-plt-so.so"}
+}
+
+if [check_shared_lib_support] {
+ run_ld_link_tests $aarch64elflinktests
+}
+
+foreach t $test_lp64_list {
+ # We need to strip the ".d", but can leave the dirname.
+ run_dump_test_lp64 [file rootname $t]
+}
+
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ run_dump_test [file rootname $t]
+}
\ No newline at end of file
#name: Warn when neither inputs has GNU NOTE BTI
#source: property-bti-pac2.s
-#source: plt_mapping_symbol.s
+#source: ../plt_mapping_symbol.s
#target: [check_shared_lib_support]
#as: -mabi=lp64
#ld: -shared -z force-bti
-#source: tls-desc-ie.s
+#source: ../tls-desc-ie.s
#target: [check_shared_lib_support]
#ld: -shared -z pac-plt -T bti-plt.ld
#objdump: -dr -j .plt