Gentoo Archives: gentoo-user

From: Wols Lists <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: sys-devel/llvm and LLVM_TARGETS
Date: Sat, 12 Mar 2022 14:40:06
Message-Id: fcdf42f2-f25d-c8ea-a2d3-2d4181d5520e@youngman.org.uk
In Reply to: [gentoo-user] Re: sys-devel/llvm and LLVM_TARGETS by Nikos Chantziaras
1 On 12/03/2022 14:22, Nikos Chantziaras wrote:
2 > On 12/03/2022 10:43, Dale wrote:
3 >> https://bugs.gentoo.org/767700
4 >>
5 >> Is that the one?  It mentions the target but I don't quite understand
6 >> the why.  The biggest thing, will this break something if I let it do
7 >> it?
8 >
9 > No. Unlike GCC, LLVM/Clang is always a cross-compiler. This just enables
10 > some extra targets. It won't actually affect anything other than perhaps
11 > the binaries becoming a bit larger.
12 >
13 >
14 I don't fully understand it (and I thought gcc was moving in the same
15 direction), but Clang is a front-end, compiling C to "Intermediate
16 Representation". LLVM is a middle/back end which calls optimisation
17 modules on the IR which finally end up spitting out machine code - for
18 whatever definition of machine code floats your boat.
19
20 So I guess adding these extra targets just adds another LLVM module that
21 just happens to spit out these extra different machine codes.
22
23 But that's how LLVM can compile so many different languages - it simply
24 converts IR to machine code. There's a whole bunch of different front
25 ends, it's just that Clang is the most well known because the world and
26 his dog work in C/C++. I believe there's a rust front end, amongst
27 others, but it feels like other languages are a bit "second class". Not
28 intentionally, but the C guys have so much input into the IR that the
29 other languages get swamped, and people take a while to realise that
30 what was a good decision for C was not a good decision for languages in
31 general, and the other guys are playing catch-up because nobody noticed.
32
33 That's not a dig at anybody, it's just life.
34
35 I used to follow this on the LLVM mailing list, but that's now migrated
36 to discourse, and I think I'm amongst a lot of people who didn't follow
37 it ...
38
39 Cheers,
40 Wol