]> git.ipfire.org Git - thirdparty/systemd.git/commit
libc: Use dlsym() from a constructor instead of weak symbols
authorDaan De Meyer <daan@amutable.com>
Thu, 14 May 2026 19:20:02 +0000 (19:20 +0000)
committerDaan De Meyer <daan@amutable.com>
Mon, 18 May 2026 21:17:38 +0000 (21:17 +0000)
commitb77c7b7cfc243691c44d5104e8440cd3aeb86ace
treea9016253c2d255bc1bce7c1e0403e43aa15cf520
parenta14adac42361d1ebaf6c7c2a8a680939f2d1cd64
libc: Use dlsym() from a constructor instead of weak symbols

Weak symbols still introduce a version requirement on a newer libc.
Resolve each libc symbol via dlsym(RTLD_DEFAULT) from a per-shim
constructor and cache the result in a file-scope static instead. This
avoids the version requirement, keeps the call path free of atomics
(constructors run single-threaded before main() and before any signal
handler can fire), and keeps dlsym() out of contexts where it is not
async-signal-safe.
src/libc/libc-shim.h