[binutils-gdb] gas: Default to V8+ on 32-bit Solaris/SPARC

Rainer Orth ro@sourceware.org
Tue Sep 30 11:07:25 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d69c70ce8990fa66020e3d7d568a1dce9caff43b

commit d69c70ce8990fa66020e3d7d568a1dce9caff43b
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Tue Sep 30 13:06:50 2025 +0200

    gas: Default to V8+ on 32-bit Solaris/SPARC
    
    While compilers default to v8plus on 32-bit Solaris/SPARC (gcc at least
    since 4.4 in 2009, cc since at least Stdio 9 in 2010), gas still uses a
    sparclite default.  While this doesn't cause issue for gcc (it passes
    -Av8plus as necessary), it repeatedly lead to problems in the testsuite
    which has to be sprinkled with setting ASFLAGS accordingly since gas cannot
    assemble the gcc output by default.
    
    This patch switches the default to v8plus on Solaris to match gcc.
    I had to introduce a new arch value, v8plus-32, matching v9-64, to allow
    for this.
    
    I cannot reliably tell if other SPARC targets are similarly affected, so
    this patch restricts the change to Solaris.
    
    Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11.
    
    2025-09-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
    
            gas:
            * config/tc-sparc.c (sparc_arch_table): Introduce v8plus-32.
            * configure.tgt (generic_target) <sparc-*-solaris*>: Set arch to
            v8plus-32 for 32-bit sparc.
            * testsuite/gas/sparc/v8plus.rd, testsuite/gas/sparc/v8plus.s: New
            test.
            * testsuite/gas/sparc/sparc.exp: Run it on sparc*-*-solaris2*.

Diff:
---
 gas/config/tc-sparc.c             | 3 ++-
 gas/configure.tgt                 | 5 ++++-
 gas/testsuite/gas/sparc/sparc.exp | 4 ++++
 gas/testsuite/gas/sparc/v8plus.d  | 6 ++++++
 gas/testsuite/gas/sparc/v8plus.s  | 1 +
 5 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 0dd92057438..65043af78d5 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -275,8 +275,9 @@ static struct sparc_arch {
   { "v9m",     "v9m", v9,  0, 1, 0, 0 },
   { "v9m8",     "m8", v9,  0, 1, 0, 0 },
 
-  /* This exists to allow configure.tgt to pass one
+  /* These exist to allow configure.tgt to pass one
      value to specify both the default machine and default word size.  */
+  { "v8plus-32", "v9", v9, 32, 0, 0, 0 },
   { "v9-64",   "v9",  v9, 64, 0, 0, 0 },
   { NULL, NULL, v8, 0, 0, 0, 0 }
 };
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 9300086e95d..03e43fd3eda 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -400,7 +400,10 @@ case ${generic_target} in
 
   sparc-*-haiku*)			fmt=elf em=haiku ;;
   sparc-*-linux-*)			fmt=elf em=linux ;;
-  sparc-*-solaris*)			fmt=elf em=solaris ;;
+  sparc-*-solaris*)			fmt=elf em=solaris
+    case ${cpu} in
+      sparc)	arch=v8plus-32 ;;
+    esac ;;
   sparc-*-freebsd*)			fmt=elf em=freebsd ;;
   sparc-*-*bsd*)			fmt=elf em=nbsd ;;
 
diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp
index 15c0611b108..d66fdc6d7e4 100644
--- a/gas/testsuite/gas/sparc/sparc.exp
+++ b/gas/testsuite/gas/sparc/sparc.exp
@@ -159,6 +159,10 @@ if [istarget sparc*-*-*] {
     run_dump_test "pr20732"
 }
 
+if [istarget sparc*-*-solaris2*] {
+    run_dump_test "v8plus"
+}
+
 if [istarget sparc-*-vxworks*] {
     run_dump_test "vxworks-pic"
 }
diff --git a/gas/testsuite/gas/sparc/v8plus.d b/gas/testsuite/gas/sparc/v8plus.d
new file mode 100644
index 00000000000..9b77bd7559d
--- /dev/null
+++ b/gas/testsuite/gas/sparc/v8plus.d
@@ -0,0 +1,6 @@
+#as: --32
+#readelf: -h
+
+#...
+  Machine:                           Sparc v8\+
+#...
diff --git a/gas/testsuite/gas/sparc/v8plus.s b/gas/testsuite/gas/sparc/v8plus.s
new file mode 100644
index 00000000000..645931a80e7
--- /dev/null
+++ b/gas/testsuite/gas/sparc/v8plus.s
@@ -0,0 +1 @@
+	return	%i7+8


More information about the Binutils-cvs mailing list