Hi! On Tue, 2024-10-22 at 23:00:29 +0200, Serafeim (Serafi) Zanikolas wrote: > I'd like to discover all installed linker scripts, for the purposes of > #823531 (check for broken linker scripts files). it's not clear to me > that there's a convention I could rely on to avoid brute forcing > filetype detection of everything under /lib/${DEB_HOST_GNU_TYPE} > (that'd be /lib/x86_64-linux-gnu in my system).
The current convention is to have "GNU ld script" on the first line, by way of ldconfig(8) otherwise complaining about an unknown file format. Perhaps if you want to avoid having to open all the files, then a heuristic could be to discard files bigger than some threshold. Linker scripts should in general not be that big. > my intuition would be to only look in /lib/${DEB_HOST_GNU_TYPE}/ldscripts, > and ignore *.so named files, but a few linker scripts break both of those > assumptions: I think checking for stuff under /ldscripts/ might also be good, but I assume the bug report you mention was precisely concerned about *.so or *.a linker scripts under /usr/lib. These are needed when you want to transparently move functions around or provide them in different libraries but not require users to specify different libraries to link to, while not breaking compilation. > /lib/x86_64-linux-gnu/libc.so > /lib/x86_64-linux-gnu/libm.a > /lib/x86_64-linux-gnu/libusb.so Another one I'm aware of would be libbsd.so, where it was added to transparently redirect code linking against it that used MD5 functions into linking against libmd.so when needed. Instead of requiring a SOVERSION bump. > are these misplaced and misnamed? I didn't find any relevant guidance > skimming through policy. These are fine, but perhaps not very common. I don't think the Debian policy has anything about it, I guess because of the above. Thanks, Guillem