Skip to content

Commit 811a40e

Browse files
committed
[Driver] Use llvm-ar by default on Unix and copy it over into the build directory
Now that llvm-ar is installed by default in the toolchain, #62510, and a recent SPM change requires there to be an archiver in the toolchain/PATH, swiftlang/swift-package-manager#5761, use that bundled llvm-ar for all Unix platforms, which requires copying it over into the build directory too before building the corelibs.
1 parent 7ea2b3d commit 811a40e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/Driver/UnixToolChains.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,8 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job,
406406

407407
ArgStringList Arguments;
408408

409-
const char *AR;
409+
const char *AR = "llvm-ar";
410410
// Configure the toolchain.
411-
if (getTriple().isAndroid())
412-
AR = "llvm-ar";
413-
else
414-
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
415411
Arguments.push_back("crs");
416412

417413
Arguments.push_back(

utils/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,12 @@ file(TO_CMAKE_PATH "${LLVM_BUILD_BINARY_DIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUF
1515
swift_install_in_component(PROGRAMS "${_SWIFT_UTILS_FILECHECK}"
1616
DESTINATION bin
1717
COMPONENT llvm-toolchain-dev-tools)
18+
19+
# Copy over llvm-ar to use in building the Swift portions of the corelibs on
20+
# Unix platforms.
21+
if(NOT "${SWIFT_HOST_VARIANT_SDK}" MATCHES "OSX|WINDOWS")
22+
file(COPY ${LLVM_RUNTIME_OUTPUT_INTDIR}/bin/llvm-ar
23+
DESTINATION "${SWIFT_RUNTIME_OUTPUT_INTDIR}"
24+
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
25+
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
26+
endif()

0 commit comments

Comments
 (0)