Skip to content

Commit 04bcae9

Browse files
committedJan 3, 2023
[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 ac10f2a commit 04bcae9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

Diff for: ‎lib/Driver/UnixToolChains.cpp

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

399399
ArgStringList Arguments;
400400

401-
const char *AR;
401+
const char *AR = "llvm-ar";
402402
// Configure the toolchain.
403-
if (getTriple().isAndroid())
404-
AR = "llvm-ar";
405-
else
406-
AR = context.OI.LTOVariant != OutputInfo::LTOKind::None ? "llvm-ar" : "ar";
407403
Arguments.push_back("crs");
408404

409405
Arguments.push_back(

Diff for: ‎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)