Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jun 2024 19:01:28 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Minimum gcc and clang supported to generate FreeBSD binaries
Message-ID:  <CANCZdfqBdsoNf8tVwX6MH=Dd24e114b_Pn5hA5UjxtSBX-h%2BGA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--000000000000790ce2061b47dba4
Content-Type: text/plain; charset="UTF-8"

Greetings,

I've been having a go at cleaning up sys/cdefs.h for going on 5 years now.
One big problem is that it's chock-o-block of special cases and hacks going
back to the early 1990s (before some people on this list were even born).

I'd like to remove a lot of that, while still retaining useful versions of
gcc and clang to work (plus preserving what support that we have for pcc
and tcc (including fixing the latter). Note: this is "building binaries on
FreeBSD" not "building FreeBSD" which has much much tighter requirements
for compilers. This won't affect that at all.

To that end, I'd like to draw a line in the sand. If you are building
FreeBSD binaries for FreeBSD 15 and newer, you need to use gcc9 (or newer)
or llvm/clang 11 (or newer). Stable/12 has clang 13 at its tip. These
compilers are 5 years old or so. And are the oldest compilers in the ports
tree that we use to generate FreeBSD binaries (there's three older ones:
gcc 6 for ada, gcc 4.2 for TI calculators (but it doesn't use system
headers) and gcc 2.7.2 for hp48 calculators (same). So from a ports
perspective,

>From a looking at changes perspective, there's about 30 instances of
GNU_PREREQU in the tree. The newest one is for gcc 5.1. So nominally
supporting just gcc9 and newer means assuming that these are all true
(which is true for gcc and clang) and removing specific support for them.
clang and gcc easily clears these bars.

Ah, but what do you say about tcc and pcc which are't gcc? Well, tcc lies,
and says it supports gcc (version 9 I think, but it's been a while since I
checked). tcc can't work today because we have qsort.h using versioned
symbols unconditionally, and it doesn't support versioned symbols.... And
patches to do that have been stalled for reasons unrelated to this desire.
pcc doesn't support gnuc symbols at all last I checked. But it has real
issues building some things in the tree, so I'll not gate things by it
unless somebody steps up to actually do the work to make it work. The pcc
upstream has been weird lately too.

ICC used to be supported, but unless someone turns up with patches for the
latest icc, it will remain supported only to the extent it pretends to be
gcc. I've had reports that it works, to this extent and nothing special is
needed to build FreeBSD binaries. There are a couple of touch ups required
to build FreeBSD itself with icc I'm told, but I've not seen patches and
have little desire to chase this windmill.

In practical sense, this will just be writing down what's the reality on
the ground today: old compiler versions haven't been tested and there's a
lot of known issues we've introduced since moving to clang that will
preclude even our old gcc 4.2 from working with system headers.

Of course, I'll do an exp run with all these changes. But I wanted to give
people a heads up that I'll be doing this before 15.0 is branched.

For the vast majority (all?) users, I expect you'll not notice.

Warner

--000000000000790ce2061b47dba4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Greetings,</div><div><br></div><div>I&#39;ve been hav=
ing a go at cleaning up sys/cdefs.h for going on 5 years now. One big probl=
em is that it&#39;s chock-o-block of special cases and hacks going back to =
the early 1990s (before some people on this list were even born).</div><div=
><br></div><div>I&#39;d like to remove a lot of that, while still retaining=
 useful versions of gcc and clang to work (plus preserving what support tha=
t we have for pcc and tcc<b> </b>(including fixing the latter). Note: this =
is &quot;building binaries on FreeBSD&quot; not &quot;building FreeBSD&quot=
; which has much much tighter requirements for compilers. This won&#39;t af=
fect that at all.<br></div><div><br></div><div>To that end, I&#39;d like to=
 draw a line in the sand. If you are building FreeBSD binaries for FreeBSD =
15 and newer, you need to use gcc9 (or newer) or llvm/clang 11 (or newer). =
Stable/12 has clang 13 at its tip. These compilers are 5 years old or so. A=
nd are the oldest compilers in the ports tree that we use to generate FreeB=
SD binaries (there&#39;s three older ones: gcc 6 for ada, gcc 4.2 for TI ca=
lculators (but it doesn&#39;t use system headers) and gcc 2.7.2 for hp48 ca=
lculators (same). So from a ports perspective, <br></div><div><br></div><di=
v>From a looking at changes perspective, there&#39;s about 30 instances of =
GNU_PREREQU in the tree. The newest one is for gcc 5.1. So nominally suppor=
ting just gcc9 and newer means assuming that these are all true (which is t=
rue for gcc and clang) and removing specific support for them. clang and gc=
c easily clears these bars.<br></div><div><br></div><div>Ah, but what do yo=
u say about tcc and pcc which are&#39;t gcc? Well, tcc lies, and says it su=
pports gcc (version 9 I think, but it&#39;s been a while since I checked). =
tcc can&#39;t work today because we have qsort.h using versioned symbols un=
conditionally, and it doesn&#39;t support versioned symbols.... And patches=
 to do that have been stalled for reasons unrelated to this desire. pcc doe=
sn&#39;t support gnuc symbols at all last I checked. But it has real issues=
 building some things in the tree, so I&#39;ll not gate things by it unless=
 somebody steps up to actually do the work to make it work. The pcc upstrea=
m has been weird lately too.</div><div><br></div><div>ICC used to be suppor=
ted, but unless someone turns up with patches for the latest icc, it will r=
emain supported only to the extent it pretends to be gcc. I&#39;ve had repo=
rts that it works, to this extent and nothing special is needed to build Fr=
eeBSD binaries. There are a couple of touch ups required to build FreeBSD i=
tself with icc I&#39;m told, but I&#39;ve not seen patches and have little =
desire to chase this windmill.<br></div><div><br></div><div>In practical se=
nse, this will just be writing down what&#39;s the reality on the ground to=
day: old compiler versions haven&#39;t been tested and there&#39;s a lot of=
 known issues we&#39;ve introduced since moving to clang that will preclude=
 even our old gcc 4.2 from working with system headers.</div><div><br></div=
><div>Of course, I&#39;ll do an exp run with all these changes. But I wante=
d to give people a heads up that I&#39;ll be doing this before 15.0 is bran=
ched.</div><div><br></div><div>For the vast majority (all?) users, I expect=
 you&#39;ll not notice.<br></div><div><br></div><div>Warner<br></div></div>

--000000000000790ce2061b47dba4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqBdsoNf8tVwX6MH=Dd24e114b_Pn5hA5UjxtSBX-h%2BGA>