| 1 |
# Copyright (C) 1997-2025 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with GCC; see the file COPYING3. If not see |
| 15 |
# <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
# GCC testsuite for ARMv8-M Security Extensions using the `dg.exp' driver. |
| 18 |
|
| 19 |
# Load support procs. |
| 20 |
load_lib gcc-dg.exp |
| 21 |
|
| 22 |
# Exit immediately if the target does not support -mcmse. |
| 23 |
if ![check_effective_target_arm_cmse_ok] then { |
| 24 |
return |
| 25 |
} |
| 26 |
|
| 27 |
# If a testcase doesn't have special options, use these. |
| 28 |
global DEFAULT_CFLAGS |
| 29 |
if ![info exists DEFAULT_CFLAGS] then { |
| 30 |
set DEFAULT_CFLAGS " -ansi -pedantic-errors" |
| 31 |
} |
| 32 |
|
| 33 |
# Initialize `dg'. |
| 34 |
dg-init |
| 35 |
torture-init |
| 36 |
|
| 37 |
set saved-dg-do-what-default ${dg-do-what-default} |
| 38 |
|
| 39 |
if {[is-effective-target arm_cmse_hw]} then { |
| 40 |
set dg-do-what-default run |
| 41 |
} else { |
| 42 |
set dg-do-what-default assemble |
| 43 |
} |
| 44 |
|
| 45 |
set saved-lto_torture_options ${LTO_TORTURE_OPTIONS} |
| 46 |
set LTO_TORTURE_OPTIONS "" |
| 47 |
|
| 48 |
# Return the start address of the .gnu.sgstubs section. |
| 49 |
proc cmse_sgstubs {} { |
| 50 |
# Allow to override the location of .gnu.sgstubs section. |
| 51 |
set tboard [target_info name] |
| 52 |
if {[board_info $tboard exists cmse_sgstubs]} { |
| 53 |
return [board_info $tboard cmse_sgstubs] |
| 54 |
} |
| 55 |
|
| 56 |
return "0x00400000" |
| 57 |
} |
| 58 |
|
| 59 |
# These are for both baseline and mainline. |
| 60 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] \ |
| 61 |
"" $DEFAULT_CFLAGS |
| 62 |
|
| 63 |
if {[check_effective_target_arm_arch_v8m_base_ok]} then { |
| 64 |
# Baseline only |
| 65 |
set BASELINE_FLAGS [add_options_for_arm_arch_v8m_base ""] |
| 66 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/baseline/*.c]] \ |
| 67 |
"$BASELINE_FLAGS" $DEFAULT_CFLAGS |
| 68 |
} |
| 69 |
|
| 70 |
if {[check_effective_target_arm_arch_v8m_main_ok]} then { |
| 71 |
set MAINLINE_8M_FLAGS [add_options_for_arm_arch_v8m_main ""] |
| 72 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/*.c]] \ |
| 73 |
"$MAINLINE_8M_FLAGS" $DEFAULT_CFLAGS |
| 74 |
# Mainline -mfloat-abi=soft |
| 75 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/soft/*.c]] \ |
| 76 |
"$MAINLINE_8M_FLAGS -mfloat-abi=soft" $DEFAULT_CFLAGS |
| 77 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/softfp/*.c]] \ |
| 78 |
"$MAINLINE_8M_FLAGS" $DEFAULT_CFLAGS |
| 79 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/softfp-sp/*.c]] \ |
| 80 |
"$MAINLINE_8M_FLAGS" $DEFAULT_CFLAGS |
| 81 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/hard/*.c]] \ |
| 82 |
"$MAINLINE_8M_FLAGS" $DEFAULT_CFLAGS |
| 83 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8m/hard-sp/*.c]] \ |
| 84 |
"$MAINLINE_8M_FLAGS" $DEFAULT_CFLAGS |
| 85 |
} |
| 86 |
|
| 87 |
if {[check_effective_target_arm_arch_v8_1m_main_ok]} then { |
| 88 |
set MAINLINE_8_1M_FLAGS [add_options_for_arm_arch_v8_1m_main ""] |
| 89 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/*.c]] \ |
| 90 |
"$MAINLINE_8_1M_FLAGS" $DEFAULT_CFLAGS |
| 91 |
# Mainline -mfloat-abi=soft |
| 92 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/soft/*.c]] \ |
| 93 |
"$MAINLINE_8_1M_FLAGS -mfloat-abi=soft" $DEFAULT_CFLAGS |
| 94 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/softfp/*.c]] \ |
| 95 |
"$MAINLINE_8_1M_FLAGS" $DEFAULT_CFLAGS |
| 96 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/softfp-sp/*.c]] \ |
| 97 |
"$MAINLINE_8_1M_FLAGS" $DEFAULT_CFLAGS |
| 98 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/hard/*.c]] \ |
| 99 |
"$MAINLINE_8_1M_FLAGS" $DEFAULT_CFLAGS |
| 100 |
gcc-dg-runtest [lsort [glob $srcdir/$subdir/mainline/8_1m/hard-sp/*.c]] \ |
| 101 |
"$MAINLINE_8_1M_FLAGS" $DEFAULT_CFLAGS |
| 102 |
} |
| 103 |
|
| 104 |
set LTO_TORTURE_OPTIONS ${saved-lto_torture_options} |
| 105 |
set dg-do-what-default ${saved-dg-do-what-default} |
| 106 |
|
| 107 |
# All done. |
| 108 |
torture-finish |
| 109 |
dg-finish |