public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-config:master commit in: gcc-backup/, /
@ 2019-09-07 21:30 Sergei Trofimovich
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Trofimovich @ 2019-09-07 21:30 UTC (permalink / raw
  To: gentoo-commits

commit:     44570a44be60a8fc33bd05089047c1f2980b3047
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 20:17:52 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 21:29:12 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=44570a44

gcc-config: store gcc backup into /lib/gcc-backup, not /lib

Writing (and removing) libraries to /lib outside package manager
was a surprise to users in bug #667020# where libunwind.so was
clobbered by gcc-config runs.

This change isolates all logic that handles file copies
outside package manager into /lib/gcc-backup directory.

To make new library still resolveable we install env.d entry
with contents of
    LDPATH="/lib/gcc-backup"

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile          | 22 +++++++++++++++++++---
 envd-gcc-backup   |  3 +++
 gcc-backup/README | 41 +++++++++++++++++++++++++++++++++++++++++
 gcc-config        | 17 ++++++++++++++++-
 4 files changed, 79 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 2b3b235..087000b 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ EPREFIX ?=
 PN = gcc-config
 PV = git
 P = $(PN)-$(PV)
+BACKUPDIR = gcc-backup
 
 PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
@@ -11,15 +12,18 @@ ESELECTDIR = $(PREFIX)/share/eselect/modules
 
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
+LIBGCC_BACKUPDIR = $(EPREFIX)/$(SUBLIBDIR)/$(BACKUPDIR)
+
+ENVD = $(EPREFIX)/etc/env.d
 
 MKDIR_P = mkdir -p -m 755
 INSTALL_EXE = install -m 755
 INSTALL_DATA = install -m 644
 
-all: .gcc-config
+all: .gcc-config .envd-gcc-backup
 
 clean:
-	rm -f .gcc-config
+	rm -f .gcc-config .envd-gcc-backup
 
 .gcc-config: gcc-config
 	sed \
@@ -27,14 +31,26 @@ clean:
 		-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \
+		-e 's:@GENTOO_GCC_BACKUP_DIR@:$(BACKUPDIR):g' \
 		$< > $@
 	chmod a+rx $@
 
+.envd-gcc-backup: envd-gcc-backup
+	sed \
+		-e 's:@LIBGCC_BACKUPDIR@:$(LIBGCC_BACKUPDIR):g' \
+		$< > $@
+
 install: all
-	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(DOCDIR)
+	$(MKDIR_P) $(DESTDIR)$(BINDIR)
 	$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
+	$(MKDIR_P) $(DESTDIR)$(ESELECTDIR)
 	$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
+	$(MKDIR_P) $(DESTDIR)$(DOCDIR)
 	$(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)
+	$(MKDIR_P) $(DESTDIR)$(LIBGCC_BACKUPDIR)
+	$(INSTALL_DATA) gcc-backup/README $(DESTDIR)$(LIBGCC_BACKUPDIR)
+	$(MKDIR_P) $(DESTDIR)$(ENVD)
+	$(INSTALL_DATA) .envd-gcc-backup $(DESTDIR)$(ENVD)/99gcc-backup
 
 test check: .gcc-config
 	cd tests && ./run_tests

diff --git a/envd-gcc-backup b/envd-gcc-backup
new file mode 100644
index 0000000..4367b62
--- /dev/null
+++ b/envd-gcc-backup
@@ -0,0 +1,3 @@
+# A fallback for libgcc_s.so.* and dependencies.
+# See @LIBGCC_BACKUPDIR@/README for details
+LDPATH="@LIBGCC_BACKUPDIR@"

diff --git a/gcc-backup/README b/gcc-backup/README
new file mode 100644
index 0000000..fdac223
--- /dev/null
+++ b/gcc-backup/README
@@ -0,0 +1,41 @@
+What is gcc-backup
+==================
+
+gcc-backup is a directory to backup critical runtime
+libraries used by gcc to link in code too big to inline it
+from code generator.
+
+See gcc/doc/libgcc.texi doc in gcc source tree.
+
+gcc-config is responsible to back up libgcc_s.so.* and it's
+runtime dependencies.
+
+Which systems needed this backup
+================================
+
+During normal system operation these libraries should not be
+needed (unless gcc installation is somehow completely broken).
+
+The main use case for libgcc-backup is booting of a system
+with the following properties:
+- '/usr' mount is separate from '/' mount
+- AND binaries in /bin (say, /bin/bash) are executed before
+  /usr is mounted
+
+Which systems link libgcc_s.so in
+=================================
+
+By default gcc attempts to link libgcc_s.so in into every
+binary and shared library. If code generator happens to
+generate the code that does not refer libgcc_s.so then
+-Wl,--as-needed linker option omits the dependency.
+
+Thus any system might have libgcc_s.so linked into any binary
+or shared library.
+
+What goes into this directory
+=============================
+
+- libgcc_s.so.* itself: gcc driver attempts to link it in as-is
+- libunwind.so.*: ia64-*-linux only, a runtime dependency of
+                  libgcc_so.so.*

diff --git a/gcc-config b/gcc-config
index 01e2b90..65b30bc 100755
--- a/gcc-config
+++ b/gcc-config
@@ -42,6 +42,9 @@ PV="@PV@"
 GENTOO_LIBDIR="@GENTOO_LIBDIR@"
 [[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
 
+GENTOO_GCC_BACKUP_DIR="@GENTOO_GCC_BACKUP_DIR@"
+[[ ${GENTOO_GCC_BACKUP_DIR} == @*@ ]] && GENTOO_GCC_BACKUP_DIR="gcc-backup"
+
 usage() {
 	cat <<-EOF
 	Usage: gcc-config [options] [CC Profile]
@@ -316,11 +319,23 @@ handle_split_usr() {
 	if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; then
 		local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
 		shopt -s nullglob
+
+		# We relied on these copies until Sept 2019.
+		# Can be removed in 2021.
 		for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
 			rm -f "${lib}"
 			old_libs=1
 		done
+
+		for lib in \
+			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libgcc_s.so.* \
+			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libunwind.so.* ; do
+			# If we previously had stuff in /, make sure ldconfig gets re-run.
+			rm -f "${lib}"
+			old_libs=1
+		done
+
 		${saved_nullglob}
 		return ${old_libs}
 	fi
@@ -328,7 +343,7 @@ handle_split_usr() {
 	# Only bother with this stuff for the native ABI.  We assume the user
 	# doesn't have critical binaries for non-native ABIs which is fair.
 	local gcclib
-	local libdir="${EROOT}${GENTOO_LIBDIR}"
+	local libdir="${EROOT}/${GENTOO_LIBDIR}/${GENTOO_GCC_BACKUP_DIR}"
 	mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
 	for gcclib in gcc_s unwind ; do
 		# This assumes that we always have the .so symlink,


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: gcc-backup/, /
@ 2019-09-07 22:47 Sergei Trofimovich
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Trofimovich @ 2019-09-07 22:47 UTC (permalink / raw
  To: gentoo-commits

commit:     04d7a13d933a0fb7266df332ddaa2a2d1141d7be
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 22:44:34 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 22:44:34 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=04d7a13d

Revert "gcc-config: store gcc backup into /lib/gcc-backup, not /lib"

This reverts commit 44570a44be60a8fc33bd05089047c1f2980b3047.

Unfortunately ld.so does has static set of fallback paths
when it fails to lookup shared library from ld.so.cache:
those are /lib64 and /usr/lib64 on amd64.

Let's revert the change and jkeep relying on /lib64 for now.

Bug: https://bugs.gentoo.org/667020
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile          | 22 +++-------------------
 envd-gcc-backup   |  3 ---
 gcc-backup/README | 41 -----------------------------------------
 gcc-config        | 18 +-----------------
 4 files changed, 4 insertions(+), 80 deletions(-)

diff --git a/Makefile b/Makefile
index 087000b..2b3b235 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,6 @@ EPREFIX ?=
 PN = gcc-config
 PV = git
 P = $(PN)-$(PV)
-BACKUPDIR = gcc-backup
 
 PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
@@ -12,18 +11,15 @@ ESELECTDIR = $(PREFIX)/share/eselect/modules
 
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
-LIBGCC_BACKUPDIR = $(EPREFIX)/$(SUBLIBDIR)/$(BACKUPDIR)
-
-ENVD = $(EPREFIX)/etc/env.d
 
 MKDIR_P = mkdir -p -m 755
 INSTALL_EXE = install -m 755
 INSTALL_DATA = install -m 644
 
-all: .gcc-config .envd-gcc-backup
+all: .gcc-config
 
 clean:
-	rm -f .gcc-config .envd-gcc-backup
+	rm -f .gcc-config
 
 .gcc-config: gcc-config
 	sed \
@@ -31,26 +27,14 @@ clean:
 		-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \
-		-e 's:@GENTOO_GCC_BACKUP_DIR@:$(BACKUPDIR):g' \
 		$< > $@
 	chmod a+rx $@
 
-.envd-gcc-backup: envd-gcc-backup
-	sed \
-		-e 's:@LIBGCC_BACKUPDIR@:$(LIBGCC_BACKUPDIR):g' \
-		$< > $@
-
 install: all
-	$(MKDIR_P) $(DESTDIR)$(BINDIR)
+	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(DOCDIR)
 	$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
-	$(MKDIR_P) $(DESTDIR)$(ESELECTDIR)
 	$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
-	$(MKDIR_P) $(DESTDIR)$(DOCDIR)
 	$(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)
-	$(MKDIR_P) $(DESTDIR)$(LIBGCC_BACKUPDIR)
-	$(INSTALL_DATA) gcc-backup/README $(DESTDIR)$(LIBGCC_BACKUPDIR)
-	$(MKDIR_P) $(DESTDIR)$(ENVD)
-	$(INSTALL_DATA) .envd-gcc-backup $(DESTDIR)$(ENVD)/99gcc-backup
 
 test check: .gcc-config
 	cd tests && ./run_tests

diff --git a/envd-gcc-backup b/envd-gcc-backup
deleted file mode 100644
index 4367b62..0000000
--- a/envd-gcc-backup
+++ /dev/null
@@ -1,3 +0,0 @@
-# A fallback for libgcc_s.so.* and dependencies.
-# See @LIBGCC_BACKUPDIR@/README for details
-LDPATH="@LIBGCC_BACKUPDIR@"

diff --git a/gcc-backup/README b/gcc-backup/README
deleted file mode 100644
index fdac223..0000000
--- a/gcc-backup/README
+++ /dev/null
@@ -1,41 +0,0 @@
-What is gcc-backup
-==================
-
-gcc-backup is a directory to backup critical runtime
-libraries used by gcc to link in code too big to inline it
-from code generator.
-
-See gcc/doc/libgcc.texi doc in gcc source tree.
-
-gcc-config is responsible to back up libgcc_s.so.* and it's
-runtime dependencies.
-
-Which systems needed this backup
-================================
-
-During normal system operation these libraries should not be
-needed (unless gcc installation is somehow completely broken).
-
-The main use case for libgcc-backup is booting of a system
-with the following properties:
-- '/usr' mount is separate from '/' mount
-- AND binaries in /bin (say, /bin/bash) are executed before
-  /usr is mounted
-
-Which systems link libgcc_s.so in
-=================================
-
-By default gcc attempts to link libgcc_s.so in into every
-binary and shared library. If code generator happens to
-generate the code that does not refer libgcc_s.so then
--Wl,--as-needed linker option omits the dependency.
-
-Thus any system might have libgcc_s.so linked into any binary
-or shared library.
-
-What goes into this directory
-=============================
-
-- libgcc_s.so.* itself: gcc driver attempts to link it in as-is
-- libunwind.so.*: ia64-*-linux only, a runtime dependency of
-                  libgcc_so.so.*

diff --git a/gcc-config b/gcc-config
index b1cda70..b8f695f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -42,9 +42,6 @@ PV="@PV@"
 GENTOO_LIBDIR="@GENTOO_LIBDIR@"
 [[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
 
-GENTOO_GCC_BACKUP_DIR="@GENTOO_GCC_BACKUP_DIR@"
-[[ ${GENTOO_GCC_BACKUP_DIR} == @*@ ]] && GENTOO_GCC_BACKUP_DIR="gcc-backup"
-
 usage() {
 	cat <<-EOF
 	Usage: gcc-config [options] [CC Profile]
@@ -319,25 +316,12 @@ handle_split_usr() {
 	if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; then
 		local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
 		shopt -s nullglob
-
-		# We relied on these copies until Sept 2019.
-		# Can be removed in 2021.
 		for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
 			einfo "Removing '${lib}'"
 			rm -f "${lib}"
 			old_libs=1
 		done
-
-		for lib in \
-			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libgcc_s.so.* \
-			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libunwind.so.* ; do
-			# If we previously had stuff in /, make sure ldconfig gets re-run.
-			einfo "Removing '${lib}'"
-			rm -f "${lib}"
-			old_libs=1
-		done
-
 		${saved_nullglob}
 		return ${old_libs}
 	fi
@@ -345,7 +329,7 @@ handle_split_usr() {
 	# Only bother with this stuff for the native ABI.  We assume the user
 	# doesn't have critical binaries for non-native ABIs which is fair.
 	local gcclib
-	local libdir="${EROOT}/${GENTOO_LIBDIR}/${GENTOO_GCC_BACKUP_DIR}"
+	local libdir="${EROOT}${GENTOO_LIBDIR}"
 	mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
 	for gcclib in gcc_s unwind ; do
 		# This assumes that we always have the .so symlink,


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-07 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-07 22:47 [gentoo-commits] proj/gcc-config:master commit in: gcc-backup/, / Sergei Trofimovich
  -- strict thread matches above, loose matches on Subject: below --
2019-09-07 21:30 Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox