Skip to content

Commit b850bc6

Browse files
committed
[Apple Silicon] [build-script] Build compiler-rt even when cross-compiling
clang and compiler-rt are rev-locked and should match. Currently, we build clang (and use it to bootstrap the rest) but don't build compiler-rt. We should. This doesn't completely achieve that: this only makes us build compiler-rt for the local host. This used to be pretty much impossible, but, since then, compiler-rt cmake support was rewritten. We should build it for the other hosts as well, but that's trickier, because we'd need to make the cross-compiled compiler-rt build use a separate just-built clang (from the local host). We do that for the other projects, but compiler-rt is special (because it's cmake'd as a runtime part of clang/llvm).
1 parent 676b9af commit b850bc6

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

utils/build-script-impl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,19 @@ function set_build_options_for_host() {
649649
esac
650650

651651

652-
llvm_cmake_options+=(
653-
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
654-
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
655-
)
652+
# We don't currently support building compiler-rt for cross-compile targets.
653+
# It's not clear that's useful anyway.
654+
if is_cross_tools_host "${host}"; then
655+
llvm_cmake_options+=(
656+
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL=FALSE
657+
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=FALSE
658+
)
659+
else
660+
llvm_cmake_options+=(
661+
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
662+
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
663+
)
664+
fi
656665

657666
# If we are asked to not generate test targets for LLVM and or Swift,
658667
# disable as many LLVM tools as we can. This improves compile time when
@@ -861,11 +870,6 @@ if [[ "${CMAKE_GENERATOR}" == "Xcode" ]]; then
861870
SKIP_BUILD_COMPILER_RT=1
862871
fi
863872

864-
# FIXME: We currently do not support cross-compiling swift with compiler-rt.
865-
if [[ "${CROSS_COMPILE_HOSTS}" ]]; then
866-
SKIP_BUILD_COMPILER_RT=1
867-
fi
868-
869873
if [[ "${SKIP_RECONFIGURE}" ]]; then
870874
RECONFIGURE=""
871875
fi

0 commit comments

Comments
 (0)