December 4, 2018
Tool Chain Improvements
An ongoing project in FreeBSD is the migration to a permissively licensed, modern tool chain. The Foundation has sponsored portions of this work over the last several years, and is now helping form a plan to address the collection of outstanding issues scattered across a number of areas. A tracking PR is open to identify all of the individual issues as dependencies.
The main issues we are working to address in time for FreeBSD 13 include:
LLVM’s linker, lld
We’ve made a significant investment in migrating to LLVM’s lld linker for amd64, arm64, and arm7 in preparation for FreeBSD 12.0. Additional work in the ports collection is needed before i386 can also be migrated, but is on track for resolution in the next month or two.
Beyond that we will spend some additional time improving lld on FreeBSD for MIPS, Power/PowerPC, and RISC-V.
The migration to a modern linker will enable several other improvements, including Link-Time Optimization (LTO) and Clang’s Control Flow Integrity (CFI).
FreeBSD currently relies on an outdated GNU assembler to assemble a small number of files on a few architectures. These cases are being reworked to use Clang’s Integrated Assembler (IAS) instead, facilitating the retirement of the GNU assembler (as).
Other Binary Utilities
On FreeBSD, most of the tools historically provided by GNU binutils are now from the ELF Tool Chain project. One tool not available from ELF Tool Chain is objdump, but the LLVM project has an llvm-objdump that is similar to GNU objdump. We’ve been working to identify shortcomings in that tool and coordinating with others in the LLVM community to allow it to function as a replacement.
In order to facilitate LTO some tools (at least “ar” and “nm”) need to gain support for the symbol format used by LLVM bitcode. There are two ways to accomplish this: we can migrate to the LLVM version of these tools, or enhance the ELF Tool Chain ones with support for LLVM bitcode. Most likely we will pursue both options.
Other ELF Tool Chain tools will receive bug fixes and functionality improvements.
Today LLVM’s libunwind library is used for stack unwinding on arm64, 32- and 64-bit x86, RISC-V, and MIPS. Some work is needed to enable support for 32-bit arm, as well as Power.
— contributed by Ed Maste