crosstool-ng/scripts/build/linker.sh
Arnaud Vrac f9ab04b63a Add mold linker build
Allows building the #mold linker, which can then be used in the
cross-toolchain by passing the -fuse-ld=mold to the gcc flags. It is
much faster than ld or gold.

This requires a C++20 compiler and cmake.

Initially implemented by Arnaud, and HC added configure check for cmake.

Outstanding task to validate compiler is C++20 compatible.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Signed-off-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
2024-06-05 19:31:45 +12:00

39 lines
815 B
Bash

# Wrapper to build the standalone linkers
# List all linkers, and parse their scripts
CT_LINKER_LIST=
for f in "${CT_LIB_DIR}/scripts/build/linker/"*.sh; do
_f="$(basename "${f}" .sh)"
_f="${_f#???-}"
__f="CT_LINKER_${_f^^}"
if [ "${!__f}" = "y" ]; then
CT_DoLog DEBUG "Enabling linker '${_f}'"
. "${f}"
CT_LINKER_LIST="${CT_LINKER_LIST} ${_f}"
else
CT_DoLog DEBUG "Disabling linker '${_f}'"
fi
done
# Download the linkers
do_linker_get() {
for f in ${CT_LINKER_LIST}; do
do_linker_${f}_get
done
}
# Extract and patch the linkers
do_linker_extract() {
for f in ${CT_LINKER_LIST}; do
do_linker_${f}_extract
done
}
# Build the linkers
do_linker() {
for f in ${CT_LINKER_LIST}; do
do_linker_${f}_build
done
}