[PATCH v2 0/5] elf: Allow RPATH/RUNPATH for static-pie (BZ 33326)

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Nov 17 20:01:40 GMT 2025


I have found the issue where the new test fails with the CI (it seems
it does not use --enable-hardcoded-path-in-tests and the new test
dlopen will use system libraries).  I will send a new version.

On 17/11/25 16:18, Adhemerval Zanella Netto wrote:
> Ping.
> 
> On 02/09/25 16:26, Adhemerval Zanella wrote:
>> 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 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_nocancel
>>   Use _dl_writev on __libc_message_impl
>>   Fix assert during static startup
>>   elf: Allow RPATH/RUNPATH for static-pie
>>
>>  assert/Makefile                               |  5 ++
>>  elf/Makefile                                  | 24 +++++++++
>>  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               | 35 ++++++++++++
>>  elf/tst-pie-rpath-mod.c                       | 19 +++++++
>>  elf/tst-pie-rpath-static.c                    | 53 +++++++++++++++++++
>>  include/signal.h                              |  2 +
>>  libio/Makefile                                |  5 ++
>>  nptl/pthread_kill.c                           | 21 +++-----
>>  signal/Makefile                               | 12 ++++-
>>  signal/raise_nostatus.c                       | 27 ++++++++++
>>  stdlib/Makefile                               |  5 ++
>>  string/Makefile                               |  2 +
>>  .../aarch64/multiarch/dl-symbol-redir-ifunc.h |  2 +
>>  sysdeps/aarch64/multiarch/memcpy_generic.S    |  4 ++
>>  sysdeps/aarch64/multiarch/strlen_generic.S    |  4 ++
>>  sysdeps/generic/dl-mmap.h                     | 34 ++++++++++++
>>  {elf => sysdeps/generic}/dl-writev.h          | 18 +++----
>>  sysdeps/generic/string-bitops.h               | 26 +++++++++
>>  sysdeps/generic/string-fzi.h                  | 50 +++++++++++------
>>  .../lp64/multiarch/dl-symbol-redir-ifunc.h    |  3 ++
>>  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 +
>>  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              |  5 ++
>>  sysdeps/unix/sysv/linux/dl-mmap.h             | 34 ++++++++++++
>>  sysdeps/unix/sysv/linux/dl-writev.h           | 13 ++---
>>  sysdeps/unix/sysv/linux/i386/dl-mmap.h        | 38 +++++++++++++
>>  sysdeps/unix/sysv/linux/i386/raise_nostatus.c | 26 +++++++++
>>  .../linux/{libc_fatal.c => raise_nostatus.c}  | 27 ++++------
>>  .../unix/sysv/linux/riscv/multiarch/Makefile  |  5 ++
>>  .../riscv/multiarch/dl-symbol-redir-ifunc.h   | 26 +++++++++
>>  .../x86_64/multiarch/dl-symbol-redir-ifunc.h  | 33 ++++++++++++
>>  45 files changed, 593 insertions(+), 85 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 signal/raise_nostatus.c
>>  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/dl-mmap.h
>>  create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.h
>>  create mode 100644 sysdeps/unix/sysv/linux/i386/raise_nostatus.c
>>  rename sysdeps/unix/sysv/linux/{libc_fatal.c => raise_nostatus.c} (58%)
>>  create mode 100644 sysdeps/unix/sysv/linux/riscv/multiarch/dl-symbol-redir-ifunc.h
>>
> 



More information about the Libc-alpha mailing list