public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc-4 (4.1.1) patch to use 32bit as default on x86_64-linux
@ 2006-11-30 10:28 Michael Haubenwallner
  0 siblings, 0 replies; only message in thread
From: Michael Haubenwallner @ 2006-11-30 10:28 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]

Hi,

we have been using self-built gcc-3.4.5 on x86_64-linux (redhat) for
some time now, which used 32bit as the default output (64bit with -m64).

Now we need to switch to gcc-4.1.1 for some reasons, but our application
is not 64bit aware yet. Additionally, I cannot ensure easily that the
application's (nonstandard) build-mechanism passes -m32 to each
gcc-call.

Thus, I thought to patch that gcc/config/i386/* to switch back to
gcc-3.4-behaviour, where 32bit is default, and 64bit only with -m64.

But: What needs to be changed here to switch this behaviour ?
I tried attached patch, but that is insufficient: cannot build gcc
itself now.

As a last resort I'll wrap the gcc/g++ binaries to always pass -m32 if
not passed -m64...

Thanks in advance,
  haubi
-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html

[-- Attachment #2: gcc411-32bit.patch --]
[-- Type: text/x-patch, Size: 2324 bytes --]

diff -ru gcc-4.1.1.orig/gcc/config/i386/linux64.h gcc-4.1.1/gcc/config/i386/linux64.h
--- gcc-4.1.1.orig/gcc/config/i386/linux64.h	2006-11-30 09:45:18.000000000 +0100
+++ gcc-4.1.1/gcc/config/i386/linux64.h	2006-11-30 09:47:39.000000000 +0100
@@ -55,13 +55,13 @@
    done.  */
 
 #undef	LINK_SPEC
-#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
+#define LINK_SPEC "%{m64:-m elf_x86_64} %{!m64:-m elf_i386} \
   %{shared:-shared} \
   %{!shared: \
     %{!static: \
       %{rdynamic:-export-dynamic} \
-      %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
-      %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
+      %{!m64:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+      %{m64:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
     %{static:-static}}"
 
 /* Similar to standard Linux, but adding -ffast-math support.  */
@@ -70,7 +70,7 @@
   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
-#define MULTILIB_DEFAULTS { "m64" }
+#define MULTILIB_DEFAULTS { "m32" }
 
 #undef NEED_INDICATE_EXEC_STACK
 #define NEED_INDICATE_EXEC_STACK 1
diff -ru gcc-4.1.1.orig/gcc/config/i386/t-linux64 gcc-4.1.1/gcc/config/i386/t-linux64
--- gcc-4.1.1.orig/gcc/config/i386/t-linux64	2006-11-30 09:45:18.000000000 +0100
+++ gcc-4.1.1/gcc/config/i386/t-linux64	2006-11-30 09:59:53.000000000 +0100
@@ -4,9 +4,9 @@
 SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
 		 $(srcdir)/config/i386/libgcc-x86_64-glibc.ver
 
-MULTILIB_OPTIONS = m64/m32
-MULTILIB_DIRNAMES = 64 32 
-MULTILIB_OSDIRNAMES = ../lib64 ../lib
+MULTILIB_OPTIONS = m32/m64
+MULTILIB_DIRNAMES = 32 64 
+MULTILIB_OSDIRNAMES = ../lib ../lib64
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
diff -ru gcc-4.1.1.orig/gcc/config/i386/x86-64.h gcc-4.1.1/gcc/config/i386/x86-64.h
--- gcc-4.1.1.orig/gcc/config/i386/x86-64.h	2006-11-30 09:45:17.000000000 +0100
+++ gcc-4.1.1/gcc/config/i386/x86-64.h	2006-11-30 09:49:19.000000000 +0100
@@ -49,7 +49,7 @@
 
 #undef ASM_SPEC
 #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
- %{Wa,*:%*} %{m32:--32} %{m64:--64}"
+ %{Wa,*:%*} %{!m64:--32} %{m64:--64}"
 
 #undef ASM_OUTPUT_ALIGNED_BSS
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-11-30 10:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30 10:28 gcc-4 (4.1.1) patch to use 32bit as default on x86_64-linux Michael Haubenwallner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).