[PATCH v5 5/5] elf: Allow RPATH/RUNPATH for static-pie
Florian Weimer
fweimer@redhat.com
Fri Jan 30 17:03:17 GMT 2026
* Adhemerval Zanella:
> The initial static-pie support (commit 9d7a3741c9e59eba87fb) reused
> ld.so ELF parsing logic, even though RPATH/RUNPATH should not appear
> in the static-pie bootstrap. With static PIE, RPATH/RUNPATH on the
> loader typically indicates a toolchain misconfiguration. However,
> for static PIE, the presence of RPATH/RUNPATH has no impact because
> these binaries do not use dynamic linking at runtime.
>
> Static binaries do not support rpath because they lack dynamic
> sections, and adding static-pie support affects only the dlopen
> function. If static dlopen support is removed, this change has no effect.
>
> This change also simplifies elf_get_dynamic_info and removes a
> difference between dynamic and static binaries.
>
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.
> ---
> elf/Makefile | 11 ++++++++
> elf/dl-load.c | 2 +-
> elf/dl-reloc-static-pie.c | 2 +-
> elf/get-dynamic-info.h | 5 ++--
> elf/rtld.c | 4 +--
> elf/setup-vdso.h | 2 +-
> elf/tst-pie-rpath-mod.c | 19 ++++++++++++++
> elf/tst-pie-rpath-static.c | 52 ++++++++++++++++++++++++++++++++++++++
> 8 files changed, 89 insertions(+), 8 deletions(-)
> create mode 100644 elf/tst-pie-rpath-mod.c
> create mode 100644 elf/tst-pie-rpath-static.c
Looks okay to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list