Skip to content

Commit 1780320

Browse files
committed
Use consistent clang through build
The just-built Swift driver was picking up the system clang, which would try to use the bfd linker instead of gold or lld. bfd doesn't like how Swift handles protected symbols and fails with the following error: ``` error: link command failed with exit code 1 (use -v to see invocation) /usr/bin/ld: /home/build-user/build/buildbot_linux/libdispatch-linux-x86_64/src/swift/CMakeFiles/swiftDispatch.dir/Block.swift.o: relocation R_X86_64_PC32 against protected symbol `$s8Dispatch0A13WorkItemFlagsVSYAAMc' can not be used when making a shared object /usr/bin/ld: final link failed: bad value ``` This patch tells the Swift-Driver where it should find its clang, and makes it match the clang that is in use through the rest of the build.
1 parent 6df0de5 commit 1780320

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

utils/build-script-impl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,8 @@ for host in "${ALL_HOSTS[@]}"; do
16531653
else
16541654
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
16551655
fi
1656+
export SWIFT_DRIVER_CLANG_EXEC="${CLANG_BIN}/clang"
1657+
export SWIFT_DRIVER_CLANGXX_EXEC="${CLANG_BIN}/clang++"
16561658

16571659
if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
16581660
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"
@@ -2720,6 +2722,8 @@ for host in "${ALL_HOSTS[@]}"; do
27202722
else
27212723
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
27222724
fi
2725+
export SWIFT_DRIVER_CLANG_EXEC="${CLANG_BIN}/clang"
2726+
export SWIFT_DRIVER_CLANGXX_EXEC="${CLANG_BIN}/clang++"
27232727

27242728
if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
27252729
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"

0 commit comments

Comments
 (0)