diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-06 12:29:03 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-12 15:12:01 +0200 |
commit | c95662f87825174b359217479b46efd567c0318d (patch) | |
tree | 939a287c1a34f3443979c75fad7df280279860df | |
parent | 172c29862c2bad21fff84e2798cc3fd16822ec57 (diff) | |
download | bootstrappable-toolchain-c95662f87825174b359217479b46efd567c0318d.tar.gz |
clang: Support providing lld linker in toolchain
Add new TOOLCHAIN_CONFIG flag that enables the lld project in the
built toolchain.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/compilers/clang-16-native.TARGETS | 12 | ||||
-rw-r--r-- | src/compilers/clang-17-native.TARGETS | 12 | ||||
-rw-r--r-- | src/compilers/clang-18-native.TARGETS | 52 | ||||
-rw-r--r-- | src/compilers/clang-19-native.TARGETS | 52 | ||||
-rw-r--r-- | src/compilers/clang-20-native.TARGETS | 47 |
6 files changed, 160 insertions, 17 deletions
@@ -195,6 +195,8 @@ Fields for building the toolchains: `clang-tidy`. Additionally, Clang versions `18` and newer will also include the *external project* [Include What You Use](https://github.com/include-what-you-use/include-what-you-use). +- `INCLUDE_LLD`: + For `clang` toolchains, add the LLD linker to toolchain. (default: `false`) Fields for using the toolchains (within [Justbuild](https://github.com/just-buildsystem/justbuild) projects): diff --git a/src/compilers/clang-16-native.TARGETS b/src/compilers/clang-16-native.TARGETS index e19e4de..0cf9e65 100644 --- a/src/compilers/clang-16-native.TARGETS +++ b/src/compilers/clang-16-native.TARGETS @@ -170,6 +170,18 @@ } , "then": ["clang-tools-extra"] } + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LLD" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["lld"] + } ] } } diff --git a/src/compilers/clang-17-native.TARGETS b/src/compilers/clang-17-native.TARGETS index 78b2bd4..3f0837f 100644 --- a/src/compilers/clang-17-native.TARGETS +++ b/src/compilers/clang-17-native.TARGETS @@ -170,6 +170,18 @@ } , "then": ["clang-tools-extra"] } + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LLD" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["lld"] + } ] } } diff --git a/src/compilers/clang-18-native.TARGETS b/src/compilers/clang-18-native.TARGETS index 3a75343..4860702 100644 --- a/src/compilers/clang-18-native.TARGETS +++ b/src/compilers/clang-18-native.TARGETS @@ -65,10 +65,7 @@ { "type": ["@", "rules", "CC/foreign/shell", "data"] , "arguments_config": ["TOOLCHAIN_CONFIG"] , "project": ["patched_sources"] - , "localbase": - [ "binutils_dir" - , ["@", "iwyu", "", "sources"] - ] + , "localbase": ["binutils_dir", ["@", "iwyu", "", "sources"]] , "cmds": [ { "type": "join" , "$1": @@ -154,6 +151,48 @@ , "-DLLVM_INCLUDE_DOCS=OFF" , "-DLLVM_INCLUDE_TESTS=OFF" , "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" + , { "type": "join" + , "$1": + [ "-DLLVM_ENABLE_PROJECTS=" + , { "type": "join_cmd" + , "$1": + [ { "type": "join" + , "separator": ";" + , "$1": + { "type": "++" + , "$1": + [ ["clang"] + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LINTER" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["clang-tools-extra"] + } + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LLD" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["lld"] + } + ] + } + } + ] + } + ] + } , { "type": "if" , "cond": { "type": "lookup" @@ -168,12 +207,11 @@ { "type": "join" , "separator": " " , "$1": - [ "-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra'" - , "-DLLVM_EXTERNAL_PROJECTS=iwyu" + [ "-DLLVM_EXTERNAL_PROJECTS=iwyu" , "-DLLVM_EXTERNAL_IWYU_SOURCE_DIR=${LOCALBASE}/iwyu" ] } - , "else": "-DLLVM_ENABLE_PROJECTS=clang" + , "else": "" } , "-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind'" , "-DLLVM_TARGETS_TO_BUILD=X86" diff --git a/src/compilers/clang-19-native.TARGETS b/src/compilers/clang-19-native.TARGETS index 6ab96c3..652d329 100644 --- a/src/compilers/clang-19-native.TARGETS +++ b/src/compilers/clang-19-native.TARGETS @@ -65,10 +65,7 @@ { "type": ["@", "rules", "CC/foreign/shell", "data"] , "arguments_config": ["TOOLCHAIN_CONFIG"] , "project": ["patched_sources"] - , "localbase": - [ "binutils_dir" - , ["@", "iwyu", "", "sources"] - ] + , "localbase": ["binutils_dir", ["@", "iwyu", "", "sources"]] , "cmds": [ { "type": "join" , "$1": @@ -154,6 +151,48 @@ , "-DLLVM_INCLUDE_DOCS=OFF" , "-DLLVM_INCLUDE_TESTS=OFF" , "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" + , { "type": "join" + , "$1": + [ "-DLLVM_ENABLE_PROJECTS=" + , { "type": "join_cmd" + , "$1": + [ { "type": "join" + , "separator": ";" + , "$1": + { "type": "++" + , "$1": + [ ["clang"] + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LINTER" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["clang-tools-extra"] + } + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LLD" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["lld"] + } + ] + } + } + ] + } + ] + } , { "type": "if" , "cond": { "type": "lookup" @@ -168,12 +207,11 @@ { "type": "join" , "separator": " " , "$1": - [ "-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra'" - , "-DLLVM_EXTERNAL_PROJECTS=iwyu" + [ "-DLLVM_EXTERNAL_PROJECTS=iwyu" , "-DLLVM_EXTERNAL_IWYU_SOURCE_DIR=${LOCALBASE}/iwyu" ] } - , "else": "-DLLVM_ENABLE_PROJECTS=clang" + , "else": "" } , "-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind'" , "-DLLVM_TARGETS_TO_BUILD=X86" diff --git a/src/compilers/clang-20-native.TARGETS b/src/compilers/clang-20-native.TARGETS index 047f7c8..f7c6c3c 100644 --- a/src/compilers/clang-20-native.TARGETS +++ b/src/compilers/clang-20-native.TARGETS @@ -151,6 +151,48 @@ , "-DLLVM_INCLUDE_DOCS=OFF" , "-DLLVM_INCLUDE_TESTS=OFF" , "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" + , { "type": "join" + , "$1": + [ "-DLLVM_ENABLE_PROJECTS=" + , { "type": "join_cmd" + , "$1": + [ { "type": "join" + , "separator": ";" + , "$1": + { "type": "++" + , "$1": + [ ["clang"] + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LINTER" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["clang-tools-extra"] + } + , { "type": "if" + , "cond": + { "type": "lookup" + , "key": "INCLUDE_LLD" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + } + , "then": ["lld"] + } + ] + } + } + ] + } + ] + } , { "type": "if" , "cond": { "type": "lookup" @@ -165,12 +207,11 @@ { "type": "join" , "separator": " " , "$1": - [ "-DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra'" - , "-DLLVM_EXTERNAL_PROJECTS=iwyu" + [ "-DLLVM_EXTERNAL_PROJECTS=iwyu" , "-DLLVM_EXTERNAL_IWYU_SOURCE_DIR=${LOCALBASE}/iwyu" ] } - , "else": "-DLLVM_ENABLE_PROJECTS=clang" + , "else": "" } , "-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind'" , "-DLLVM_TARGETS_TO_BUILD=X86" |