When can glibc be built with Clang?
maskray.me
maskray.me
It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.
Edit - also, lack of updates. POSIX added a new feature to a tool 5 years ago? Well, the built-in tool that came with your classic Unix probably still doesn't support it yet. The GNU tool does though.
If your build system effectively relies on GNU `make` because 75% of the other `make` implementations out there either barf on your makefile, or don't run the build steps correctly, despite it being valid according to the spec; and GNU `make` has a bunch of features that are really powerful and would allow you do some complex things more easily, or even do them at all; then why not just actually rely on GNU `make` and use the extensions?
Similarly, the bundled `cc`s with classic Unices (if they were provided at all) frequently had weird bugs or poor code generation that would go unfixed for years. If `gcc` was the only compiler you could rely on a) your users having access to, and b) to correctly compile your code; and it has a bunch of really cool features that make your code smaller or faster or cleaner, it's hard to resist that. Your code is still portable, because `gcc` is portable, and Free.
It has been a generation since it was common for people to pay for Unix, and then pay more for shitty developer tools.
That gcc has gone from savior to legacy in that time is a huge testament to the value the open source world has created. But I think people forget the bad old days pretty quickly.
Additionally, embedded also has plenty of POSIX like OSes that arent' Linux based.
I hope GNU can turn itself around, but because having n+1 competing FOSS implementations is a huge boost. I just fear it is not a sustainable situation.
libgccjit and the new rust backend is a good sign.
If it isn't possible to build currently I expect minimal clarifying changes wouldn't have much impact on runtime performance (where it compiled previously), but as mentioned in another post would lower the risk of bugs and maintenance burden with clearer code.
Portability, validation, across multiple platforms is one way of exposing bugs and weaknesses in logical description.
They have highly similar designs (at least in the middle-end which is the important part), or did, but gcc's remaining large customers care most about optimizations so it's still somewhat ahead there.
https://www.phoronix.com/scan.php?page=article&item=clang-lt...
If I were writing a program that needed to be really fast I would just compile with both on max optimizations and pick whichever was best. Most software isn't the linux kernel and will work fine with both compilers
For instance, GCC is by far the dominant compiler on GNU/Linux on x86, while LLVM has a almost total monopoly of AArch64 (think about Android NDK + iOS + macOS). I think it would be quite natural for the GCC AArch64 backend to get less focus compared to its x86 counterpart. It's a complicated landscape that is always full of gotchas, and that's why I don't like these kinds of benchmarks a lot.
The key takeaway is that GCC is still an extremely good compiler.
> And finally, we certainly do not ship the build system of glibc with Zig! I manually inspected, audited, and analyzed glibc's build system, and then by hand wrote code in the Zig compiler which hooks into Zig's caching system and performs a minimal build of only these start files, as needed.
It sounds to me like they build glibc using its own build system, but they use Zig to build the statically-linked glue code necessary to dynamically link to a system glibc. This allows cross-compiling to a glibc target without having glibc installed locally. Certainly very impressive.