This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.1/4.2 PATCH] backport: amd64, ppc64 - find 32bit system libraries
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: doko at ubuntu dot com, lopezibanez at gmail dot com
- Date: Mon, 3 Mar 2008 10:23:04 -0500 (EST)
- Subject: [4.1/4.2 PATCH] backport: amd64, ppc64 - find 32bit system libraries
I'm having a problem bootstrapping gcc 4.1 and 4.2 with multilibs on
x86_64-unknown-linux-gnu. Basically when using -m32, the link stage uses
the wrong lib*.so and crt*.o files and everything fails to compile. The
problem was fixed for 4.3/mainline with this patch:
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01991.html
The nature of the problem is explained in the patch comment, but basically
it's limited to certain particular linux/gnu distributions. I'm running
on one of the affected systems, a Debian installation in the GCC CFARM.
Other developers using the CFARM would encounter the same issue. For
example, possibly: http://gcc.gnu.org/ml/gcc/2008-01/msg00393.html
Note: multilibs are enabled in the default configuration, so this is a
bootstrap failure on the affected boxes. And personally I'd like to be
able to provide 32-bit multilib testsuite results from these branches on
the particular machines I have access to. So I definitely feel it should
go on 4.1 as well.
I'm submitting the PPC bits which were part of the original patch, but I
don't have access to such a system to provide bootstrap results. I
understand therefore if only the x86_64 parts would be approved unless
someone can provide a PPC test. Perhaps Matthias can do it?
Bootstrapped on gcc-4.1 and 4.2 on x86_64-unknown-linux-gnu with multilibs
enabled. No regressions and the -m32 multilib stuff builds.
Okay (in it's entirety, or just i386 directory) for 4.1/4.2?
Thanks,
--Kaveh
2008-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Backport:
2007-09-27 Matthias Klose <doko@ubuntu.com>
* config/i386/t-linux64 (MULTILIB_OSDIRNAMES): Use ../lib32 as the
multilib osdirname if it exists.
* config/rs6000/t-linux64 (MULTILIB_OSDIRNAMES): Likewise.
diff -rup orig/egcc-4.2-SVN20080303/gcc/config/i386/t-linux64 egcc-4.2-SVN20080303/gcc/config/i386/t-linux64
--- orig/egcc-4.2-SVN20080303/gcc/config/i386/t-linux64 2008-02-11 02:02:37.000000000 +0100
+++ egcc-4.2-SVN20080303/gcc/config/i386/t-linux64 2008-03-03 06:30:56.000000000 +0100
@@ -4,9 +4,16 @@
SHLIB_MAPFILES = $(srcdir)/libgcc-std.ver \
$(srcdir)/config/i386/libgcc-x86_64-glibc.ver
+# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
+# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
+# /lib and /usr/lib, while other distributions install libraries into /lib64
+# and /usr/lib64. The LSB does not enforce the use of /lib64 and /usr/lib64,
+# it doesn't tell anything about the 32bit libraries on those systems. Set
+# MULTILIB_OSDIRNAMES according to what is found on the target.
+
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 ../lib
+MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
diff -rup orig/egcc-4.2-SVN20080303/gcc/config/rs6000/t-linux64 egcc-4.2-SVN20080303/gcc/config/rs6000/t-linux64
--- orig/egcc-4.2-SVN20080303/gcc/config/rs6000/t-linux64 2008-01-03 23:38:03.000000000 +0100
+++ egcc-4.2-SVN20080303/gcc/config/rs6000/t-linux64 2008-03-03 06:31:25.000000000 +0100
@@ -7,12 +7,19 @@ LIB2FUNCS_EXTRA := $(sort $(LIB2FUNCS_EX
TARGET_LIBGCC2_CFLAGS += -mno-minimal-toc
+# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
+# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
+# /lib and /usr/lib, while other distributions install libraries into /lib64
+# and /usr/lib64. The LSB does not enforce the use of /lib64 and /usr/lib64,
+# it doesn't tell anything about the 32bit libraries on those systems. Set
+# MULTILIB_OSDIRNAMES according to what is found on the target.
+
MULTILIB_OPTIONS = m64/m32 msoft-float
MULTILIB_DIRNAMES = 64 32 nof
MULTILIB_EXTRA_OPTS = fPIC mstrict-align
MULTILIB_EXCEPTIONS = m64/msoft-float
MULTILIB_EXCLUSIONS = m64/!m32/msoft-float
-MULTILIB_OSDIRNAMES = ../lib64 ../lib nof
+MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT)
softfp_wrap_start := '\#ifndef __powerpc64__'