Skip to content

Commit d76c814

Browse files
committed
Fix swiftpm build
1 parent 5d32946 commit d76c814

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/Driver/DarwinToolChains.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,25 @@ toolchains::Darwin::constructInvocation(const LinkJobAction &job,
427427
}
428428
}
429429

430+
Optional<llvm::VersionTuple> runtimeDynamicReplacementCompatibilityVersion;
431+
if (job.getKind() == LinkKind::Executable) {
432+
runtimeDynamicReplacementCompatibilityVersion
433+
= getSwiftRuntimeCompatibilityVersionForTarget(Triple);
434+
if (*runtimeDynamicReplacementCompatibilityVersion <=
435+
llvm::VersionTuple(5, 0)) {
436+
// Swift 5.0 dynamic replacement compatibility library.
437+
SmallString<128> BackDeployLib;
438+
BackDeployLib.append(RuntimeLibPath);
439+
llvm::sys::path::append(BackDeployLib,
440+
"libswiftCompatibilityDynamicReplacements.a");
441+
442+
if (llvm::sys::fs::exists(BackDeployLib)) {
443+
Arguments.push_back("-force_load");
444+
Arguments.push_back(context.Args.MakeArgString(BackDeployLib));
445+
}
446+
}
447+
}
448+
430449
// Link the standard library.
431450
Arguments.push_back("-L");
432451
if (context.Args.hasFlag(options::OPT_static_stdlib,

0 commit comments

Comments
 (0)