On Sat, 2013-11-30 at 23:47 +1300, Simon Geard wrote:
> On Fri, 2013-11-29 at 19:49 -0500, Baho Utot wrote:
> > The following packages are the only ones I have found ( in Chapter 5 ) 
> > that either puts something into or requires /lib64
> > 
> > binutils-pass-1
> > gcc-pass-1
> > libstdc++
> > binutils-pass-2
> > gcc-pass-2
> 
> By /lib64, you mean /tool/lib64, given we're talking Chapter 5? I think
> it's impossible to avoid having some stuff written to that directory in
> Chapter 5, because to start with, you're relying on the versions of
> gcc/glibc provided by the host.
> 
> The trick is to modify those two packages when you build them in
> chapters 5 and 6, to ensure they use the directory names you prefer.
> Everything else should follow from them, barring a few exceptional cases
> from BLFS...

I've just dug out the patches I used last time I did this... they're not
current versions, but should at least give you an idea. According to my
notes, the GCC one was applied to all three builds, but the GLIBC one
was used only in Chapter 6.

Simon.
Force gcc to look for the 64-bit runner in /lib instead of /lib64.
(also look for the 32-bit runner in /lib32 instead of /lib)

diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 5b0a212..e4d02cc 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -28,6 +28,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
 #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index b5d3985..03d8f32 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -34,6 +34,6 @@
 comma=,
 MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
 MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-MULTILIB_OSDIRNAMES = m64=../lib64
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
 MULTILIB_OSDIRNAMES+= mx32=../libx32
Several changes to force glibc to put 64-bit libraries in /lib instead
of /lib64, and 32-bit libraries in /lib32 instead of /lib.

The sed expression is kind of ugly, but basically it's looking for
something like:
  /lib64/ld-linux-x86-64.so.2

and extracting the important bits to turn it into:
  "/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"

The change makes it instead produce:
  "/lib32/ld-linux.so.2 /lib/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"

diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
index 6f5b828..e8b2b6b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
@@ -18,9 +18,9 @@
 #include <sysdeps/generic/ldconfig.h>
 
 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
+  { "/lib32/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
   { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
+  { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
 #define SYSDEP_KNOWN_LIBRARY_NAMES \
   { "libc.so.6", FLAG_ELF_LIBC6 },	\
   { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
index 44d76e8..58d977c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
@@ -1,3 +1,3 @@
 /LD_TRACE_LOADED_OBJECTS=1/a\
 add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
-s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ 	]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_
+s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ 	]*$_\1"\232\4\6 \2\4-x86-64\6 \2x32\4-x32\6"_
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to