Skip to content

Commit

Permalink
update Linux clang toolchain
Browse files Browse the repository at this point in the history
* build in Docker image with Ubuntu 24.04 base
* include sanitizer libraries
  • Loading branch information
ParkMyCar committed Sep 8, 2024
1 parent a148408 commit ee2ec24
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion clang/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as base_image
FROM ubuntu:24.04 as base_image

# Tools needed to install bootsrap clang.
RUN apt-get update && apt-get install -y \
Expand Down
7 changes: 6 additions & 1 deletion clang/bin.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
clang*
clang
clang-$clang_major
clang-cl
clang-cpp
clang++
clang-tblgen
lld
ld.lld
ld64.lld
Expand Down
24 changes: 4 additions & 20 deletions clang/clang_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ clang_major_minor_version=$(echo "$clang_version" | cut -d. -f1-2)

cmake -G Ninja -S llvm -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$target_cpu_arg $target_arch_arg -flto=thin -pthread -fPIC -O3 -DNDEBUG" \
-DCMAKE_CXX_FLAGS="$target_cpu_arg $target_arch_arg -flto=thin -pthread -fPIC -O3 -DNDEBUG" \
-DCMAKE_C_FLAGS="-flto=thin -pthread -fPIC -O3 -DNDEBUG $target_cpu_arg $target_arch_arg" \
-DCMAKE_CXX_FLAGS="-flto=thin -pthread -fPIC -O3 -DNDEBUG $target_cpu_arg $target_arch_arg" \
-DCMAKE_SHARED_LINKER_FLAGS="-fPIC" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION="on" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \
Expand Down Expand Up @@ -99,21 +100,4 @@ cmake -G Ninja -S llvm -B build \

# Actually build Clang and friends.

CC="$c_binary" CXX="$cxx_binary" LD="$lld_binary" cmake --build build --target \
clang \
lld \
llvm-ar \
llvm-as \
llvm-cov \
llvm-dwp \
llvm-libtool-darwin \
llvm-nm \
llvm-objcopy \
llvm-objdump \
llvm-profdata \
llvm-strip \
llvm-ranlib \
cxx \
cxxabi \
unwind \
builtins
cmake --build build --target all
7 changes: 7 additions & 0 deletions clang/clang_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ case $build_arch in
exit 1
;;
esac

# These values are used in the `.txt` files that define what we package.
clang_target="$clang_arch-unknown-linux-gnu"
clang_major=$(echo "$clang_version" | cut -d '.' -f 1)

# Package the toolchain by copying everything listed from the following files:
#
Expand All @@ -51,6 +54,10 @@ mkdir package
mv llvm-project/build/include/$clang_target/c++/v1/__config_site llvm-project/build/include/c++/v1/__config_site

# Copy all of the files into the 'package' dir.
#
# TODO(parkmycar): The `lib` directory is a bit heavy and we could strip out a
# few unused `libcompiler_rt` libraries, but for now it's easier to just
# include them all.

for dir in bin include lib; do
mkdir package/$dir
Expand Down

0 comments on commit ee2ec24

Please sign in to comment.