This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, rs6000]: reject -m64 and -m32 simultaneously

The simultaneous use of -m32 and -m64 options (where the last option
given "wins") is not supported on any bi-arch platform that GCC

The problem is that the compiler will use the last occurrence
of -m32 or -m64 to determine what code to generate.  However,
for the assembler invocation, it only matters whether an instance
of the *non-default* -m32 or -m64 flag is given, or not.

For a bi-arch gcc build that defaults to -m32, we get:

gcc -m32 -m64:  gcc uses -m64, as uses -m64 (OK)
gcc -m64 -m32:  gcc uses -m32, as uses -m32 (no error, but wrong output)

To remedy this for the PowerPC port, I propose to do something similar
to the SPARC backend and emit the following error message.  Okay for

2007-11-27  Sa Liu  <>

        * config/rs6000/sysv4.h (CC1_SPEC): Display an error message if
        -m32 and -m64 are given simultaneously.

Index: config/rs6000/sysv4.h
--- config/rs6000/sysv4.h       (revision 130452)
+++ config/rs6000/sysv4.h       (working copy)
@@ -630,7 +630,8 @@ extern int fixuplabelno;
 %{msdata: -msdata=default} \
 %{mno-sdata: -msdata=none} \
 %{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
-%{profile: -p}"
+%{profile: -p} \
+%{m32:%{m64:%eoptions -m32 and -m64 are not compatible}}"
 /* Don't put -Y P,<path> for cross compilers.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]