Skip to content

Commit

Permalink
Build toolchain with PIC
Browse files Browse the repository at this point in the history
This will be required for eld.

Some of the cross-built toolchains fail, because a limitation with zig's
use of libclang.  They fail with `error: unsupported linker arg: -Bsymbolic-functions`.
Bypassing that failure by disabling the clang-shlib results in a link
failure (see below).  So for now we'll just use non-PIC for the
toolchain targets that fail.

```
LLD Link... ld.lld: error: attempted static link of dynamic object lib/libclang.so.20.1.0-rc3
```

Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
  • Loading branch information
androm3da committed Feb 28, 2025
1 parent b077f7e commit 815919b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set -x

build_llvm_clang_cross() {
triple=${1}
pic=${2-OFF}
cd ${BASE}

EXTRA=""
Expand All @@ -36,7 +37,7 @@ build_llvm_clang_cross() {
-DLLVM_TOOL_DSYMUTIL_BUILD:BOOL=OFF \
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
-DLLVM_ENABLE_PIC:BOOL=OFF \
-DLLVM_ENABLE_PIC:BOOL=${pic} \
-DLLVM_NATIVE_TOOL_DIR=${PWD}/obj_llvm/bin \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_CROSSCOMPILING:BOOL=ON \
Expand Down Expand Up @@ -69,7 +70,7 @@ build_llvm_clang() {
-DLLVM_ENABLE_LIBCXX:BOOL=ON \
-DLLVM_ENABLE_TERMINFO:BOOL=OFF \
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON \
-DLLVM_ENABLE_PIC:BOOL=OFF \
-DLLVM_ENABLE_PIC:BOOL=ON \
-C ./llvm-project/clang/cmake/caches/hexagon-unknown-linux-musl-clang.cmake \
-C ./llvm-project/clang/cmake/caches/hexagon-unknown-linux-musl-clang-cross.cmake \
-B ./obj_llvm \
Expand Down Expand Up @@ -322,12 +323,17 @@ python3.8 --version

build_llvm_clang

CROSS_TRIPLES="aarch64-windows-gnu x86_64-windows-gnu x86_64-linux-musl aarch64-linux-gnu aarch64-macos"
CROSS_TRIPLES="aarch64-windows-gnu x86_64-windows-gnu x86_64-linux-musl aarch64-linux-gnu"
#CROSS_TRIPLES="x86_64-linux-musl aarch64-linux-gnu aarch64-macos"
CROSS_TRIPLES="x86_64-linux-musl aarch64-linux-musl"
CROSS_TRIPLES_PIC="aarch64-windows-gnu x86_64-windows-gnu"
for t in ${CROSS_TRIPLES}
do
build_llvm_clang_cross ${t}
done
for t in ${CROSS_TRIPLES_PIC}
do
build_llvm_clang_cross ${t} ON
done
ccache --show-stats
config_kernel
build_kernel_headers
Expand Down

0 comments on commit 815919b

Please sign in to comment.