|
|
Message-ID: <13bc2483-b33f-413f-a370-588e33c6cd86@gmail.com> Date: Wed, 12 Nov 2025 14:12:55 -0500 From: Demi Marie Obenour <demiobenour@...il.com> To: musl@...ts.openwall.com, Fredrik Orderud <forderud@...il.com>, Rich Felker <dalias@...c.org> Subject: Re: Safe to load musl shared lib into glibc executable? On 11/12/25 13:26, Fredrik Orderud wrote: > On Wed, Nov 12, 2025 at 3:47 PM Rich Felker <dalias@...c.org> wrote: >> If you're making a shared library, you cannot static link libc into >> it. This is breaking whether you are using glibc or musl. > > Thanks a lot for quick and clear answers, Rich! I'll then continue > with my current approach of linking to an old version of glibc when > building the shared lib. in question. > >> The problem is that, even if you could embed your own libc instance >> into your library, it will assume it has ownership of process-wide >> singletons that the "real" host libc the rest of the program is using >> also assumes it has ownership over. Things like the thread pointer >> register, signal disposition, heap brk point, etc. >> >> In principle one could make a libc that's designed to be hosted by >> something external to itself, with functionality limited to what it >> could do without owning process state, but that is not what musl is. > > My background is mostly from Windows where it's always been simple to > link statically to the C library when building a shared library. The > glibc and musl limitations in this area therefore came as a surprise > to me. Do you think it could be possible to update the musl > documentation to more explicitly mention this limitation, so that > this is clear for the next developer down the road? This is one of the factors. The other is that Windows supports two-stage symbol lookup, meaning that symbol X in your DLL can be different than symbol X in a different DLL or the main executable. This is a huge advantage for shipping stuff in binary form. It would also be useful for musl to implement this, but I'm not going to ask for it because I don't have the time to send a patch right now. -- Sincerely, Demi Marie Obenour (she/her/hers) Download attachment "OpenPGP_0xB288B55FFF9C22C1.asc" of type "application/pgp-keys" (7141 bytes) Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.