@@ -26,11 +26,11 @@ if [ ! -z "$BOOT_TC" ]; then
26
26
export PATH=$BOOT_TC /bin:$PATH
27
27
export LD_LIBRARY_PATH=$BOOT_TC /lib/x86_64-unknown-linux-gnu
28
28
else
29
- export CC=" clang-16 "
30
- export CXX=" clang++-16 "
29
+ export CC=" clang-18 "
30
+ export CXX=" clang++-18 "
31
31
# use lld if found
32
32
/usr/bin/which " ld.lld" & > /dev/null && {
33
- EXTRA_ARGS+=" -DLLVM_USE_LINKER=lld-16 "
33
+ EXTRA_ARGS+=" -DLLVM_USE_LINKER=lld-18 "
34
34
EXTRA_ARGS+=" -DLLVM_ENABLE_LTO=thin "
35
35
}
36
36
fi
@@ -59,9 +59,9 @@ printf "#include <cstddef>\nint main(){return sizeof(size_t);}" \
59
59
exit 1
60
60
}
61
61
62
- CLANG_MAJOR=$( sed -n ' s/\s*set(LLVM_VERSION_MAJOR \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /llvm/CMakeLists.txt )
63
- CLANG_MINOR=$( sed -n ' s/\s*set(LLVM_VERSION_MINOR \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /llvm/CMakeLists.txt )
64
- CLANG_PATCH=$( sed -n ' s/\s*set(LLVM_VERSION_PATCH \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /llvm/CMakeLists.txt )
62
+ CLANG_MAJOR=$( sed -n ' s/\s*set(LLVM_VERSION_MAJOR \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /cmake/Modules/LLVMVersion.cmake )
63
+ CLANG_MINOR=$( sed -n ' s/\s*set(LLVM_VERSION_MINOR \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /cmake/Modules/LLVMVersion.cmake )
64
+ CLANG_PATCH=$( sed -n ' s/\s*set(LLVM_VERSION_PATCH \([0-9]\+\))/\1/p' $LLVM_SRC_PATH /cmake/Modules/LLVMVersion.cmake )
65
65
CLANG_VERSION=" $CLANG_MAJOR .$CLANG_MINOR .$CLANG_PATCH "
66
66
echo " Building CLANG_VERSION $CLANG_VERSION "
67
67
echo " Building CC $CC "
79
79
80
80
RUN_CMAKE_CONFIG_STEP=true
81
81
BUILD_RUNTIMES=true
82
- BUILD_LLVM=true
82
+ BUILD_LLVM=true
83
83
84
84
# rerunning cmake configure on existing build doesn't work too well
85
85
$RUN_CMAKE_CONFIG_STEP && $BUILD_RUNTIMES && rm -Rf " ${BUILDDIR_TOOLCHAIN} /runtimes"
@@ -89,7 +89,7 @@ $RUN_CMAKE_CONFIG_STEP && $BUILD_RUNTIMES && cmake -Wno-dev --warn-uninitialized
89
89
-B${BUILDDIR_TOOLCHAIN} /runtimes-memsan \
90
90
-GNinja \
91
91
-DCMAKE_BUILD_TYPE=Debug \
92
- -DLLVM_USE_SANITIZER=MemoryWithOrigins \
92
+ -DLLVM_USE_SANITIZER=MemoryWithOrigins \
93
93
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
94
94
-DCMAKE_INSTALL_PREFIX=" ${INSTALL_PREFIX} /runtimes-memsan" \
95
95
-DLLVM_DEFAULT_TARGET_TRIPLE=" x86_64-unknown-linux-gnu" \
@@ -100,6 +100,9 @@ $RUN_CMAKE_CONFIG_STEP && $BUILD_RUNTIMES && cmake -Wno-dev --warn-uninitialized
100
100
-DLLVM_ENABLE_RUNTIMES=" compiler-rt;libcxxabi;libcxx" \
101
101
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
102
102
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
103
+ -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
104
+ -DCOMPILER_RT_BUILD_BUILTINS=ON \
105
+ -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=FALSE \
103
106
-DLLVM_ENABLE_LIBCXX=ON \
104
107
-DLIBCXX_ABI_UNSTABLE=ON \
105
108
-DLIBCXX_ENABLE_SHARED=ON \
@@ -143,6 +146,9 @@ $RUN_CMAKE_CONFIG_STEP && $BUILD_RUNTIMES && cmake -Wno-dev --warn-uninitialized
143
146
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
144
147
-DLIBCXXABI_INCLUDE_TESTS=OFF \
145
148
-DLIBCXXABI_USE_COMPILER_RT=ON \
149
+ -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
150
+ -DCOMPILER_RT_BUILD_BUILTINS=ON \
151
+ -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=FALSE \
146
152
-DSANITIZER_CXX_ABI=libcxxabi \
147
153
-DLLVM_ENABLE_ASSERTIONS=OFF \
148
154
-DLLVM_INCLUDE_DOCS=OFF \
@@ -167,7 +173,7 @@ $RUN_CMAKE_CONFIG_STEP && $BUILD_LLVM && cmake -Wno-dev --warn-uninitialized \
167
173
-DLLVM_HOST_TRIPLE=" x86_64-unknown-linux-gnu" \
168
174
-DCMAKE_C_COMPILER_TARGET=" x86_64-unknown-linux-gnu" \
169
175
-DCMAKE_CXX_COMPILER_TARGET=" x86_64-unknown-linux-gnu" \
170
- -DCLANG_RESOURCE_DIR=" ../ " \
176
+ -DCLANG_RESOURCE_DIR=" " \
171
177
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
172
178
-DLLVM_ENABLE_PROJECTS=" clang;lld;lldb;clang-tools-extra" \
173
179
-DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF \
@@ -195,24 +201,28 @@ $RUN_CMAKE_CONFIG_STEP && $BUILD_LLVM && cmake -Wno-dev --warn-uninitialized \
195
201
$BUILD_LLVM && cmake --build " ${BUILDDIR_TOOLCHAIN} /toolchain" --parallel 6 --target llvm-tblgen
196
202
$BUILD_LLVM && cmake --build " ${BUILDDIR_TOOLCHAIN} /toolchain" --parallel 9 --target install/strip
197
203
198
- cd $INSTALL_PREFIX
199
- # There is no way to configure the install directory for these headers
200
- # so we move them manully
201
- if [ $BUILD_LLVM ] && [ -d " lib/clang/$CLANG_VERSION /include" ]; then
202
- rsync -va lib/clang/$CLANG_VERSION /include/ include/
203
- rm -Rf lib/clang
204
- fi
205
- if [ $BUILD_LLVM ] && [ -d " lib/clang/$CLANG_MAJOR /include" ]; then
206
- rsync -va lib/clang/$CLANG_MAJOR /include/ include/
207
- rm -Rf lib/clang
204
+ # the install prefix for the compiler-rt builtin .a files is not correct
205
+ # fix it manually for now
206
+ if [ -d " ${INSTALL_PREFIX} /lib/clang/19" ]; then
207
+ pushd " ${INSTALL_PREFIX} /lib/clang/19"
208
+ if [ ! -d lib ]; then
209
+ mkdir lib
210
+ pushd lib
211
+ ln -s ../../../x86_64-unknown-linux-gnu
212
+ popd
213
+ fi
214
+ popd
208
215
fi
209
216
210
- # Now use the newly built libs for the compiler itself.
211
- # They are ABI compatible if this is a stage 2 build
212
- # cd lib
213
- # # rm libc++*
214
- # # rm libunwind*
215
- # rsync -va $BOOT_TC/lib/x86_64-unknown-linux-gnu/libc++.so.2 .
216
- # rsync -va $BOOT_TC/lib/x86_64-unknown-linux-gnu/libc++abi.so.1
217
- # cd ..
218
- # cd ..
217
+ # steal the local runtimes and provide them for packaging, what is the worst that could happen?
218
+ # in theory this should work
219
+ cp /lib/x86_64-linux-gnu/libc++abi.so.1 /build/llvm/llvm-linux-x86_64/lib && \
220
+ cp /lib/x86_64-linux-gnu/libc++.so.1 /build/llvm/llvm-linux-x86_64/lib && \
221
+ cp /lib/x86_64-linux-gnu/libunwind.so.1 /build/llvm/llvm-linux-x86_64/lib
222
+
223
+ cp /lib/x86_64-linux-gnu/libncurses.so.6 /build/llvm/llvm-linux-x86_64/lib && \
224
+ cp /lib/x86_64-linux-gnu/libform.so.6 /build/llvm/llvm-linux-x86_64/lib && \
225
+ cp /lib/x86_64-linux-gnu/libtinfo.so.6 /build/llvm/llvm-linux-x86_64/lib && \
226
+ cp /lib/x86_64-linux-gnu/libpanel.so.6 /build/llvm/llvm-linux-x86_64/lib
227
+
228
+ tar -cjSf toolchain.bz2 --transform " s%^llvm-linux-x86_64%llvm-clang-${CLANG_VERSION} -ubuntu-22.04-x86_64%" llvm-linux-x86_64
0 commit comments