Also, as I mentioned in another thread, I do think it'd be very possible to write a shim loader that sets the insert-library env var and then dispatches to the actual musl linker, thus removing the need for the re-exec (and all these /proc/self/exe
shims); let me know if you'd like to chat, I can put together a PoC if you're interested.
The drivers are installed on glibc systems; I ship a musl executable (the ffmpeg fork included with Plex Media Server) that runs on those systems and needs to load the host system's graphics drivers (most notably Nvidia's, which are closed-source).
I use gcompat when building binaries against musl that need to link to shared libraries built against glibc. In my case, this is when dlopen()
ing a third-party library at runtime (e.g. GPU drivers). This would also apply when linking against a third-party closed-source library at compile-time. My code is portable, but the user's graphics drivers aren't.
This is only required when building for install in a distro; when building a library to be linked against by portable executables, it's not needed, and can cause problems with readlink() when the configured path doesn't exist.
Ridley Combs (c9778526) at 14 Nov 19:17
all: support building without the linker shim
Ridley Combs (3ce2c978) at 14 Nov 19:17
all: support building without the linker shim
... and 17 more commits
open()
at startup, then dup2
to some unused high-numbered fd, then close()
the originally-opened file.execve
to re-exec the musl loader, you could do what dcrt0 does, and map musl into memory and jump to it directly (note this would require rewriting the environment table in the process startup block; I can think of a few ways this could be done, most trivially by duplicating the entire block).Ridley Combs (fbdd06c3) at 06 Oct 03:26
Ridley Combs (f727ab78) at 06 Oct 03:25
Ridley Combs (c6921a1a) at 26 Jun 21:06
@awilfox Done.
Ridley Combs (4dcdca9c) at 25 May 16:27
string: add __explicit_bzero_chk
We'll just say we're always multi-threaded (same as glibc does in duplicate copies of itself loaded into the same process via dlmopen)
Ridley Combs (8aa36e3e) at 29 Mar 03:04
misc: add __libc_single_threaded
libstdc++ calls these directly
Ridley Combs (6f467c90) at 29 Mar 02:01
locale: also override __newlocale/__duplocale
Ridley Combs (ada4b2ff) at 29 Mar 02:00
Ridley Combs (d06d90a2) at 29 Mar 01:59
locale: also override __newlocale/__duplocale
... and 1 more commit