]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add --disable-major-minor-libraries configure option fw/no-symlinks
authorFlorian Weimer <fweimer@redhat.com>
Thu, 28 Nov 2019 11:57:25 +0000 (12:57 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 28 Nov 2019 12:40:01 +0000 (13:40 +0100)
This option can be used to increase compatibility with package managers.
The name was choosen to avoid confusion with all the different versions
(glibc release, soname versions, symbol versions).

This patch makes all uses of -$(version).so conditional on the new
$(major-minor-libraries) flag.  The alternative install targets write
the implementation DSOs directly to the locations determined by their
sonames, skipping the creation of an intermediate symbolic link.

install-symbolic-link in Makerules is updated not to require the
$(symbolic-link-list) file because it may not exist in
--disable-major-minor-libraries mode.

I verified that by default, the install tree is the same as before
on x86_64-linux-gnu except for the changes in the manual.

INSTALL
Makefile
Makerules
config.make.in
configure
configure.ac
elf/Makefile
manual/install.texi

diff --git a/INSTALL b/INSTALL
index 392537cc5c2b099e030ea62582f82c45dc7ec28b..6d61f396ac935395555a5d54f79314df298e6fcc 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -181,6 +181,16 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      RELRO and a read-only global offset table (GOT), at the cost of
      slightly increased program load times.
 
+'--disable-major-minor-libraries'
+     Do not install shared objects under file names that contain the
+     major and minor version of the GNU C Library.  By default, such
+     names are used, and the names defined by the ABI are provided as
+     symbolic links only.  This causes problems with certain package
+     managers during library upgrades and (in particular) downgrades, so
+     this option can be used to install these shared objects directly
+     under their ABI-defined names, without an additional indirection
+     via symbolic links.
+
 '--enable-pt_chown'
      The file 'pt_chown' is a helper binary for 'grantpt' (*note
      Pseudo-Terminals: Allocation.) that is installed setuid root to fix
index fae71aa28714748241c3248130f145b0f60b3de8..89b776d88c85ab3c6b4f3f12c21d21a4338d8ccf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,9 @@ ifeq (yes,$(build-shared))
 install: install-symbolic-link
 .PHONY: install-symbolic-link
 install-symbolic-link: subdir_install
-       $(symbolic-link-prog) $(symbolic-link-list)
+       if test -e $(symbolic-link-list) ; then \
+         $(symbolic-link-prog) $(symbolic-link-list); \
+       fi
        rm -f $(symbolic-link-list)
 
 install:
index bf6ffee186768cb8fc778818e16a6baada945540..032e6441b27e9b0e5fc3550fa0477e5babc5985c 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -991,6 +991,14 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
 install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
 install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
 
+# $(install-major-minor-libraries) is used within install-lib-nosubdir
+# to trigger installation of the actual implementation file.
+ifeq (yes,$(major-minor-libraries))
+install-major-minor-libraries = $(inst_slibdir)/$(L:.so=)-$(version).so
+else
+install-major-minor-libraries =
+endif
+
 # For libraries whose soname have version numbers, we install three files:
 #      $(inst_libdir)/libfoo.so        -- for linking, symlink or ld script
 #      $(inst_slibdir)/libfoo.so.NN    -- for loading by SONAME, symlink
@@ -998,7 +1006,7 @@ install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
 install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
                      $(foreach L,$(install-lib.so-versioned),\
                                $(inst_libdir)/$L \
-                               $(inst_slibdir)/$(L:.so=)-$(version).so \
+                               $(install-major-minor-libraries) \
                                $(inst_slibdir)/$L$($L-version))
 
 # Install all the unversioned shared libraries.
@@ -1051,6 +1059,7 @@ endef
 endif
 
 ifdef libc.so-version
+ifeq (yes,$(major-minor-libraries))
 # For a library specified to be version N, install three files:
 # libc.so      ->      libc.so.N       (e.g. libc.so.6)
 # libc.so.6    ->      libc-VERSION.so (e.g. libc-1.10.so)
@@ -1060,6 +1069,11 @@ $(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
        $(make-shlib-link)
 $(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
        $(do-install-program)
+else # !$(major-minor-libraries)
+$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force)
+       $(do-install-program)
+endif # !$(major-minor-libraries)
+
 install: $(inst_slibdir)/libc.so$(libc.so-version)
 
 # This fragment of linker script gives the OUTPUT_FORMAT statement
@@ -1134,6 +1148,7 @@ include $(o-iterator)
 
 generated += $(foreach o,$(versioned),$o$($o-version))
 
+ifeq (yes,$(major-minor-libraries))
 define o-iterator-doit
 $(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
                                 $(+force);
@@ -1148,6 +1163,15 @@ $(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
 endef
 object-suffixes-left := $(versioned)
 include $(o-iterator)
+
+else # !$(major-minor-libraries)
+define o-iterator-doit
+$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force);
+       $$(do-install-program)
+endef
+object-suffixes-left := $(versioned)
+include $(o-iterator)
+endif # !$(major-minor-libraries)
 endif # ifneq (,$(versioned))
 
 define do-install-so
index 2fed3da773020a09cb3e2aca7c49a48943e0f3f1..ad48e54754278c421eec74d3f1b52d69a811c565 100644 (file)
@@ -71,6 +71,7 @@ have-libcap = @have_libcap@
 have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
 fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
+major-minor-libraries = @major_minor_libraries@
 have-hash-style = @libc_cv_hashstyle@
 use-default-link = @use_default_link@
 output-format = @libc_cv_output_format@
index 2f44b66656e74ea571c47293f9af88df271bf7e4..808fa8cd3d83a72b8e78f6f720f4b64524f8553e 100755 (executable)
--- a/configure
+++ b/configure
@@ -682,6 +682,7 @@ experimental_malloc
 enable_werror
 all_warnings
 force_install
+major_minor_libraries
 bindnow
 hardcoded_path_in_tests
 enable_timezone_tools
@@ -776,6 +777,7 @@ enable_hidden_plt
 enable_bind_now
 enable_stack_protector
 enable_static_nss
+enable_major_minor_libraries
 enable_force_install
 enable_maintainer_mode
 enable_kernel
@@ -1441,6 +1443,10 @@ Optional Features:
                           Use -fstack-protector[-all|-strong] to detect glibc
                           buffer overflows
   --enable-static-nss     build static NSS modules [default=no]
+  --enable-major-minor-libraries
+                          install most shared objects under names based on the
+                          glibc version, with symbolic links to them
+                          [default=yes]
   --disable-force-install don't force installation of files from this package,
                           even if they are older than the installed files
   --enable-maintainer-mode
@@ -3463,6 +3469,15 @@ if test x"$static_nss" = xyes || test x"$shared" = xno; then
 
 fi
 
+# Check whether --enable-major-minor-libraries was given.
+if test "${enable_major_minor_libraries+set}" = set; then :
+  enableval=$enable_major_minor_libraries; major_minor_libraries=$enableval
+else
+  major_minor_libraries=yes
+fi
+
+
+
 # Check whether --enable-force-install was given.
 if test "${enable_force_install+set}" = set; then :
   enableval=$enable_force_install; force_install=$enableval
index e69c88c543521923e3af9b25b85af2edbb6dc162..c374eea0653e46a3cbc75e85107fd1412c71f8d6 100644 (file)
@@ -251,6 +251,13 @@ if test x"$static_nss" = xyes || test x"$shared" = xno; then
   AC_DEFINE(DO_STATIC_NSS)
 fi
 
+AC_ARG_ENABLE([major-minor-libraries],
+       AC_HELP_STRING([--enable-major-minor-libraries],
+       [install most shared objects under names based on the glibc version, with symbolic links to them  @<:@default=yes@:>@]),
+       [major_minor_libraries=$enableval],
+       [major_minor_libraries=yes])
+AC_SUBST(major_minor_libraries)
+
 AC_ARG_ENABLE([force-install],
              AC_HELP_STRING([--disable-force-install],
                             [don't force installation of files from this package, even if they are older than the installed files]),
index 305bed2d38ef9f0305570a5dfe85122f99ef9dbf..e3e898b1cc7cf7505d7f6d4f62926911aa8a1fc7 100644 (file)
@@ -553,6 +553,7 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
 CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
 
 ifeq (yes,$(build-shared))
+ifeq (yes,$(major-minor-libraries))
 $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
        $(make-target-directory)
        $(do-install-program)
@@ -562,11 +563,16 @@ $(inst_rtlddir)/$(rtld-installed-name): \
   $(inst_slibdir)/libc-$(version).so
        $(make-target-directory)
        $(make-shlib-link)
+else # !$(major-minor-libraries)
+$(inst_slibdir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
+       $(make-target-directory)
+       $(do-install-program)
+endif # !$(major-minor-libraries)
 
 # Special target called by parent to install just the dynamic linker.
 .PHONY: ldso_install
 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
-endif
+endif # $(build-shared)
 
 
 ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
index b2d569ac5a2925cc5fd26b92967c7b475fd1df76..d98f026f4ab5a7ce7bdc86f7f423d5f6cf1d09c1 100644 (file)
@@ -209,6 +209,15 @@ provides additional security hardening because it enables full RELRO
 and a read-only global offset table (GOT), at the cost of slightly
 increased program load times.
 
+@item --disable-major-minor-libraries
+Do not install shared objects under file names that contain the major
+and minor version of @theglibc.  By default, such names are used, and
+the names defined by the ABI are provided as symbolic links only.  This
+causes problems with certain package managers during library upgrades
+and (in particular) downgrades, so this option can be used to install
+these shared objects directly under their ABI-defined names, without an
+additional indirection via symbolic links.
+
 @pindex pt_chown
 @findex grantpt
 @item --enable-pt_chown