Reject -mx32 on Solaris/x86

Message ID ydd5zq5pdi3.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
  • Reject -mx32 on Solaris/x86
Related show

Commit Message

Rainer Orth May 20, 2019, 11:32 a.m.
Inspired by one of Iain's patches for PR target/82920, this patch
rejects -mx32 on Solaris/x86, too: x32 won't be implemented on Solaris
and the failure if one tries to use it isn't very helpful otherwise:

$ gcc -mx32 -o hello hello.c
In file included from /vol/gcc-9/lib/gcc/i386-pc-solaris2.11/9.1.0/include-fixed/sys/feature_tests.h:32,
                 from /vol/gcc-9/lib/gcc/i386-pc-solaris2.11/9.1.0/include-fixed/stdio.h:24,
                 from hello.c:1:
/usr/include/sys/isa_defs.h:461:2: error: #error "Both _ILP32 and _LP64 are defined"
  461 | #error "Both _ILP32 and _LP64 are defined"
      |  ^~~~~

Bootstrapped without regressions on i386-pc-solaris2.11, installed on


Rainer Orth, Center for Biotechnology, Bielefeld University

2019-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* config/i386/sol2.h (CC1_SPEC): Reject -mx32.


# HG changeset patch
# Parent  d206c777312bc2a8211d734e485031f191dce352
Reject -mx32 on Solaris/x86

diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -55,7 +55,8 @@  along with GCC; see the file COPYING3.  
 #define CPP_SPEC "%(cpp_subtarget)"
 #undef CC1_SPEC
-#define CC1_SPEC "%(cc1_cpu) " ASAN_CC1_SPEC
+#define CC1_SPEC "%(cc1_cpu) " ASAN_CC1_SPEC \
+  " %{mx32:%e-mx32 is not supported on Solaris}"
 /* GNU as understands --32 and --64, but the native Solaris
    assembler requires -xarch=generic or -xarch=generic64 instead.  */