8 ms·
Just a question (this is how out of touch I am). I thought most linux compilation moved over to a lvvm toolchain?
by InTheArena 9y ago
Just a question (this is how out of touch I am). I thought most linux compilation moved over to a lvvm toolchain?
- shmerl 9y agoNot really, but it's generally up to individual projects. Many support both gcc and clang.
- unmole 9y agoNot even remotely close. No major distribution uses the LLVM toolchain.
- shmerl 9y agoIf you are talking about the kernel itself, I think Debian did some work to support building Linux with clang. But last time I checked, it wasn't ready. See also: https://wiki.debian.org/llvm-clang https://wiki.debian.org/llvm-clang
- cyphar 9y agoDistributions compile more than just a kernel. That's just one of several thousand packages we build. Usually the problem (even with something as simple as PIC/ASLR) is that old projects might have problems compiling. We just switched openSUSE Tumbleweed to GCC7 a few months ago, and it was a very large amount of work. I can't imagine how much work it would take to switch to LLVM.
- DannyBee 9y agoCounterpoint: We compile more than one entire linux distribution (one is gentoo based, others vary) with llvm with essentially no issues (the number of local patches is incredibly small, and most is actually just buggy code that clang happens to detect, and we are waiting for upstream to accept). Is it work? Sure. But it's not like "years of real work". It's about 5-10 people for a quarter or two.
- cyphar 9y agoIt is definitely possible, but I was saying that switching to LLVM would take a while, and that even GCC updates are painful. 5-10 people for 6 months is a fairly serious time investment for a community project (especially since we have a lot of other things on our plate).
- ktta 9y agoThere are efforts for the kernel itself too. http://llvm.linuxfoundation.org/index.php/Main_Page http://llvm.linuxfoundation.org/index.php/Main_Page
- cesarb 9y agoIn my experience, most Linux compilation still uses gcc. For instance, Fedora often recompiles all of its packages with a newer gcc for new Fedora releases; see https://fedoraproject.org/wiki/Changes/GCC7 https://fedoraproject.org/wiki/Changes/GCC7 and https://fedoraproject.org/wiki/Changes/GCC6 https://fedoraproject.org/wiki/Changes/GCC6 and so on. And the Linux kernel, due to its heavy use of gcc-specific extensions, also has some problems compiling with LLVM; see https://bugs.llvm.org/show_bug.cgi?id=4068 https://bugs.llvm.org/show_bug.cgi?id=4068 for a list.
- DannyBee 9y agoActually, these days, it compiles just about fine. (though admittedly it depends on the platform)
- fegu 9y agoFreeBSD has moved to llvm.
- bch 9y agoNetBSD also supports clang/llvm. https://wiki.netbsd.org/tutorials/pkgsrc/clang/ https://wiki.netbsd.org/tutorials/pkgsrc/clang/
- oblio 9y agoFor the base system or for everything? I doubt they moved the ports to compiling to LLVM.
- lmm 9y agoIt's the default for anything. Many ports override that and specify gcc (but that was already the case in a lot of cases where they needed a newer version than what shipped in the base system).
- bluGill 9y agoStarting FreeBSD 10 (released in 2014) the default for everything including ports was to build with clang. There was a large effort leading up to that to get as many ports as possible building with clang. Many bugs in clang were fixed, and patches were submitted upstream to make others work. At this time that effort is dead: the few ports that don't build with clang are accepted as doing something that will never work.
- loeg 9y agoFor compiler for base and most of ports, yes. The linker is still an ancient GPL2 GNU binutils one.
- floatboth 9y agoA lot of work happened on linking base with LLVM's LLD, I think it might be already used in -CURRENT for amd64 and arm64.
- stusmall 9y agoTo add to what other people have said, you can't even compile the kernel unpatched with llvm yet. GCC is still very much a thing.
- brianwawok 9y agoWhat would be the benefit to llvm?
- simcop2387 9y agomore portability, and some of the santiziers that clang has (ubsan, asan). They have gcc equivalents or ports but being able to use more of these kinds of tools is a good thing in the end since it'll allow more bugs to be found without an exploit.
- nullc 9y ago> and some of the santiziers that clang has (ubsan, asan) GCC has these.
- simcop2387 9y agoDo they end up finding the same issues/bugs? I thought they didn't always find the same things last I tried using them, so I'd build in both compilers to end up running tests/checks.
- CJefferson 9y agoNo sure what you mean by 'more portability'. gcc compiles to a strict subset of the architectures than llvm supports (at least, last time I checked).
- JohnStrange 9y agoYou mean superset, right?
- jhasse 9y agoTurns out that after Clang got all the features GCC already had, compile times where even worse. At least for my C++ programs compiling with g++ is faster than with clang++.
- e12e 9y agoWhy would you want to switch to llvm from gcc for a GNU/Linux distribution? (I mean, beyond proving that the code is portable and do regression testing)? I do remember talk on and off about shifting to the Intel c compiler, for increased performance - apparently Intel now has their own distro: https://clearlinux.org/ https://clearlinux.org/
- deleted 9y ago[deleted]