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*.
This commit is contained in:
Rainer Orth
2025-09-30 13:06:50 +02:00
parent 647a377cb5
commit d69c70ce89
5 changed files with 17 additions and 2 deletions

View 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 }
};

View 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 ;;

View 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"
}

View File

@@ -0,0 +1,6 @@
#as: --32
#readelf: -h
#...
Machine: Sparc v8\+
#...

View File

@@ -0,0 +1 @@
return %i7+8