Skip to content

[Driver] Use llvm-ar by default on Unix and copy it over into the build directory #62800

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 1 addition & 5 deletions lib/Driver/UnixToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,8 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job,

ArgStringList Arguments;

const char *AR;
const char *AR = "llvm-ar";
// Configure the toolchain.
if (getTriple().isAndroid())
AR = "llvm-ar";
else
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
Arguments.push_back("crs");

Arguments.push_back(
Expand Down
9 changes: 9 additions & 0 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ file(TO_CMAKE_PATH "${LLVM_BUILD_BINARY_DIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUF
swift_install_in_component(PROGRAMS "${_SWIFT_UTILS_FILECHECK}"
DESTINATION bin
COMPONENT llvm-toolchain-dev-tools)

# Copy over llvm-ar to use in building the Swift portions of the corelibs on
# Unix platforms.
if(NOT "${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS|WASI")
file(COPY ${LLVM_RUNTIME_OUTPUT_INTDIR}/bin/llvm-ar
DESTINATION "${SWIFT_RUNTIME_OUTPUT_INTDIR}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()