From d4b5c1ecd8a5dbcb65eb5fd9738f47c7dba9f361 Mon Sep 17 00:00:00 2001 From: Alice Ziuziakowska Date: Tue, 18 Nov 2025 15:54:14 +0000 Subject: [PATCH 1/4] Remove crosstool-ng version information from LLVM toolchain build Signed-off-by: Alice Ziuziakowska --- build-clang-with-args.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build-clang-with-args.sh b/build-clang-with-args.sh index e3abfba..e4f088e 100755 --- a/build-clang-with-args.sh +++ b/build-clang-with-args.sh @@ -167,7 +167,6 @@ ls -l "${dist_dir}" # Write out build info set +o pipefail # head causes pipe failures, so we have to switch off pipefail while we use it. -ct_ng_version_string="$( (set +o pipefail; ct-ng version | head -n1) )" clang_version_string="$("${dist_dir}/bin/clang" --version | head -n1)" build_date="$(date -u)" set -o pipefail @@ -182,10 +181,6 @@ Clang version: ${clang_version_string} (git: ${LLVM_URL} ${LLVM_VERSION}) -Crosstool-ng version: - ${ct_ng_version_string} - (git: ${CROSSTOOL_NG_URL} ${CROSSTOOL_NG_VERSION}) - C Flags: -march=${march} -mabi=${mabi} -mcmodel=${mcmodel} From 5c815c45d885a6e1336020a28e51a14975dd9a5d Mon Sep 17 00:00:00 2001 From: Alice Ziuziakowska Date: Tue, 18 Nov 2025 16:36:03 +0000 Subject: [PATCH 2/4] Rename `LLVM_VERSION` to `LLVM_COMMIT` For consistency with Binutils. Signed-off-by: Alice Ziuziakowska --- build-clang-with-args.sh | 6 +++--- sw-versions.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) mode change 100755 => 100644 build-clang-with-args.sh diff --git a/build-clang-with-args.sh b/build-clang-with-args.sh old mode 100755 new mode 100644 index e4f088e..5184a4d --- a/build-clang-with-args.sh +++ b/build-clang-with-args.sh @@ -86,7 +86,7 @@ if [ ! -d "$llvm_dir" ]; then fi cd "${llvm_dir}" git fetch origin -git checkout --force "${LLVM_VERSION}" +git checkout --force "${LLVM_COMMIT}" # Clang Symlinks clang_links_to_create="clang++" @@ -179,7 +179,7 @@ lowRISC toolchain version: ${tag_name} Clang version: ${clang_version_string} - (git: ${LLVM_URL} ${LLVM_VERSION}) + (git: ${LLVM_URL} ${LLVM_COMMIT}) C Flags: -march=${march} -mabi=${mabi} -mcmodel=${mcmodel} @@ -194,7 +194,7 @@ tee "${dist_dir}/buildinfo.json" < Date: Tue, 18 Nov 2025 15:53:44 +0000 Subject: [PATCH 3/4] Build LLVM toolchain with lld in container Signed-off-by: Alice Ziuziakowska --- build-clang-with-args.sh | 1 + prepare-host.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build-clang-with-args.sh b/build-clang-with-args.sh index 5184a4d..3de267d 100644 --- a/build-clang-with-args.sh +++ b/build-clang-with-args.sh @@ -142,6 +142,7 @@ cmake "${llvm_dir}/llvm" \ -DLLVM_ENABLE_BACKTRACES=Off \ -DLLVM_DEFAULT_TARGET_TRIPLE="${toolchain_target}" \ -DLLVM_STATIC_LINK_CXX_STDLIB=On \ + -DLLVM_USE_LINKER="lld" \ -DCLANG_VENDOR="lowRISC" \ -DBUG_REPORT_URL="toolchains@lowrisc.org" \ -DLLVM_INCLUDE_EXAMPLES=Off \ diff --git a/prepare-host.sh b/prepare-host.sh index 048f365..84bf23b 100755 --- a/prepare-host.sh +++ b/prepare-host.sh @@ -31,4 +31,5 @@ dnf install -y \ zlib-devel \ zlib-static \ libffi-devel \ - expat-static + expat-static \ + lld From e838cd1145fa3096297837f235f5903c6f436e19 Mon Sep 17 00:00:00 2001 From: Alice Ziuziakowska Date: Tue, 18 Nov 2025 15:56:33 +0000 Subject: [PATCH 4/4] Build LLVM toolchain with Ninja We need to build our own Ninja as the version in the almalinux-8 repository is too old and causes the following errors: ninja : error : multiple outputs aren't (yet?) supported by depslog; bring this up on the mailing list if it affects you This was fixed in Ninja v1.10. Signed-off-by: Alice Ziuziakowska --- build-clang-with-args.sh | 1 + prepare-host.sh | 10 ++++++++++ 2 files changed, 11 insertions(+) mode change 100644 => 100755 build-clang-with-args.sh diff --git a/build-clang-with-args.sh b/build-clang-with-args.sh old mode 100644 new mode 100755 index 3de267d..8258b99 --- a/build-clang-with-args.sh +++ b/build-clang-with-args.sh @@ -135,6 +135,7 @@ llvm_distribution_components+=";${llvm_tools}" cmake "${llvm_dir}/llvm" \ -Wno-dev \ + -GNinja \ -DCMAKE_BUILD_TYPE="${build_type}" \ -DCMAKE_INSTALL_PREFIX="${dist_dir}" \ -DLLVM_TARGETS_TO_BUILD="RISCV" \ diff --git a/prepare-host.sh b/prepare-host.sh index 84bf23b..83fc9d9 100755 --- a/prepare-host.sh +++ b/prepare-host.sh @@ -33,3 +33,13 @@ dnf install -y \ libffi-devel \ expat-static \ lld + +# the version of ninja in almalinux-8 is too old - +# we need at least version v1.10, so just build it ourselves +TMP_DIR="$(mktemp -d)" +git clone https://github.com/ninja-build/ninja.git \ + --branch v1.12.0 --depth 1 "${TMP_DIR}" +cd "${TMP_DIR}" +./configure.py --bootstrap +install ninja /bin +rm -rf "{$TMP_DIR}"