I noticed that a 64-bit-default Solaris/SPARC gcc with -m32 doesn't predefine __sparcv8, unlike the corresponding 32-bit-default compiler.
Since those defines happen in CPP_CPU_SPEC for any explicit -mcpu option of v8, supersparc, v9 and beyond, this must be due to -mcpu being set in the driver of the 32-bit compiler, but not in the 64-bit one. Indeed, I find -mcpu=v9 in COLLECT_GCC_OPTIONS of the 32-bit compiler, but only -m32 for the 64-bit one. AFAICS this happens due to OPTION_DEFAULT_SPECS: it includes {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ for 32-bit-default and for 64-bit-default: {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ Without an explicit --with-cpu configure option, config.gcc sets with_cpu=v9 for both 32 and 64-bit sparc compilers. For the sparcv9 gcc with -m32 however, the passing of -mcpu=v9 is suppressed by the second spec above. In line with the handling of --with-tune/-mtune below, -mcpu should be the same when no explicit -mcpu is given, irrespective of -m32 or -m64. The following patch just removes those guards. Bootstrapped without regressions on sparcv9-sun-solaris2.11 and sparc-sun-solaris2.11. Besides, I've compared the output of gcc -m32/-m64 -g3 -E -x c /dev/null Before the patch, -D__sparcv8 was missing in the sparcv9 gcc's -m32 case, now -m32 and -m64 output is identical between sparc and sparcv9 compilers. Eric, could you have another look if I'm missing something? Otherwise, I'm going to commit the patch (it's necessary to enable SANITIZER_CAN_FAST_UNWIND on Solaris/SPARC and make use of libsanitizer/sanitizer_common/sanitizer_stacktrace_sparc.cc). Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2019-02-11 Rainer Orth <r...@cebitec.uni-bielefeld.de> * config/sparc/sol2.h (OPTION_DEFAULT_SPECS) [DEFAULT_ARCH32_P]: Remove !m64 guard from cpu entry. [!DEFAULT_ARCH32_P]: Remove !m32 guard from cpu entry.
# HG changeset patch # Parent c72a287bd21743e4d6759e58a6adc3ad5e30d52c Define __sparcv8 in 64-bit-default Solaris/SPARC gcc with -m32 diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h --- a/gcc/config/sparc/sol2.h +++ b/gcc/config/sparc/sol2.h @@ -273,7 +273,7 @@ extern const char *host_detect_local_cpu #define OPTION_DEFAULT_SPECS \ {"cpu_32", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ {"cpu_64", "%{m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ - {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ + {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \ {"tune_32", "%{!m64:%{!mtune=*:-mtune=%(VALUE)}}" }, \ {"tune_64", "%{m64:%{!mtune=*:-mtune=%(VALUE)}}" }, \ {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ @@ -282,7 +282,7 @@ extern const char *host_detect_local_cpu #define OPTION_DEFAULT_SPECS \ {"cpu_32", "%{m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ {"cpu_64", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ - {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ + {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \ {"tune_32", "%{m32:%{!mtune=*:-mtune=%(VALUE)}}" }, \ {"tune_64", "%{!m32:%{!mtune=*:-mtune=%(VALUE)}}" }, \ {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \