Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,43 @@ build_clang_rt_builtins() {
cmake --build ./obj_clang_rt -- -v install-builtins
}

build_clang_rt_builtins_baremetal() {
cd ${BASE}/llvm-project/

PATH=${TOOLCHAIN_BIN}:${PATH} \
cmake -G Ninja \
-DCMAKE_C_COMPILER:STRING=`which clang` \
-DCMAKE_CXX_COMPILER:STRING=`which clang++` \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_CMAKE_DIR:PATH=$TOOLCHAIN_INSTALL \
-DCMAKE_INSTALL_PREFIX:PATH=$($TOOLCHAIN_INSTALL/bin/clang -print-resource-dir) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - my mistake -- I said elsewhere that the triple is used, but that's not quite right. The C library gets installed to target/${normalized-triple}/ but you're right that the builtins get installed here. Hmm -- will this one conflict with the builtins for linux?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quic-k or @quic-akaryaki are you planning to make changes to the compiler driver to support this?

-DCMAKE_ASM_FLAGS="-G0 -mlong-calls -fno-pic" \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
-DLLVM_TARGET_TRIPLE=hexagon-unknown-unknown-elf \
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=hexagon-unknown-unknown-elf \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_BUILD_PROFILE=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
-DCOMPILER_RT_BUILD_ORC=OFF \
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
-DCOMPILER_RT_BUILTINS_ENABLE_PIC=OFF \
-DCOMPILER_RT_SUPPORTED_ARCH=hexagon \
-DCOMPILER_RT_BAREMETAL_BUILD=ON \
Comment on lines +165 to +174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these belong in a cmake cache file.

Can you contribute them -- ideally to the llvm-project monorepo? Adding cmake cache files like this is noncontroversial and is just a mechanism to publicize our build configuration for other developers. This makes use cases for LLVM toolchain builds clear to people who want to understand how the toolchain is used -- for example, when making changes to cmake functions/modules.

-DCMAKE_C_FLAGS="-ffreestanding" \
-DCMAKE_CXX_FLAGS="-ffreestanding" \
-DCMAKE_CROSSCOMPILING=ON \
-DCAN_TARGET_hexagon=1 \
-DCMAKE_C_COMPILER_FORCED=ON \
-DCMAKE_CXX_COMPILER_FORCED=ON \
-DCMAKE_C_COMPILER_TARGET=hexagon-unknown-unknown-elf \
-DCMAKE_CXX_COMPILER_TARGET=hexagon-unknown-unknown-elf \
-B hexagon-builtins/ \
-S compiler-rt/
cmake --build ./hexagon-builtins -- -v install-builtins
}

config_kernel() {
cd ${BASE}
Expand Down Expand Up @@ -385,6 +421,7 @@ config_kernel
build_kernel_headers
build_musl_headers
build_clang_rt_builtins
build_clang_rt_builtins_baremetal
build_musl

build_libs
Expand Down
Loading