2be09a
commit 2e75604f8337fa4332977f72a8f6726309679edf
2be09a
Author: Florian Weimer <fweimer@redhat.com>
2be09a
Date:   Fri Dec 10 16:06:36 2021 +0100
2be09a
2be09a
    elf: Install a symbolic link to ld.so as /usr/bin/ld.so
2be09a
    
2be09a
    This makes ld.so features such as --preload, --audit,
2be09a
    and --list-diagnostics more accessible to end users because they
2be09a
    do not need to know the ABI name of the dynamic loader.
2be09a
    
2be09a
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2be09a
2be09a
diff --git a/elf/Makefile b/elf/Makefile
2be09a
index 7696aa1324919a80..3e7debdd81baafe0 100644
2be09a
--- a/elf/Makefile
2be09a
+++ b/elf/Makefile
2be09a
@@ -104,7 +104,7 @@ endif
2be09a
 ifeq (yes,$(build-shared))
2be09a
 extra-objs	= $(all-rtld-routines:%=%.os) sofini.os interp.os
2be09a
 generated	+= librtld.os dl-allobjs.os ld.so ldd
2be09a
-install-others	= $(inst_rtlddir)/$(rtld-installed-name)
2be09a
+install-others	= $(inst_rtlddir)/$(rtld-installed-name) $(inst_bindir)/ld.so
2be09a
 install-bin-script = ldd
2be09a
 endif
2be09a
 
2be09a
@@ -645,6 +645,11 @@ $(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
2be09a
 	$(make-target-directory)
2be09a
 	$(do-install-program)
2be09a
 
2be09a
+# Creates the relative /usr/bin/ld.so symbolic link.
2be09a
+$(inst_bindir)/ld.so: $(inst_rtlddir)/$(rtld-installed-name)
2be09a
+	$(make-target-directory)
2be09a
+	$(make-link)
2be09a
+
2be09a
 # Special target called by parent to install just the dynamic linker.
2be09a
 .PHONY: ldso_install
2be09a
 ldso_install: $(inst_rtlddir)/$(rtld-installed-name)