Skip to content

Commit 4a5f32c

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 fd7cbfa commit 4a5f32c

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
@@ -428,12 +428,8 @@ toolchains::GenericUnix::constructInvocation(const StaticLinkJobAction &job,
428428

429429
ArgStringList Arguments;
430430

431-
const char *AR;
431+
const char *AR = "llvm-ar";
432432
// Configure the toolchain.
433-
if (getTriple().isAndroid())
434-
AR = "llvm-ar";
435-
else
436-
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
437433
Arguments.push_back("crs");
438434

439435
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)