aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@orcam.me.uk>2025-02-15 01:30:58 +0000
committerMaciej W. Rozycki <macro@orcam.me.uk>2025-02-15 01:30:58 +0000
commit1c065666dd404668f3e6524a1cc59e240baae98e (patch)
tree4c43f25d5d40bf7eef59b84a5c34f069be560e25 /gas
parent0813652eef5c9333db203a2ddc843840b9e7373e (diff)
downloadbinutils-1c065666dd404668f3e6524a1cc59e240baae98e.zip
binutils-1c065666dd404668f3e6524a1cc59e240baae98e.tar.gz
binutils-1c065666dd404668f3e6524a1cc59e240baae98e.tar.bz2
MIPS/GAS/testsuite: Support negated targets for default architecture
Add support for giving negated targets in the list of targets passed to `mips_arch_create' for the purpose of setting the default architecture. This is so that a subset of targets can be excluded from matching within a broader set of targets.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/gas/mips/mips.exp18
1 files changed, 13 insertions, 5 deletions
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 4e7a587..fbd0166 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -124,11 +124,15 @@ proc mips_arch_init {} {
# the entry specified by EXTENDS. (The new architecture is considered
# to extend the capabilities provided by that architecture.)
#
-# If DEFAULT_FOR_TARGETS is specified, it is a list of targets for which
-# this architecture is the default architecture. If "istarget" returns
-# true for any of the targets in the list, a "default" entry will be
-# added to the architecture array which indicates that ARCH is the default
-# architecture.
+# If DEFAULT_FOR_TARGETS is specified, it is a list of targets to match
+# against for the purpose of setting the default architecture. Entries
+# are examined in turn with any preceding "!" stripped until either all
+# have been processed or "istarget" returns true for a match. In the
+# case of a match a "default" entry will be added to the architecture
+# array which indicates that ARCH is the default architecture unless
+# the match was for a target preceded by "!". This lets an early match
+# against a more specific entry preceded by "!" prevent from matching a
+# more general entry placed later in the list.
proc mips_arch_create {arch gprsize extends props as_flags objdump_flags
{default_for_targets {}}} {
global mips_arches
@@ -154,6 +158,10 @@ proc mips_arch_create {arch gprsize extends props as_flags objdump_flags
# Set as default if appropriate.
foreach target $default_for_targets {
+ if { [string match {!*} $target]
+ && [istarget [string range $target 1 end]] } {
+ break
+ }
if { [istarget $target] } {
if { [info exists mips_arches(default)] } {
error "mips_arch_create: default arch already exists"