View previous topic :: View next topic |
Author |
Message |
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3949
|
Posted: Sun Dec 01, 2024 10:34 am Post subject: gcc vs clang: why do you stay or switch? |
|
|
More and more topics have clang as an origin of issue.
Likely only because more and more users are switching. no judging on clang here.
I've just noticed stage3 has a LLVM version.
LTO kernel requires clang as gcc in this respect is simply not there.
IIUC clang is expected to compile faster in many cases which would be a time-saver when testing source packages or ebuilds.
As far as performance is concerned I know there are packages which do perform much faster when build with clang.
Defining such a list isn't a easy task.
There can be other reasons, unlisted there.
Anyone having switched at package level or globally to share reasons of choice, whatever their stage3 was?
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Last edited by CaptainBlood on Mon Dec 02, 2024 10:42 pm; edited 4 times in total |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3757 Location: Rasi, Finland
|
Posted: Sun Dec 01, 2024 11:19 am Post subject: |
|
|
I've used musl+llvm toolchain on amd64. And I'm about to set up one once again. Last time I ran it, it needed some extra work with some of the packages. And I needed to mask gcc.
I do run (not updated recently) glibc+llvm on my MacBook Air M2 which is arm64 obviously. I have hopes llvm could give better optimizations on Apple ARM since Apple itself uses llvm quite a lot. There hasn't been problems, but I don't use it very much because of the lack of memory (only 8G with no possibility to upgrade). _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2183
|
Posted: Sun Dec 01, 2024 12:21 pm Post subject: |
|
|
I switched to Clang 'cos it uses less space to compile qtwebengine, and hence can compile it faster. Having done that for qtwebengine, I thought I'd try it on more and more stuff until now it's my default*. My reason for that is Clang & LLVM are much newer than gcc, and (as Captain Blood mentioned, works better with LTO), and I assume large software suffers with age.
Also, AFAIK the only way to compile a kernel with LTO is with Clang.
* I say "default", as I have a package.env file for those where Clang breaks, but I know that the Gentoo devs also override the use of Clang for packages they know are broken, so I probably use Clang rather less often than I think! _________________ Greybeard |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3949
|
Posted: Sun Dec 01, 2024 1:13 pm Post subject: |
|
|
Goverp wrote: | (as Captain Blood mentioned, works better with LTO) | Didn't said that, only mentioned clang dedicated kernel LTO feature.
Not saying that ain't true, I have no experience to share...
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Spanik Veteran
Joined: 12 Dec 2003 Posts: 1006 Location: Belgium
|
Posted: Mon Dec 02, 2024 9:09 am Post subject: |
|
|
I have a couple of packages that I use clang because when compiling them with gcc I hit a hardware issue with the cpu (AMD Epyc). So more a workaround then anything else. _________________ Expert in non-working solutions |
|
Back to top |
|
|
mirekm Apprentice
Joined: 12 Feb 2004 Posts: 217 Location: Gliwice
|
Posted: Mon Dec 02, 2024 9:12 am Post subject: |
|
|
I stay on gcc. The main reason is security. For gcc there is hardened version.
The other thing is that clang allow bad quality code to work, and you will never know where is a hole allowing attack to your computer. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22764
|
Posted: Mon Dec 02, 2024 1:31 pm Post subject: |
|
|
Both gcc and clang allow bad quality code to compile, as long as the code is standards-compliant. It is fairly straightforward to write a program that both compilers will accept, but that has serious security problems when exposed to untrusted input. Therefore, I think it is not fair to blame clang for allowing bad quality code to work. |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3949
|
Posted: Mon Dec 02, 2024 10:32 pm Post subject: |
|
|
mirekm wrote: | I stay on gcc. The main reason is security. For gcc there is hardened version. |
So IIUC ebuild hardened kernel is currently gcc only, right?
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
|