mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-24 23:16:42 +00:00
f9ab04b63a
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>
39 lines
1.1 KiB
Bash
39 lines
1.1 KiB
Bash
# Build script for the mold linker
|
|
|
|
do_linker_mold_get() {
|
|
CT_Fetch MOLD
|
|
}
|
|
|
|
do_linker_mold_extract() {
|
|
CT_ExtractPatch MOLD
|
|
}
|
|
|
|
do_linker_mold_build() {
|
|
local target_dir="${CT_PREFIX_DIR}/${CT_TARGET}"
|
|
|
|
CT_DoStep INFO "Installing mold for host"
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mold"
|
|
|
|
CT_DoLog EXTRA "Configuring mold for host"
|
|
CT_DoExecLog CFG \
|
|
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
|
LDFLAGS="${CT_LDFLAGS_FOR_HOST}" \
|
|
cmake "${CT_SRC_DIR}/mold" \
|
|
-DBUILD_TESTING=OFF \
|
|
-DMOLD_MOSTLY_STATIC=ON \
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
|
|
CT_DoLog EXTRA "Building mold for host"
|
|
CT_DoExecLog ALL make ${CT_JOBSFLAGS}
|
|
|
|
CT_DoLog EXTRA "Installing mold for host"
|
|
mkdir -p "${target_dir}/bin"
|
|
cp mold "${target_dir}/bin"
|
|
ln -s mold "${target_dir}/bin/ld.mold"
|
|
mkdir -p "${target_dir}/lib/mold"
|
|
cp mold-wrapper.so "${target_dir}/lib/mold"
|
|
|
|
CT_Popd
|
|
CT_EndStep
|
|
}
|