Hi all. I'm the original author and maintainer of musl, and I'm happy to answer any questions anyone might have about the project. Glad to see so much interest!
First - awesome job! I'm curious, what motivated you to start working on it?
Musl-libc version 1.0.0 released
21–30 of 38 posts
Re: Musl-libc version 1.0.0 released
#22wait, but I thought premature optimization was evil !
BTW, one difficulty in libc is that it's hard to know what optimizations are "premature" because you can't envision everybody's usage cases without an enormous volume of experience with third-party code.
Re: Musl-libc version 1.0.0 released
#23Hi all. I'm the original author and maintainer of musl, and I'm happy to answer any questions anyone might have about the project. Glad to see so much interest!
Re: Musl-libc version 1.0.0 released
#24Hi all. I'm the original author and maintainer of musl, and I'm happy to answer any questions anyone might have about the project. Glad to see so much interest!
How much abstraction does musl have over the use of Linux syscalls, and how easily could it supply a partial libc for some other environment, such as an embedded bare-metal environment?
A relatively small number of syscalls are used as part of implementing other functions. Most if not all of these are made via macros that expand to inline syscalls; by replacing them with a call into your own function that implements the equivalent of the syscalls you need "on the metal" rather than calling into a kernel, most of the work is done.
Some syscalls are made directly from assembly source files because C is unable to represent the work that needs to be done around them (e.g. clone and vfork) or simply because their usage is arch-specific. These obviously use the trap-to-kernel instructions directly and cannot be re-routed as described above. Still the number of files is so small you could just rewrite the asm.
One future direction (albeit with lower priority than further functionality/quality improvements, unless somebody funds it) is making it easier to port to bare-metal and documenting the process.
Re: Musl-libc version 1.0.0 released
#25I have been using Musl for various purposes for quite some time. I think my favourite things are: * The team are very helpful, and fix things fast and correctly. You can see some of the detail in this post on race conditions in glibc http://ewontfix.com/16/ * It is very standards compliant, so it is a good portability test for your code. It is a bit like using a BSD libc, except it does have Linux specific syscalls e…
False. It doesn't. At the very least, VDSO support on Linux for static builds is broken.
I.e., calls to time() and gettimeofday() and friends will be orders of magnitude slower when linking statically.
Looking at the code I think nobody on the team was even aware that this is an important corner case.
I'll stick to glibc, they at least do proper testing.
Re: Musl-libc version 1.0.0 released
#26Re: Musl-libc version 1.0.0 released
#27Hi all. I'm the original author and maintainer of musl, and I'm happy to answer any questions anyone might have about the project. Glad to see so much interest!
Re: Musl-libc version 1.0.0 released
#28Re: Musl-libc version 1.0.0 released
#29Hi all. I'm the original author and maintainer of musl, and I'm happy to answer any questions anyone might have about the project. Glad to see so much interest!
Is there any reason why, theoretically, using LD_PRELOAD to replace libc6 with this would not work?
What could be done in theory is replacing /lib/ld-linux.so.2 with a symlink to musl. One of the long-term goals for musl is for this to actually work, at least for many programs. But right now there are a lot of glibc-specific symbols that get pulled in magically by glibc's headers, even when the program at the source-level is 100% portable code, and we don't have coverage for all of these.
Re: Musl-libc version 1.0.0 released
#30Earlier quoted context omitted.
Is there any reason why, theoretically, using LD_PRELOAD to replace libc6 with this would not work?
LD_PRELOAD alone wouldn't do it because glibc's dynamic linker is closely tied to glibc. In particular thread-local storage requires close cooperation between them. Likewise, musl needs its own dynamic linker. What could be done in theory is replacing /lib/ld-linux.so.2 with a symlink to musl. One of the long-term goals for musl is for this to actually work, at least for many programs. But right now there are a lot o…