Skip to content

Set toolchain clang linker to gold (Linux) #73463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,9 @@ reconfigure

# gcc version on amazon linux 2 is too old to configure and build tablegen.
# Use the clang that we install in the path for macros
llvm-cmake-options=-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE='-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++'
llvm-cmake-options=
-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE='-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++'
-DCLANG_DEFAULT_LINKER=gold

[preset: buildbot_linux]
mixin-preset=
Expand Down
18 changes: 18 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,8 @@ for host in "${ALL_HOSTS[@]}"; do
else
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
fi
export SWIFT_DRIVER_CLANG_EXEC="${CLANG_BIN}/clang"
export SWIFT_DRIVER_CLANGXX_EXEC="${CLANG_BIN}/clang++"

if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"
Expand Down Expand Up @@ -2720,6 +2722,8 @@ for host in "${ALL_HOSTS[@]}"; do
else
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
fi
export SWIFT_DRIVER_CLANG_EXEC="${CLANG_BIN}/clang"
export SWIFT_DRIVER_CLANGXX_EXEC="${CLANG_BIN}/clang++"

if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then
SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc"
Expand Down Expand Up @@ -3067,6 +3071,20 @@ for host in "${ALL_HOSTS[@]}"; do
continue
fi

# Have to set the clang path or the driver will try to link with the wrong
# clang
if [[ "${NATIVE_CLANG_TOOLS_PATH}" ]] ; then
CLANG_BIN="${NATIVE_CLANG_TOOLS_PATH}"
if [[ ! -f "${CLANG_BIN}/clang" ]] ; then
echo "error: clang does not exist at the specified native tools path: ${CLANG_BIN}/clang"
exit 1
fi
else
CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)"
fi
export SWIFT_DRIVER_CLANG_EXEC="${CLANG_BIN}/clang"
export SWIFT_DRIVER_CLANGXX_EXEC="${CLANG_BIN}/clang++"

# Set the build options for this host
set_build_options_for_host $host

Expand Down