[4/4] Install shared objects under their ABI names
Checks
Commit Message
Previously, the installed objects were named like libc-2.33.so,
and the ABI soname libc.so.6 was just a symbolic link.
The Makefile targets to install these symbolic links are no longer
needed after this, so they are removed with this commit. The more
general $(make-link) command (which invokes scripts/rellns-sh) is
retained because other symbolic links are still needed.
---
INSTALL | 10 ++++++++++
Makefile | 6 ------
Makerules | 45 +++++----------------------------------------
NEWS | 8 ++++++++
elf/Makefile | 10 ++--------
5 files changed, 25 insertions(+), 54 deletions(-)
Comments
On 6/10/21 4:23 AM, Florian Weimer via Libc-alpha wrote:
> Previously, the installed objects were named like libc-2.33.so,
> and the ABI soname libc.so.6 was just a symbolic link.
This patch contains INSTALL changes which should not be here and I expect
were left over from your previous patch. Please drop them. Because you
are *only* dropping the edits to that file you can commit as-is without
a v2. So I'm providing a review here.
> The Makefile targets to install these symbolic links are no longer
> needed after this, so they are removed with this commit. The more
> general $(make-link) command (which invokes scripts/rellns-sh) is
> retained because other symbolic links are still needed.
No regressions on x86_64 and i686. Installed files look good.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@rehdat.com>
> ---
> INSTALL | 10 ++++++++++
Drop this.
> Makefile | 6 ------
> Makerules | 45 +++++----------------------------------------
> NEWS | 8 ++++++++
> elf/Makefile | 10 ++--------
> 5 files changed, 25 insertions(+), 54 deletions(-)
>
> diff --git a/INSTALL b/INSTALL
> index bc761ab98b..ed5f66489b 100644
> --- a/INSTALL
> +++ b/INSTALL
Drop this change from this file.
> @@ -199,6 +199,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
> diff --git a/Makefile b/Makefile
> index 242d36de91..c115c652a0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -109,12 +109,6 @@ elf/ldso_install:
> # Ignore the error if we cannot update /etc/ld.so.cache.
> ifeq (no,$(cross-compiling))
> ifeq (yes,$(build-shared))
> -install: install-symbolic-link
> -.PHONY: install-symbolic-link
> -install-symbolic-link: subdir_install
> - $(symbolic-link-prog) $(symbolic-link-list)
> - rm -f $(symbolic-link-list)
> -
OK.
> install:
> -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
> $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
> diff --git a/Makerules b/Makerules
> index d3f29d0b89..6efff78fbe 100644
> --- a/Makerules
> +++ b/Makerules
> @@ -989,14 +989,12 @@ 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))
>
> -# For libraries whose soname have version numbers, we install three files:
> +# For libraries whose soname have version numbers, we install two files:
OK.
> # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
> -# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
> -# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
> +# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME
OK.
> install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
> $(foreach L,$(install-lib.so-versioned),\
> $(inst_libdir)/$L \
> - $(inst_slibdir)/$(L:.so=)-$(version).so \
OK.
> $(inst_slibdir)/$L$($L-version))
>
> # Install all the unversioned shared libraries.
> @@ -1029,35 +1027,10 @@ ln -f $(objpfx)/$(@F) $@
> endef
> endif
>
> -ifeq (yes,$(build-shared))
> -ifeq (no,$(cross-compiling))
> -symbolic-link-prog := $(elf-objpfx)sln
> -symbolic-link-list := $(elf-objpfx)symlink.list
> -define make-shlib-link
> -echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
> -endef
> -else # cross-compiling
> -# We need a definition that can be used by elf/Makefile's install rules.
> -symbolic-link-prog = $(LN_S)
> -endif
> -endif
> -ifndef make-shlib-link
> -define make-shlib-link
> -rm -f $@
> -$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
> -endef
> -endif
OK.
> -
> ifdef libc.so-version
> -# 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)
> -
> -$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
> - $(+force)
> - $(make-shlib-link)
> -$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
OK.
> +$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force)
> $(do-install-program)
> +
> install: $(inst_slibdir)/libc.so$(libc.so-version)
>
> # This fragment of linker script gives the OUTPUT_FORMAT statement
> @@ -1125,15 +1098,7 @@ include $(o-iterator)
> generated += $(foreach o,$(versioned),$o$($o-version))
>
> define o-iterator-doit
> -$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
> - $(+force);
> - $$(make-shlib-link)
> -endef
> -object-suffixes-left := $(versioned)
> -include $(o-iterator)
> -
> -define o-iterator-doit
> -$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
> +$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force);
> $$(do-install-program)
OK.
> endef
> object-suffixes-left := $(versioned)
> diff --git a/NEWS b/NEWS
> index 1bf3daa502..1634e20ce5 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -48,6 +48,14 @@ Deprecated and removed features, and other changes affecting compatibility:
> * The function pthread_yield has been deprecated; programs should use
> the equivalent standard function sched_yield instead.
>
> +* Previously, glibc installed its various shared objects under versioned
> + file names such as libc-2.33.so. The ABI sonames (e.g., libc.so.6)
> + were provided as symbolic links. Starting with glibc 2.34, the shared
> + objects are installed under their ABI sonames directly, without
> + symbolic links. This increases compatibility with distribution
> + package managers that delete removed files late during the package
> + upgrade or downgrade process.
OK. I agree, the new glibc is present immediately at unpack time with a scheme
that keeps the new glibc always as libc.so.6. It is simpler and easier to
reason about when it comes to package management.
> +
> Changes to build and runtime requirements:
>
> * On Linux, the shm_open, sem_open, and related functions now expect the
> diff --git a/elf/Makefile b/elf/Makefile
> index 1751f5ec67..02f634c192 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -628,20 +628,14 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
> CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
>
> ifeq (yes,$(build-shared))
> -$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
> +$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
OK.
> $(make-target-directory)
> $(do-install-program)
>
> -$(inst_rtlddir)/$(rtld-installed-name): \
> - $(inst_slibdir)/$(rtld-version-installed-name) \
> - $(inst_slibdir)/libc-$(version).so
> - $(make-target-directory)
> - $(make-shlib-link)
> -
OK.
> # 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)
>
>
> # Workarounds for ${exec_prefix} expansion in configure variables.
>
@@ -199,6 +199,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
@@ -109,12 +109,6 @@ elf/ldso_install:
# Ignore the error if we cannot update /etc/ld.so.cache.
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
-install: install-symbolic-link
-.PHONY: install-symbolic-link
-install-symbolic-link: subdir_install
- $(symbolic-link-prog) $(symbolic-link-list)
- rm -f $(symbolic-link-list)
-
install:
-test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
$(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
@@ -989,14 +989,12 @@ 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))
-# For libraries whose soname have version numbers, we install three files:
+# For libraries whose soname have version numbers, we install two files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
-# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
-# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
+# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME
install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
$(foreach L,$(install-lib.so-versioned),\
$(inst_libdir)/$L \
- $(inst_slibdir)/$(L:.so=)-$(version).so \
$(inst_slibdir)/$L$($L-version))
# Install all the unversioned shared libraries.
@@ -1029,35 +1027,10 @@ ln -f $(objpfx)/$(@F) $@
endef
endif
-ifeq (yes,$(build-shared))
-ifeq (no,$(cross-compiling))
-symbolic-link-prog := $(elf-objpfx)sln
-symbolic-link-list := $(elf-objpfx)symlink.list
-define make-shlib-link
-echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
-endef
-else # cross-compiling
-# We need a definition that can be used by elf/Makefile's install rules.
-symbolic-link-prog = $(LN_S)
-endif
-endif
-ifndef make-shlib-link
-define make-shlib-link
-rm -f $@
-$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
-endef
-endif
-
ifdef libc.so-version
-# 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)
-
-$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
- $(+force)
- $(make-shlib-link)
-$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
+$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force)
$(do-install-program)
+
install: $(inst_slibdir)/libc.so$(libc.so-version)
# This fragment of linker script gives the OUTPUT_FORMAT statement
@@ -1125,15 +1098,7 @@ include $(o-iterator)
generated += $(foreach o,$(versioned),$o$($o-version))
define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
- $(+force);
- $$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
+$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force);
$$(do-install-program)
endef
object-suffixes-left := $(versioned)
@@ -48,6 +48,14 @@ Deprecated and removed features, and other changes affecting compatibility:
* The function pthread_yield has been deprecated; programs should use
the equivalent standard function sched_yield instead.
+* Previously, glibc installed its various shared objects under versioned
+ file names such as libc-2.33.so. The ABI sonames (e.g., libc.so.6)
+ were provided as symbolic links. Starting with glibc 2.34, the shared
+ objects are installed under their ABI sonames directly, without
+ symbolic links. This increases compatibility with distribution
+ package managers that delete removed files late during the package
+ upgrade or downgrade process.
+
Changes to build and runtime requirements:
* On Linux, the shm_open, sem_open, and related functions now expect the
@@ -628,20 +628,14 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
ifeq (yes,$(build-shared))
-$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
+$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
$(make-target-directory)
$(do-install-program)
-$(inst_rtlddir)/$(rtld-installed-name): \
- $(inst_slibdir)/$(rtld-version-installed-name) \
- $(inst_slibdir)/libc-$(version).so
- $(make-target-directory)
- $(make-shlib-link)
-
# 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)
# Workarounds for ${exec_prefix} expansion in configure variables.