[v3] elf: Install a symbolic link to ld.so as /usr/bin/ld.so

Message ID 8735n0dc4a.fsf@oldenburg.str.redhat.com
State Committed
Commit 2e75604f8337fa4332977f72a8f6726309679edf
Headers
Series [v3] elf: Install a symbolic link to ld.so as /usr/bin/ld.so |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Florian Weimer Dec. 10, 2021, 9:48 a.m. UTC
  This makes ld.so features such as --preload, --audit,
and --list-diagnostics more accessible to end users because they
do not need to know the ABI name of the dynamic loader.

---
v2: Use $(make-link).
v3: Update NEWS entry.

 NEWS         | 3 +++
 elf/Makefile | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
  

Comments

Carlos O'Donell Dec. 10, 2021, 2:19 p.m. UTC | #1
On 12/10/21 04:48, Florian Weimer via Libc-alpha wrote:
> This makes ld.so features such as --preload, --audit,
> and --list-diagnostics more accessible to end users because they
> do not need to know the ABI name of the dynamic loader.

I've seen Andreas Schwab comment on this and provided feedback. You have addressed
that feedback and so overall this looks good.

I see rough consensus on the Debian thread for this change here:
https://mailman-int.corp.redhat.com/archives/tools-patches/2021-December/msg00013.html

At a high level this makes things objectively better. You always have the ability
to call ld.so and get a loader that you can call regardless of the architecture
and regardless of the version of the installer runtime. This allows downstreams to
write generic support code that can use features like --list-diagnostics which provide
valuable feedback to support teams.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
 
> ---
> v2: Use $(make-link).
> v3: Update NEWS entry.
> 
>  NEWS         | 3 +++
>  elf/Makefile | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/NEWS b/NEWS
> index 8744a92532..3a04befe8e 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -79,6 +79,9 @@ Major new features:
>    variables.  The GNU C Library manual has details on integration of
>    Restartable Sequences.
>  
> +* A symbolic link to the dynamic linker is now installed under
> +  /usr/bin/ld.so (or more precisely, '${bindir}/ld.so').

OK.

> +
>  Deprecated and removed features, and other changes affecting compatibility:
>  
>  * The r_version update in the debugger interface makes the glibc binary
> diff --git a/elf/Makefile b/elf/Makefile
> index ef36008673..d0bb0daa7e 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -110,7 +110,7 @@ endif
>  ifeq (yes,$(build-shared))
>  extra-objs	= $(all-rtld-routines:%=%.os) sofini.os interp.os
>  generated	+= librtld.os dl-allobjs.os ld.so ldd
> -install-others	= $(inst_rtlddir)/$(rtld-installed-name)
> +install-others	= $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so

OK.

>  install-bin-script = ldd
>  endif
>  
> @@ -692,6 +692,11 @@ $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
>  	$(make-target-directory)
>  	$(do-install-program)
>  
> +# Creates the relative /usr/bin/ld.so symbolic link.
> +$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
> +	$(make-target-directory)
> +	$(make-link)
> +

OK.

>  # Special target called by parent to install just the dynamic linker.
>  .PHONY: ldso_install
>  ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
>
  

Patch

diff --git a/NEWS b/NEWS
index 8744a92532..3a04befe8e 100644
--- a/NEWS
+++ b/NEWS
@@ -79,6 +79,9 @@  Major new features:
   variables.  The GNU C Library manual has details on integration of
   Restartable Sequences.
 
+* A symbolic link to the dynamic linker is now installed under
+  /usr/bin/ld.so (or more precisely, '${bindir}/ld.so').
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The r_version update in the debugger interface makes the glibc binary
diff --git a/elf/Makefile b/elf/Makefile
index ef36008673..d0bb0daa7e 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -110,7 +110,7 @@  endif
 ifeq (yes,$(build-shared))
 extra-objs	= $(all-rtld-routines:%=%.os) sofini.os interp.os
 generated	+= librtld.os dl-allobjs.os ld.so ldd
-install-others	= $(inst_rtlddir)/$(rtld-installed-name)
+install-others	= $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
 install-bin-script = ldd
 endif
 
@@ -692,6 +692,11 @@  $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
 	$(make-target-directory)
 	$(do-install-program)
 
+# Creates the relative /usr/bin/ld.so symbolic link.
+$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
+	$(make-target-directory)
+	$(make-link)
+
 # Special target called by parent to install just the dynamic linker.
 .PHONY: ldso_install
 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)