Date: Tue, 11 Apr 2023 13:21:00 UTC
On Mon, 5 Jul 2021 at 11:09, Ed Maste <firstname.lastname@example.org> wrote: > > FreeBSD migrated from GNU binutils to versions from ELF Tool Chain, > starting in 2014. At that time there were no usable LLVM versions of > those tools, but they have been developing rapidly since then. Now I > think it may be prudent to migrate to the LLVM tools where they exist, > for both functionality and maintainability reasons. Functionality arguments still stand, but ELF Tool Chain's maintainability situation has likely improved in the time since I wrote the original email. > I'd like to allow 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. ... > Potential next steps are: > - Introduce new build knob Alex introduced WITH_LLVM_BINUTILS in 021385aba562. > - Iterate on exp-runs and call for testing The exp-run is open in 258872. Perl initially failed to build, which caused thousands of ports to be skipped. That issue was fixed by markj in 27f35b7dd418. The next issue is both tcl86 and postgresql13-client failing to build, resulting in a little over 5000 skipped ports. The error is of the form: strip: error: 'libtclstub86.a': not stripping symbol '.L.str.1' because it is named in a relocation tcl's build is requesting to discard all non-global symbols (-x) but has a local symbol referenced by a relocation entry. Both ELF Tool Chain and GNU strip leave the symbol intact in this case, and llvm-strip likely needs to do the same. There's an LLVM ticket for this open at https://github.com/llvm/llvm-project/issues/47468. When switching to LLVM's lld linker we introduced an LLD_UNSAFE tag which had the port fall back to using GNU ld. As a short term workaround for LLVM strip issues we could use a similar approach here. However, it looks like ports USE_BINUTILS infrastructure does not currently override strip, and that would first need to be fixed. See PR270663. > - Switch to LLVM tools by default Given the open ports issues we are not yet ready to entertain this change, and I am not sure there's enough time in advance of FreeBSD 14 to do so.