]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: Default to V8+ on 32-bit Solaris/SPARC
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 30 Sep 2025 11:06:50 +0000 (13:06 +0200)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 30 Sep 2025 11:06:50 +0000 (13:06 +0200)
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*.

gas/config/tc-sparc.c
gas/configure.tgt
gas/testsuite/gas/sparc/sparc.exp
gas/testsuite/gas/sparc/v8plus.d [new file with mode: 0644]
gas/testsuite/gas/sparc/v8plus.s [new file with mode: 0644]

index 0dd920574386b278fabf577efb677725a509c963..65043af78d5db65148e6731217afe07dd310b69d 100644 (file)
@@ -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 }
 };
index 9300086e95dc2ac820c2dd11f9d3f788982f83a5..03e43fd3eda2e39c9cd81b40ae44c9a39f714a60 100644 (file)
@@ -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 ;;
 
index 15c0611b108b8c314be000670615f239f0b00fbe..d66fdc6d7e4a2b50b67b304abbdb8c3be326bd7d 100644 (file)
@@ -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 (file)
index 0000000..9b77bd7
--- /dev/null
@@ -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 (file)
index 0000000..645931a
--- /dev/null
@@ -0,0 +1 @@
+       return  %i7+8