FreeBSD The Power to Serve

GCC on FreeBSD

Contact: Lorenzo Salvadore <salvadore@FreeBSD.org>

Update GCC default version to 12

Thank you very much to antoine@ for running the necessary exp-runs and to all the contributors, maintainers and committers involved in the process.

As was noted last quarter, for every major version of GCC, FreeBSD usually awaits the release of the second minor version to update GCC default version. However next time I would like to attempt to update the default version as soon as the first minor version of GCC 13 is out. The rationale for awaiting the second minor release was to wait for other operating systems (in particular Linux distributions) to find, report, and fix bugs, so that FreeBSD could focus mainly on FreeBSD-specific cases. But this also meant that upstream software developers only heard from FreeBSD rarely, and mostly when it concerned FreeBSD only, thus our operating system risks being considered minor and unimportant for them.

My hope is that software authors can value supporting FreeBSD more as the number of its contributions to other projects also increases. Of course I understand that this will imply more work for all ports maintainers and I will do my best to help them as much as I can.

Resolution of a conflict preventing the installation of multiple GCC versions simultaneously

Now, lang/gcc11 and lang/gcc12 can be installed at the same time. This was particularly important for the update of the GCC default version, since a few ports have been kept to compile with GCC 11 for now.

Note however that at the moment only one -devel GCC port at the time can be installed on your system. This is because I have patched the standard ports only: for the -devel port I expect upstream to fix the issue soon, by using a patch submitted by a FreeBSD user or my own patch, or using some other solution.

D language

D is now enabled in lang/gcc11 and lang/gcc11-devel, thanks to diizzy. I plan to include D support for higher versions of GCC too, but this cannot be done as easily as for GCC 11 due to bootstrapping issues: starting from GCC 12, the D compiler GDC needs a working GDC to be built.

Crashes with -fsanitize=address

Software compiled with GCC using the -fsanitize=address switch has been reported to crash. I have fixed the issue for lang/gcc11, lang/gcc11-devel, lang/gcc12, and lang/gcc12-devel. I am still working on lang/gcc13-devel.

Use of the address sanitizer requires ASLR to be disabled. As GCC gets the code that I am modifying from LLVM, and LLVM is also included in the FreeBSD src repository with some patches that improve ASLR detection and automatically re-run programs with ASLR disabled when necessary, I am also merging those patches.


Last modified on: January 26, 2023 by Maxim Konovalov