Browse Source

distro: Patch libc to avoid accessing /etc/ld.so.cache and friends.

* distro/packages/base.scm (glibc): Apply `glibc-no-ld-so-cache.patch'.
  (glibc-final): Inherit GLIBC's inputs.
* distro/packages/patches/glibc-no-ld-so-cache.patch: New file.
* Makefile.am (dist_patch_DATA): Add it.
version-0.8.3
Ludovic Courtès 10 years ago
parent
commit
25608d640a
  1. 1
      Makefile.am
  2. 6
      distro/packages/base.scm
  3. 53
      distro/packages/patches/glibc-no-ld-so-cache.patch

1
Makefile.am

@ -75,6 +75,7 @@ patchdir = $(pkgdatadir)/patches
dist_patch_DATA = \
distro/packages/patches/binutils-ld-new-dtags.patch \
distro/packages/patches/diffutils-gets-undeclared.patch \
distro/packages/patches/glibc-no-ld-so-cache.patch \
distro/packages/patches/guile-1.8-cpp-4.5.patch \
distro/packages/patches/guile-default-utf8.patch \
distro/packages/patches/guile-relocatable.patch \

6
distro/packages/base.scm

@ -511,6 +511,7 @@ used in the GNU system including the GNU/Linux variant.")
(arguments
`(#:out-of-source? #t
#:patches (list (assoc-ref %build-inputs "patch/ld.so.cache"))
#:configure-flags
(list "--enable-add-ons"
"--sysconfdir=/etc"
@ -550,6 +551,8 @@ used in the GNU system including the GNU/Linux variant.")
;; 4.7.1.
((" -lgcc_s") ""))))
%standard-phases)))
(inputs `(("patch/ld.so.cache"
,(search-patch "glibc-no-ld-so-cache.patch"))))
(synopsis "The GNU C Library")
(description
"Any Unix-like operating system needs a C library: the library which
@ -792,7 +795,8 @@ identifier SYSTEM."
(propagated-inputs `(("linux-headers" ,linux-libre-headers-boot0)))
(inputs `( ;; A native GCC is needed to build `cross-rpcgen'.
("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
,@%boot1-inputs)))))
,@%boot1-inputs
,@(package-inputs glibc)))))) ; patches
(define gcc-boot0-wrapped
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the

53
distro/packages/patches/glibc-no-ld-so-cache.patch

@ -0,0 +1,53 @@
Disable attempts to use the system-wide /etc/ld.so.cache. This is
required on LFS distros to avoid loading the distro's libc.so instead
of ours.
Patch from Nixpkgs. Idea by Eelco Dolstra, initial patch by Jack
Cummings, minor fixups by Shea Levy.
diff -Naur glibc-2.13-orig/elf/ldconfig.c glibc-2.13/elf/ldconfig.c
--- glibc-2.13-orig/elf/ldconfig.c 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/elf/ldconfig.c 2012-04-10 23:28:45.957492340 -0400
@@ -51,7 +51,7 @@
#endif
#ifndef LD_SO_CONF
-# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
+# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
#endif
/* Get libc version number. */
--- glibc-2.16.0/elf/Makefile 2012-06-30 21:12:34.000000000 +0200
+++ glibc-2.16.0/elf/Makefile 2012-11-12 23:52:21.000000000 +0100
@@ -415,12 +415,12 @@ $(objpfx)ldconfig: $(ldconfig-modules:%=
$(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
-SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
-CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
+PREFIX-FLAGS := -D'PREFIX="$(sysconfdir)"'
+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
-D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
-CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
-CFLAGS-cache.c = $(SYSCONF-FLAGS)
-CFLAGS-rtld.c = $(SYSCONF-FLAGS)
+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
+CFLAGS-cache.c = $(PREFIX-FLAGS)
+CFLAGS-rtld.c = $(PREFIX-FLAGS)
CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
-DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
diff -Naur glibc-2.13-orig/sysdeps/generic/dl-cache.h glibc-2.13/sysdeps/generic/dl-cache.h
--- glibc-2.13-orig/sysdeps/generic/dl-cache.h 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/sysdeps/generic/dl-cache.h 2012-04-10 23:28:20.077488815 -0400
@@ -29,7 +29,7 @@
#endif
#ifndef LD_SO_CACHE
-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
+# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
#endif
#ifndef add_system_dir
Loading…
Cancel
Save