From: Rainer Orth Date: Wed, 23 Jul 2025 07:18:58 +0000 (+0200) Subject: Default to -mcpu=ultrasparc3 on Solaris/SPARC X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6293da9e990f12202d3d84b2cd776436abe10860;p=thirdparty%2Fgcc.git Default to -mcpu=ultrasparc3 on Solaris/SPARC Prompted by the discussions around a recent clang bug, I realized that gcc still defaults to -mcpu=v9 on Solaris/SPARC. This is an oversight since the Oracle Studio 12.6 cc, released in 2017, already defaults to -xarch=sparcvis2, the equivalent of -mcpu=ultrasparc3. Besides, both the 32 and 64-bit libc.so.1 require UltraSPARC III extensions anyway: SPARC32PLUS Version 1, V8+ Required, UltraSPARC3 Extensions Required [VIS] SPARCV9 Version 1, UltraSPARC3 Extensions Required [VIS] So this patch follows suite. Bootstrapped on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11 with as/ld, gas/ld, and gas/gld configurations. There are currently two regressions exposed by this patch (PRs 121191 and 121192), which are only present in gcc 16 resp. 15/16. There's one small caveat: while Solaris now marks all objects with EF_SPARC_32PLUS EF_SPARC_SUN_US1 EF_SPARC_SUN_US3, gas only sets the EF_SPARC_SUN_US[13] flags in the ELF header if UltraSPARC I/III insns are actually used. This is in accordance with the SPARC Compliance Definition 2.4.1, 4P-1. In the end, it doesn't matter anyway since libc.so.1 already has both flags, so the resulting executables and shared objects will too, anyway. 2025-07-20 Rainer Orth gcc: * config.gcc (with_cpu): Default to ultrasparc3. --- diff --git a/gcc/config.gcc b/gcc/config.gcc index 8ed111392bb..0d8dbc4fb19 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -3504,10 +3504,9 @@ sparc*-*-solaris2*) sparc64-*-* | sparcv9-*-*) tm_file="sparc/default64.h ${tm_file}" ;; - *) - test x$with_cpu != x || with_cpu=v9 - ;; esac + # Match Studio 12.6 cc. + with_cpu=${with_cpu:-ultrasparc3} tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2" ;; sparc-wrs-vxworks)