446cf2
commit db03874df9843ab98c4faeb658f04d17e6db83a6
446cf2
Author: Florian Weimer <fweimer@redhat.com>
446cf2
Date:   Thu Oct 8 15:33:00 2020 +0200
446cf2
446cf2
    elf: Print the full name of the dynamic loader in the ld.so help message
446cf2
    
446cf2
    This requires defining a macro for the full path, matching the
446cf2
    -Wl,--dynamic-link= arguments used for linking glibc programs,
446cf2
    and ldd script.
446cf2
    
446cf2
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
446cf2
446cf2
diff --git a/elf/Makefile b/elf/Makefile
446cf2
index e5666e5bf7817c3c..bc96b8fd65e376cc 100644
446cf2
--- a/elf/Makefile
446cf2
+++ b/elf/Makefile
446cf2
@@ -641,7 +641,8 @@ libof-ldconfig = ldconfig
446cf2
 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
446cf2
 CFLAGS-cache.c += $(SYSCONF-FLAGS)
446cf2
 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
446cf2
-CFLAGS-dl-usage.c += $(SYSCONF-FLAGS)
446cf2
+CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
446cf2
+  -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
446cf2
 
446cf2
 cpp-srcs-left := $(all-rtld-routines:=.os)
446cf2
 lib := rtld
446cf2
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
446cf2
index 8c24c13770500df9..1003a435bfc2b39e 100644
446cf2
--- a/elf/dl-usage.c
446cf2
+++ b/elf/dl-usage.c
446cf2
@@ -76,6 +76,8 @@ setting environment variables (which would be inherited by subprocesses).\n\
446cf2
   --argv0 STRING        set argv[0] to STRING before running\n\
446cf2
   --help                display this help and exit\n\
446cf2
   --version             output version information and exit\n\
446cf2
+\n\
446cf2
+This program interpreter self-identifies as: " RTLD "\n\
446cf2
 ",
446cf2
               argv0);
446cf2
   _exit (EXIT_SUCCESS);