mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows"
This commit is contained in:
committed by
GitHub
parent
cc84c7b740
commit
71309a8fa9
@@ -1098,18 +1098,10 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
|
||||
|
||||
switch (linkLib.getKind()) {
|
||||
case LibraryKind::Library: {
|
||||
if (TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None) {
|
||||
// When performing LTO, we always use lld that supports auto linking mechanism with ELF.
|
||||
// So embed dependent libraries names in "llvm.dependent-libraries" instead of options
|
||||
// to avoid using swift-autolink-extract.
|
||||
AutolinkEntries.push_back(
|
||||
llvm::MDNode::get(ctx, llvm::MDString::get(ctx, linkLib.getName())));
|
||||
} else {
|
||||
llvm::SmallString<32> opt =
|
||||
getTargetDependentLibraryOption(Triple, linkLib.getName());
|
||||
AutolinkEntries.push_back(
|
||||
llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt)));
|
||||
}
|
||||
llvm::SmallString<32> opt =
|
||||
getTargetDependentLibraryOption(Triple, linkLib.getName());
|
||||
AutolinkEntries.push_back(
|
||||
llvm::MDNode::get(ctx, llvm::MDString::get(ctx, opt)));
|
||||
break;
|
||||
}
|
||||
case LibraryKind::Framework: {
|
||||
@@ -1196,12 +1188,7 @@ static bool isFirstObjectFileInModule(IRGenModule &IGM) {
|
||||
void IRGenModule::emitAutolinkInfo() {
|
||||
// Collect the linker options already in the module (from ClangCodeGen).
|
||||
// FIXME: This constant should be vended by LLVM somewhere.
|
||||
// When performing LTO, we always use lld that supports auto linking mechanism with ELF.
|
||||
// So embed dependent libraries names in "llvm.dependent-libraries" instead of "llvm.linker.options".
|
||||
const StringRef AutolinkSectionName =
|
||||
TargetInfo.OutputObjectFormat == llvm::Triple::ELF && IRGen.Opts.LLVMLTOKind != IRGenLLVMLTOKind::None
|
||||
? "llvm.dependent-libraries" : "llvm.linker.options";
|
||||
auto *Metadata = Module.getOrInsertNamedMetadata(AutolinkSectionName);
|
||||
auto *Metadata = Module.getOrInsertNamedMetadata("llvm.linker.options");
|
||||
for (llvm::MDNode *LinkOption : Metadata->operands())
|
||||
AutolinkEntries.push_back(LinkOption);
|
||||
|
||||
@@ -1216,9 +1203,9 @@ void IRGenModule::emitAutolinkInfo() {
|
||||
AutolinkEntries.end());
|
||||
|
||||
const bool AutolinkExtractRequired =
|
||||
((TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) ||
|
||||
(TargetInfo.OutputObjectFormat == llvm::Triple::ELF && !Triple.isPS4()) ||
|
||||
TargetInfo.OutputObjectFormat == llvm::Triple::Wasm ||
|
||||
Triple.isOSCygMing()) && IRGen.Opts.LLVMLTOKind == IRGenLLVMLTOKind::None;
|
||||
Triple.isOSCygMing();
|
||||
|
||||
if (!AutolinkExtractRequired) {
|
||||
// On platforms that support autolinking, continue to use the metadata.
|
||||
|
||||
Reference in New Issue
Block a user