Skip to content

Commit 8b086e3

Browse files
authored
Link against installed libc++/libc++abi when bootstrapping
The build tree layout does not necessarily match a valid libc++ installation tree, so install libc++/libc++abi first. This is needed for llvm/llvm-project#115379 Reviewed By: vitalybuka Pull Request: #299
1 parent 26a33cd commit 8b086e3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

zorg/buildbot/builders/sanitizers/buildbot_functions.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function rm_dirs {
8888
function cleanup() {
8989
[[ -v BUILDBOT_BUILDERNAME ]] || return 0
9090
echo @@@BUILD_STEP cleanup@@@
91-
rm_dirs llvm_build2_* llvm_build_* libcxx_build_* compiler_rt_build* symbolizer_build* $@
91+
rm_dirs llvm_build2_* llvm_build_* libcxx_build_* libcxx_install_* compiler_rt_build* symbolizer_build* "$@"
9292
if ccache -s >/dev/null ; then
9393
rm_dirs llvm_build64
9494
fi
@@ -228,6 +228,7 @@ function build_stage2 {
228228
echo @@@BUILD_STEP stage2/$sanitizer_name build libcxx@@@
229229

230230
local libcxx_build_dir=libcxx_build_${sanitizer_name}
231+
local libcxx_install_dir=libcxx_install_${sanitizer_name}
231232
local build_dir=llvm_build_${sanitizer_name}
232233
export STAGE2_DIR=${build_dir}
233234
local cmake_libcxx_cflags=
@@ -283,18 +284,22 @@ function build_stage2 {
283284
(cd ${libcxx_build_dir} && \
284285
cmake \
285286
${cmake_stage2_common_options} \
287+
-DCMAKE_INSTALL_PREFIX="${ROOT}/${libcxx_install_dir}" \
286288
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
287289
-DLIBCXX_TEST_PARAMS='long_tests=False' \
288290
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
289291
-DLLVM_USE_SANITIZER=${llvm_use_sanitizer} \
290292
-DCMAKE_C_FLAGS="${fsanitize_flag} ${cmake_libcxx_cflags} ${fno_sanitize_flag}" \
291293
-DCMAKE_CXX_FLAGS="${fsanitize_flag} ${cmake_libcxx_cflags} ${fno_sanitize_flag}" \
292294
$LLVM/../runtimes && \
293-
ninja cxx cxxabi) || build_failure
295+
ninja cxx cxxabi && ninja install-cxx install-cxxabi) || build_failure
296+
297+
local libcxx_so_path="$(find "${ROOT}/${libcxx_install_dir}" -name libc++.so)"
298+
test -f "${libcxx_so_path}" || build_failure
299+
local libcxx_runtime_path=$(dirname "${libcxx_so_path}")
294300

295-
local libcxx_runtime_path=$(dirname $(find ${ROOT}/${libcxx_build_dir} -name libc++.so))
296301
local sanitizer_ldflags="-Wl,--rpath=${libcxx_runtime_path} -L${libcxx_runtime_path}"
297-
local sanitizer_cflags="-nostdinc++ -isystem ${ROOT}/${libcxx_build_dir}/include -isystem ${ROOT}/${libcxx_build_dir}/include/c++/v1 $fsanitize_flag"
302+
local sanitizer_cflags="-nostdinc++ -isystem ${ROOT}/${libcxx_install_dir}/include -isystem ${ROOT}/${libcxx_install_dir}/include/c++/v1 $fsanitize_flag"
298303

299304
echo @@@BUILD_STEP stage2/$sanitizer_name build@@@
300305

0 commit comments

Comments
 (0)