Live data from Hacker News

When can glibc be built with Clang?

maskray.me

1–10 of 30 posts

Re: When can glibc be built with Clang?

#3
Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community.

It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

Re: When can glibc be built with Clang?

#4
post #3

Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community. It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

I looked and didn't see any answer to... is there a difference in performance of the gcc vs llvm compiled kernel?

Re: When can glibc be built with Clang?

#6
post #4
post #3

Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community. It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

I looked and didn't see any answer to... is there a difference in performance of the gcc vs llvm compiled kernel?

They're different compilers so I assume the answer would be yes.

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.

Re: When can glibc be built with Clang?

#7
post #4
post #3

Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community. It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

I looked and didn't see any answer to... is there a difference in performance of the gcc vs llvm compiled kernel?

Those are not necessarily comprehensive benchmarks, but it seems clang is doing very well in many workloads:

https://www.phoronix.com/scan.php?page=article&item=clang-lt...

Re: When can glibc be built with Clang?

#8
post #4
post #3

Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community. It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

I looked and didn't see any answer to... is there a difference in performance of the gcc vs llvm compiled kernel?

GCC with max optimization still generally produces faster binaries than clang, but clang is constantly improving and in a few years they will probably be very similar.

Re: When can glibc be built with Clang?

#9
post #3

Glibc has always been a whole rigamarole of nasty GCC-isms. I've been interested in building entire GNU/Linux systems with Clang for years, but I have always found a general lack of interest from both maintainers and the community. It's nice to see that finally something is moving, especially now that Linux is also finally buildable with LLVM.

A lot of the GNU tools have had dependencies on GNU-specific versions of classic tools because, for decades, the non-GNU versions sucked. Lots of hard-coded arbitrary limits (line lengths, file sizes, command line option counts), quadratic behaviours, crashes, weird corner cases.

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.

Re: When can glibc be built with Clang?

#10
post #8
post #4

Earlier quoted context omitted.

I looked and didn't see any answer to... is there a difference in performance of the gcc vs llvm compiled kernel?

GCC with max optimization still generally produces faster binaries than clang, but clang is constantly improving and in a few years they will probably be very similar.

Is that still true though? It was definitely the case some 5-10 years ago, but last time I checked they were pretty comparable, losing some, winning others.
Post reply on HN