Skip to content

Commit 27f97c0

Browse files
committed
Merge pull request #1928 from nadavrot/cleanup
Build the Swift runtime using the locally built clang compliler.
2 parents 151d76f + 412ce77 commit 27f97c0

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

stdlib/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Create convenience targets for the Swift standard library.
2+
3+
set(CMAKE_CXX_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH}/clang++")
4+
set(CMAKE_C_COMPILER "${SWIFT_NATIVE_LLVM_TOOLS_PATH}/clang")
5+
26
add_custom_target(swift-stdlib-all)
37
foreach(SDK ${SWIFT_SDKS})
48
add_custom_target("swift-stdlib-${SWIFT_SDK_${SDK}_LIB_SUBDIR}")

stdlib/public/stubs/Stubs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ extern "C" long double _swift_fmodl(long double lhs, long double rhs) {
258258
// This implementation is copied here to avoid a new dependency
259259
// on compiler-rt on Linux.
260260
// FIXME: rdar://14883575 Libcompiler_rt omits muloti4
261-
#if (defined(__APPLE__) && defined(__arm64__)) || \
262-
(defined(__linux__) && defined(__x86_64__)) || \
261+
#if (defined(__linux__) && defined(__x86_64__)) || \
263262
(defined(__linux__) && defined(__aarch64__)) || \
264263
(defined(__linux__) && defined(__powerpc64__))
265264

utils/build-script-impl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,28 @@ for deployment_target in "${HOST_TARGET}" "${CROSS_TOOLS_DEPLOYMENT_TARGETS[@]}"
20652065
${DISTCC_PUMP} "${CMAKE}" --build "${build_dir}" $(cmake_config_opt ${product}) -- ${BUILD_ARGS} ${build_targets[@]}
20662066
{ set +x; } 2>/dev/null
20672067
fi
2068+
2069+
# When we are building LLVM create symlinks to the c++ headers.
2070+
if [[ "${product}" == "llvm" ]]; then
2071+
set -x
2072+
2073+
# Find the location of the c++ header dir.
2074+
if [[ "$(uname -s)" == "Darwin" ]] ; then
2075+
HOST_CXX_DIR=$(dirname ${HOST_CXX})
2076+
HOST_CXX_HEADERS_DIR="$HOST_CXX_DIR/../../usr/include/c++"
2077+
else # Linux
2078+
HOST_CXX_HEADERS_DIR="/usr/include/c++"
2079+
fi
2080+
2081+
# Find the path in which the local clang build is expecting to find
2082+
# the c++ header files.
2083+
BUILT_CXX_INCLUDE_DIR="$llvm_build_dir/include"
2084+
2085+
echo "symlinking the system headers ($HOST_CXX_HEADERS_DIR) into the local clang build directory ($BUILT_CXX_INCLUDE_DIR)."
2086+
ln -s -f "$HOST_CXX_HEADERS_DIR" "$BUILT_CXX_INCLUDE_DIR"
2087+
2088+
{ set +x; } 2>/dev/null
2089+
fi
20682090
done
20692091
done
20702092
# END OF BUILD PHASE
@@ -2568,3 +2590,4 @@ if [[ "${INSTALLABLE_PACKAGE}" ]] ; then
25682590
{ set +x; } 2>/dev/null
25692591
fi
25702592
fi
2593+

0 commit comments

Comments
 (0)