Live data from Hacker News

When can glibc be built with Clang?

maskray.me

21–30 of 30 posts

Re: When can glibc be built with Clang?

#22
post #18
post #8

Earlier quoted context omitted.

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.

That's why they said since 5 years. My experience was that clang seems longer compiling but due to the fact i did not compiled the same program with clang and gcc i would not take it as a rule.

I was referring to performance of the compiled program, not the time it takes to compile it.

Re: When can glibc be built with Clang?

#23
post #6
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?

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…

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

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.

Re: When can glibc be built with Clang?

#24
post #17
post #15

Earlier quoted context omitted.

> Similarly, the bundled `cc`s with classic Unices (if they were provided at all 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.

HP-UX, Aix, Solaris and mainframes POSIX environments are still around. Additionally, embedded also has plenty of POSIX like OSes that arent' Linux based.

AIX is doing a lot better than HP-UX and Solaris are. In relative terms.

Re: When can glibc be built with Clang?

#25
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 people who use terms like “GNU/Linux” see the spread of GNU-isms in code as a way to preach their gospel and entrench their politics in codebases. Fortunately the LLVM ecosystem implemented a lot of those, so they couldn’t be used as an excuse not to use LLVM-based tools.

Re: When can glibc be built with Clang?

#26
post #15
post #9

Earlier quoted context omitted.

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 pr…

> Similarly, the bundled `cc`s with classic Unices (if they were provided at all 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.

The thing is, you didn’t pay more for shitty developer tools. You paid more for good tools. The system compiler existed solely to enable kernel rebuilds prior to the advent of loadable kernel modules on most vendor UNIX platforms.

Re: When can glibc be built with Clang?

#27
post #15
post #9

Earlier quoted context omitted.

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 pr…

> Similarly, the bundled `cc`s with classic Unices (if they were provided at all 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.

> That gcc has gone from savior to legacy in that time is a huge testament to the value the open source world has created

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.

Re: When can glibc be built with Clang?

#28
post #15

Earlier quoted context omitted.

> Similarly, the bundled `cc`s with classic Unices (if they were provided at all 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.

> That gcc has gone from savior to legacy in that time is a huge testament to the value the open source world has created 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.

That's exactly an illustration that a few competitors is unhealthy for the ecosystem, and llvm isn't going to evolve as fast as it did.

Re: When can glibc be built with Clang?

#29

Earlier quoted context omitted.

> That gcc has gone from savior to legacy in that time is a huge testament to the value the open source world has created 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.

That's exactly an illustration that a few competitors is unhealthy for the ecosystem, and llvm isn't going to evolve as fast as it did.

If LLVM vanquishes GCC, you mean?

Re: When can glibc be built with Clang?

#30

Earlier quoted context omitted.

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.

clang wins on some benchmarks, but gcc wins on over 50% of benchmarks, at least this always seems to be the case whenever I look it up. 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

These benchmarks also don't reflect how good are the backends for different CPU architectures in GCC and LLVM.

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.

Post reply on HN