-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Slow dynamic linker resolution of shared libraries #367683
Comments
I think adding a |
Actually, something like |
I don't know what weird stuff changing the |
I guess patching |
Thanks for pinging me !
Have you read <#24844> already ?
Le 23 décembre 2024 18:34:09 GMT+01:00, "Mihai-Drosi Câju" ***@***.***> a écrit :
…Pinging @layus and @Mic92 for comments.
--
Reply to this email directly or view it on GitHub:
#367683 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
The idea to use absolute paths in soname is not new. I think the last time I saw that it being tried, it caused some crashes. In theory it should work but it would require a more intelligent linker wrapper. The wrapper would require to lookup the sonames within the provided linker paths. It would make patchelf for stdenv unnecessary. Also check out this issue: #362353 |
The crashes that I saw were related to libc.so.6 IIRC. This was the bug and it got fixed: https://sourceware.org/bugzilla/show_bug.cgi?id=22787 . We don't use hwcaps directories, instead we link optimized symbols into libc directly, so we don't need additional rpaths. An alternative would be a per-app Or if we want to take from Guix(https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/) we can look-up ld.so.cache in |
I've just went through it. Sorry that I didn't check if this bug existed already. I got annoyed that Serpent OS used ldconfig and we didn't. I did not check if their implementation did anything innovative. But... knowing them, I guess it was a horrible hack. |
Presently when running a dynamically linked program, it searches its entire
rpath
for a givenDSO
with aSONAME
. Such as:This causes unnecessary
openat
syscalls.A proposed solution would be to add the
-Wl,-soname=$out/lib/libname.so
to every invocation of the linker for shared objects.As an experiment, I compiled a share object with the above flag and compiled a test program linked to the previous shared object. The output was:
As we can notice,
lib.so
is found immediately without a lookup inrpath
.If we run:
We notice immediately that
SONAME
has indeed the expected value.Note: I replaced every instance of the current working directory with
$PWD
in the above code snippets for privacy reasons.The text was updated successfully, but these errors were encountered: