Enable LLVM_BINUTILS by default

Starting in 2014 FreeBSD migrated from GNU binutils to ELF Tool Chain
tools.  At that time there were no usable LLVM versions of those tools,
but they have been developing rapidly since then.  Migrate to LLVML's
tools for both functionality and maintainability reasons.

This will eventually support the use of link-time optimization (LTO) in
the FreeBSD base system.  LTO runs optimization passes over the entire
executable (or library) at link time and thus allows for more effective
optimization than when performed on individual compilation units.

When using LTO object files (.o) including those contained in static
library archives (.a) contain LLVM IR bitcode rather than target
object code.  This means that utilities that operate on object files
need to support LLVM IR.

As with ELF Tool Chain the LLVM tools aim for command line and output
format compatibility with GNU binutils, although there are a few minor
differences.  Where these cause a material issue (breaking a port or
eliminating required functionality) we can submit LLVM bugs and work
on patches.

PR:		258872 (exp-run)
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49361
This commit is contained in:
Ed Maste 2021-07-12 15:32:00 -04:00
parent 4a4eee5533
commit 1cae7121c6
3 changed files with 18 additions and 5 deletions

View file

@ -27,6 +27,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW:
world, or to merely disable the most expensive debugging functionality
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20250314:
We now use LLVM's binary utilities (nm, objcopy, etc.) by default.
The WITHOUT_LLVM_BINUTILS src.conf(5) knob can be used to revert to
ELF Tool Chain tools if desired.
20250303:
Commit 4a77657cbc01 changed the ABI between ipfw(8) and ipfw(4).
Please note that the old ipfw(8) binary will not work with the new

View file

@ -1,5 +1,5 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.Dd January 31, 2025
.Dd March 14, 2025
.Dt SRC.CONF 5
.Os
.Sh NAME
@ -933,9 +933,8 @@ the build.
To be able to build the system an alternate linker must be provided via XLD.
.It Va WITHOUT_LLVM_ASSERTIONS
Disable debugging assertions in LLVM.
.It Va WITH_LLVM_BINUTILS
Install LLVM's binutils (without an llvm- prefix),
instead of ELF Tool Chain's tools.
.It Va WITHOUT_LLVM_BINUTILS
Install ELF Tool Chain's binary utilities instead of LLVM's.
This includes
.Xr addr2line 1 ,
.Xr ar 1 ,
@ -1762,6 +1761,15 @@ When set, it enforces these options:
.It
.Va WITHOUT_LLVM_COV
.El
.Pp
When set, these options are also in effect:
.Pp
.Bl -inset -compact
.It Va WITHOUT_LLVM_BINUTILS
(unless
.Va WITH_LLVM_BINUTILS
is set explicitly)
.El
.It Va WITH_UBSAN
Build the base system with Undefined Behavior Sanitizer (UBSan) to detect
various kinds of undefined behavior at runtime.

View file

@ -124,6 +124,7 @@ __DEFAULT_YES_OPTIONS = \
LLD \
LLD_BOOTSTRAP \
LLVM_ASSERTIONS \
LLVM_BINUTILS \
LLVM_COV \
LLVM_CXXFILT \
LOADER_BIOS_TEXTONLY \
@ -208,7 +209,6 @@ __DEFAULT_NO_OPTIONS = \
HESIOD \
LOADER_VERBOSE \
LOADER_VERIEXEC_PASS_MANIFEST \
LLVM_BINUTILS \
LLVM_FULL_DEBUGINFO \
MALLOC_PRODUCTION \
OFED_EXTRA \