[PATCH v7 0/5] elf: Allow RPATH/RUNPATH for static-pie (BZ 33326)
Adhemerval Zanella
adhemerval.zanella@linaro.org
Mon Mar 2 19:07:33 GMT 2026
Although static binaries do not support rpath (since they lack dynamic
sections), adding static-pie support only affects the dlopen function.
It is one less unexpected behavior (where dynamic and static binaries
support and behave differently), and if/when static dlopen support is
removed, this will become a no-op.
The testcase from BZ 33236 triggered a deep issue with an assert in
startup code, which required changes to multiple ABIs to properly fix
(even though the assert itself was removed in the last patch). There
are still other assert usage, although most, if not all, are for
ill-formatted ELF files.
Changes from v7:
* Fix armv7-a issue.
Changes from v6:
* Improve comments.
* Remove unused files.
Changes from v5:
* Move _dl_writev and _dl_mmap to their own TU for i386 to avoid
I386_USE_SYSENTER redefinition.
* Fixed generic __raise_direct and add a TODO for Hurd.
Changes from 4:
* Rename __raise_nocancel to __raise_direct and remove default
implementation.
* Simplify _dl_writev.
Changes from v3:
* Added Wilco's suggestion on fallback implementation for ctz/clz.
* Rebased against master.
* Fixed another riscv issues.
Changes from v2:
* Fixed a build for x86_64-linux-gnu-v3.
* Adjust the elf/tst-pie-rpath-static to run correctly when
--enable-hardcoded-path-in-tests is not used
Changes from v1:
* Change the ctz/clz fallback to simpler algorithms and use a different
header/macro with a better explanation of its intend.
* Rename __pthread_kill_self to __raise_nostatus.
* Fixed assert also for powerpc-power4 and riscv.
Adhemerval Zanella (5):
string: Add fallback implementation for ctz/clz
nptl: Add __raise_direct
Use _dl_writev on __libc_message_impl
Fix assert during static startup
elf: Allow RPATH/RUNPATH for static-pie
Adhemerval Zanella (5):
string: Add fallback implementation for ctz/clz
nptl: Add __raise_direct
Use _dl_writev on __libc_message_impl
Fix assert during static startup
elf: Allow RPATH/RUNPATH for static-pie
assert/Makefile | 5 ++
elf/Makefile | 27 ++++++++++
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-assert-startup-static.c | 40 ++++++++++++++
elf/tst-pie-rpath-mod.c | 19 +++++++
elf/tst-pie-rpath-static.c | 52 ++++++++++++++++++
include/signal.h | 3 ++
libio/Makefile | 5 ++
nptl/pthread_kill.c | 21 +++-----
signal/raise.c | 6 +++
stdlib/Makefile | 5 ++
string/Makefile | 1 +
.../aarch64/multiarch/dl-symbol-redir-ifunc.h | 1 +
sysdeps/aarch64/multiarch/memcpy_generic.S | 4 ++
.../armv7/multiarch/dl-symbol-redir-ifunc.h | 27 ++++++++++
sysdeps/generic/dl-mmap.h | 34 ++++++++++++
{elf => sysdeps/generic}/dl-writev.h | 18 +++----
sysdeps/generic/string-bitops.h | 26 +++++++++
sysdeps/generic/string-fzi.h | 54 ++++++++++++-------
sysdeps/htl/raise.c | 3 ++
.../lp64/multiarch/dl-symbol-redir-ifunc.h | 2 +
sysdeps/posix/libc_fatal.c | 27 ++++++----
sysdeps/posix/raise.c | 2 +-
.../powerpc32/power4/multiarch/Makefile | 5 ++
.../be/multiarch/dl-symbol-redir-ifunc.h | 27 ++++++++++
.../le/multiarch/dl-symbol-redir-ifunc.h | 1 +
sysdeps/powerpc/powerpc64/multiarch/Makefile | 1 +
.../riscv/multiarch/dl-symbol-redir-ifunc.h | 1 +
sysdeps/s390/Makefile | 5 ++
.../s390/multiarch/dl-symbol-redir-ifunc.h | 4 ++
sysdeps/s390/string-bitops.h | 27 ++++++++++
.../sparcv9/multiarch/dl-symbol-redir-ifunc.h | 3 ++
.../sparc64/multiarch/dl-symbol-redir-ifunc.h | 3 ++
sysdeps/unix/sysv/linux/Makefile | 16 ++++++
sysdeps/unix/sysv/linux/dl-writev.h | 12 ++---
sysdeps/unix/sysv/linux/i386/Makefile | 14 +++++
sysdeps/unix/sysv/linux/i386/dl-mmap.c | 36 +++++++++++++
sysdeps/unix/sysv/linux/i386/dl-mmap.h | 27 ++++++++++
.../linux/{libc_fatal.c => i386/dl-writev.c} | 28 +++++-----
sysdeps/unix/sysv/linux/i386/dl-writev.h | 15 ++++--
sysdeps/unix/sysv/linux/i386/raise_direct.c | 26 +++++++++
sysdeps/unix/sysv/linux/raise_direct.c | 29 ++++++++++
.../unix/sysv/linux/riscv/multiarch/Makefile | 7 +++
.../x86_64/multiarch/dl-symbol-redir-ifunc.h | 32 +++++++++++
48 files changed, 625 insertions(+), 91 deletions(-)
create mode 100644 elf/tst-assert-startup-static.c
create mode 100644 elf/tst-pie-rpath-mod.c
create mode 100644 elf/tst-pie-rpath-static.c
create mode 100644 sysdeps/arm/armv7/multiarch/dl-symbol-redir-ifunc.h
create mode 100644 sysdeps/generic/dl-mmap.h
rename {elf => sysdeps/generic}/dl-writev.h (80%)
create mode 100644 sysdeps/generic/string-bitops.h
create mode 100644 sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h
create mode 100644 sysdeps/s390/string-bitops.h
create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.c
create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.h
rename sysdeps/unix/sysv/linux/{libc_fatal.c => i386/dl-writev.c} (58%)
create mode 100644 sysdeps/unix/sysv/linux/i386/raise_direct.c
create mode 100644 sysdeps/unix/sysv/linux/raise_direct.c
--
2.43.0
More information about the Libc-alpha
mailing list