[11/28] elf: Print the full name of the dynamic loader in the ld.so help message

Message ID 8b705ed302523cef89fcd2024519b96823b9043c.1601569371.git.fweimer@redhat.com
State Committed
Headers
Series glibc-hwcaps support |

Commit Message

Florian Weimer Oct. 1, 2020, 4:32 p.m. UTC
  This requires defining a macro for the full path, matching the
-Wl,--dynamic-link= arguments used for linking glibc programs,
and ldd script.
---
 elf/Makefile   | 3 ++-
 elf/dl-usage.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Oct. 8, 2020, 12:38 p.m. UTC | #1
On 01/10/2020 13:32, Florian Weimer via Libc-alpha wrote:
> This requires defining a macro for the full path, matching the
> -Wl,--dynamic-link= arguments used for linking glibc programs,
> and ldd script.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  elf/Makefile   | 3 ++-
>  elf/dl-usage.c | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/elf/Makefile b/elf/Makefile
> index 71602d04c1..7b97e773a5 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -661,7 +661,8 @@ libof-ldconfig = ldconfig
>  CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
>  CFLAGS-cache.c += $(SYSCONF-FLAGS)
>  CFLAGS-rtld.c += $(SYSCONF-FLAGS)
> -CFLAGS-dl-usage.c += $(SYSCONF-FLAGS)
> +CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
> +  -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
>  
>  cpp-srcs-left := $(all-rtld-routines:=.os)
>  lib := rtld

Ok.

> diff --git a/elf/dl-usage.c b/elf/dl-usage.c
> index 35a1c0c455..0a62e8f7cf 100644
> --- a/elf/dl-usage.c
> +++ b/elf/dl-usage.c
> @@ -76,6 +76,8 @@ setting environment variables (which would be inherted by subprocesses).\n\
>    --argv0 STRING        set argv[0] to STRING before running\n\
>    --help                display this help and exit\n\
>    --version             output version information and exit\n\
> +\n\
> +This program interpreter self-identifies as: " RTLD "\n\
>  ",
>                argv0);
>    _exit (0);
> 

Ok.
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index 71602d04c1..7b97e773a5 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -661,7 +661,8 @@  libof-ldconfig = ldconfig
 CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
 CFLAGS-cache.c += $(SYSCONF-FLAGS)
 CFLAGS-rtld.c += $(SYSCONF-FLAGS)
-CFLAGS-dl-usage.c += $(SYSCONF-FLAGS)
+CFLAGS-dl-usage.c += $(SYSCONF-FLAGS) \
+  -D'RTLD="$(rtlddir)/$(rtld-installed-name)"'
 
 cpp-srcs-left := $(all-rtld-routines:=.os)
 lib := rtld
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
index 35a1c0c455..0a62e8f7cf 100644
--- a/elf/dl-usage.c
+++ b/elf/dl-usage.c
@@ -76,6 +76,8 @@  setting environment variables (which would be inherted by subprocesses).\n\
   --argv0 STRING        set argv[0] to STRING before running\n\
   --help                display this help and exit\n\
   --version             output version information and exit\n\
+\n\
+This program interpreter self-identifies as: " RTLD "\n\
 ",
               argv0);
   _exit (0);