fune/taskcluster/scripts/misc/build-libunwind.sh
Mike Hommey a6287b9ca6 Bug 1823837 - Move the location of libunwind in the clang toolchain. r=firefox-build-system-reviewers,ahochheiden
Before clang 16, the libunwind install only contained the libunwind.a
library. Since clang 16, however, it also contains header files,
including a unwind.h file that conflicts with the unwind.h file that
is also shipped alongside compiler-rt.

When building clang itself with compiler-rt and libunwind (i.e. not
building everything separately like we do), however, that's not a
problem because it puts libunwind in a different directory than
compiler-rt.

So we change the clang repacking to follow a similar convention.

But because clang doesn't look for libraries under clang/lib/$arch, but
looks under clang/lib/$target instead, we also need to enable per-target
directories for libunwind.

But because clang also looks for libraries under clang/lib/$exact_target
rather than clang/lib/$relaxed_target (in Android's case, exact_target
might be aarch64-unknown-linux-android21, relaxed_target
aarch64-unknown-linux-android), we patch clang to apply the same kind of
fallbacks it does for runtimes for clang/lib.

Differential Revision: https://phabricator.services.mozilla.com/D173363
2023-03-23 00:25:57 +00:00

23 lines
537 B
Bash
Executable file

#!/bin/sh
set -e -x
artifact=$(basename $TOOLCHAIN_ARTIFACT)
dir=${artifact%.tar.*}
target=${dir#libunwind-}
# Make the android compiler-rt available to clang.
env UPLOAD_DIR= $GECKO_PATH/taskcluster/scripts/misc/repack-clang.sh
EXTRA_CMAKE_FLAGS="
$EXTRA_CMAKE_FLAGS
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
-DCMAKE_C_COMPILER_WORKS=1
-DCMAKE_CXX_COMPILER_WORKS=1
-DLLVM_ENABLE_RUNTIMES=libunwind
-DLIBUNWIND_ENABLE_SHARED=OFF
"
export EXTRA_CMAKE_FLAGS
$(dirname $0)/build-llvm-common.sh runtimes install $target "$@"