aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-aarch64/protections/aarch64-protections.exp
blob: cf0f03daee67742f194dc33602bf4fba5f6daa16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Expect script for AARCH64 ELF tests related to GNU properties.
# Copyright (C) 2009-2025 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_file $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" ""
   "-I$srcdir/$subdir -defsym __property_bti__=1"
   {bti-plt-so.s} {} "libbti-plt-so.so"}

  {"Build gcs-so for GCS tests"
   "-shared" ""
   "-I$srcdir/$subdir -defsym __property_gcs__=1"
   {gcs-so.s} {} "libgcs-so.so"}

  {"Build nogcs-so for GCS tests"
   "-shared" ""
   "-I$srcdir/$subdir"
   {gcs-so.s} {} "libnogcs-so.so"}

  {"Build gcs-so2 for GCS tests"
   "-shared" ""
   "-I$srcdir/$subdir -defsym __property_gcs__=1"
   {gcs-so2.s} {} "libgcs-so2.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] \
    [list [list as "-I\$srcdir/\$subdir"]]
}