summaryrefslogtreecommitdiffstats
path: root/lld/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib')
-rw-r--r--lld/lib/Driver/Driver.cpp7
-rw-r--r--lld/lib/ReaderWriter/CoreLinkingContext.cpp3
-rw-r--r--lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp4
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h2
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp6
-rw-r--r--lld/lib/ReaderWriter/ELF/OrderPass.h3
-rw-r--r--lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp3
-rw-r--r--lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp6
-rw-r--r--lld/lib/ReaderWriter/MachO/GOTPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/MachO/LayoutPass.cpp4
-rw-r--r--lld/lib/ReaderWriter/MachO/LayoutPass.h2
-rw-r--r--lld/lib/ReaderWriter/MachO/ShimPass.cpp6
-rw-r--r--lld/lib/ReaderWriter/MachO/StubsPass.cpp8
-rw-r--r--lld/lib/ReaderWriter/PECOFF/EdataPass.cpp8
-rw-r--r--lld/lib/ReaderWriter/PECOFF/EdataPass.h2
-rw-r--r--lld/lib/ReaderWriter/PECOFF/IdataPass.cpp6
-rw-r--r--lld/lib/ReaderWriter/PECOFF/IdataPass.h2
-rw-r--r--lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h12
-rw-r--r--lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp8
-rw-r--r--lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h2
-rw-r--r--lld/lib/ReaderWriter/PECOFF/OrderPass.h3
-rw-r--r--lld/lib/ReaderWriter/PECOFF/PDBPass.h3
25 files changed, 77 insertions, 39 deletions
diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp
index 9f796dedaef..968b2cc42ef 100644
--- a/lld/lib/Driver/Driver.cpp
+++ b/lld/lib/Driver/Driver.cpp
@@ -117,7 +117,12 @@ bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) {
ScopedTask passTask(getDefaultDomain(), "Passes");
PassManager pm;
ctx.addPasses(pm);
- pm.runOnFile(merged);
+ if (std::error_code ec = pm.runOnFile(merged)) {
+ diagnostics << "Failed to write file '" << ctx.outputPath()
+ << "': " << ec.message() << "\n";
+ return false;
+ }
+
passTask.end();
// Give linked atoms to Writer to generate output file.
diff --git a/lld/lib/ReaderWriter/CoreLinkingContext.cpp b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
index 87f30875513..103fed80458 100644
--- a/lld/lib/ReaderWriter/CoreLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
@@ -22,9 +22,10 @@ namespace {
class OrderPass : public Pass {
public:
/// Sorts atoms by position
- void perform(std::unique_ptr<SimpleFile> &file) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override {
SimpleFile::DefinedAtomRange defined = file->definedAtoms();
std::sort(defined.begin(), defined.end(), DefinedAtom::compareByPosition);
+ return std::error_code();
}
};
diff --git a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
index 2614a03dfbf..787d11c1303 100644
--- a/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/AArch64/AArch64RelocationPass.cpp
@@ -256,7 +256,7 @@ public:
///
/// After all references are handled, the atoms created during that are all
/// added to mf.
- void perform(std::unique_ptr<SimpleFile> &mf) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mf) override {
ScopedTask task(getDefaultDomain(), "AArch64 GOT/PLT Pass");
DEBUG_WITH_TYPE(
"AArch64", llvm::dbgs() << "Undefined Atoms"
@@ -315,6 +315,8 @@ public:
obj->setOrdinal(ordinal++);
mf->addAtom(*obj);
}
+
+ return std::error_code();
}
protected:
diff --git a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
index c41da0bebcf..4ba02d809f9 100644
--- a/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/ARM/ARMRelocationPass.cpp
@@ -673,7 +673,7 @@ public:
///
/// After all references are handled, the atoms created during that are all
/// added to mf.
- void perform(std::unique_ptr<SimpleFile> &mf) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mf) override {
ScopedTask task(getDefaultDomain(), "ARM GOT/PLT Pass");
DEBUG_WITH_TYPE(
"ARM", llvm::dbgs() << "Undefined Atoms" << "\n";
@@ -759,6 +759,8 @@ public:
v->setOrdinal(ordinal++);
mf->addAtom(*v);
}
+
+ return std::error_code();
}
protected:
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
index cce7259bb9c..f835eb6683d 100644
--- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
@@ -169,7 +169,7 @@ public:
///
/// After all references are handled, the atoms created during that are all
/// added to mf.
- void perform(std::unique_ptr<SimpleFile> &mf) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mf) override {
// Process all references.
for (const auto &atom : mf->defined())
for (const auto &ref : *atom)
@@ -197,6 +197,8 @@ public:
got->setOrdinal(ordinal++);
mf->addAtom(*got);
}
+
+ return std::error_code();
}
protected:
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp
index 4383ad4a783..276d87dc193 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.cpp
@@ -49,7 +49,7 @@ static int32_t getSectionPriority(StringRef path, StringRef sectionName) {
return priority;
}
-void MipsCtorsOrderPass::perform(std::unique_ptr<SimpleFile> &f) {
+std::error_code MipsCtorsOrderPass::perform(std::unique_ptr<SimpleFile> &f) {
auto definedAtoms = f->definedAtoms();
auto last = std::stable_partition(definedAtoms.begin(), definedAtoms.end(),
@@ -71,4 +71,6 @@ void MipsCtorsOrderPass::perform(std::unique_ptr<SimpleFile> &f) {
return leftPriority < rightPriority;
});
+
+ return std::error_code();
}
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h
index 733e2d4d256..65c9d9b90d5 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsCtorsOrderPass.h
@@ -17,7 +17,7 @@ namespace elf {
/// \brief This pass sorts atoms in .{ctors,dtors}.<priority> sections.
class MipsCtorsOrderPass : public Pass {
public:
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override;
};
}
}
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 3682950e106..f4f0a8acd93 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
@@ -302,7 +302,7 @@ template <typename ELFT> class RelocationPass : public Pass {
public:
RelocationPass(MipsLinkingContext &ctx);
- void perform(std::unique_ptr<SimpleFile> &mf) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &mf) override;
private:
/// \brief Reference to the linking context.
@@ -428,7 +428,7 @@ RelocationPass<ELFT>::RelocationPass(MipsLinkingContext &ctx)
}
template <typename ELFT>
-void RelocationPass<ELFT>::perform(std::unique_ptr<SimpleFile> &mf) {
+std::error_code RelocationPass<ELFT>::perform(std::unique_ptr<SimpleFile> &mf) {
for (const auto &atom : mf->defined())
for (const auto &ref : *atom)
collectReferenceInfo(*cast<MipsELFDefinedAtom<ELFT>>(atom),
@@ -518,6 +518,8 @@ void RelocationPass<ELFT>::perform(std::unique_ptr<SimpleFile> &mf) {
la25->setOrdinal(ordinal++);
mf->addAtom(*la25);
}
+
+ return std::error_code();
}
template <typename ELFT>
diff --git a/lld/lib/ReaderWriter/ELF/OrderPass.h b/lld/lib/ReaderWriter/ELF/OrderPass.h
index 74bddc8acb4..4b4e2b16af5 100644
--- a/lld/lib/ReaderWriter/ELF/OrderPass.h
+++ b/lld/lib/ReaderWriter/ELF/OrderPass.h
@@ -19,9 +19,10 @@ namespace elf {
/// \brief This pass sorts atoms by file and atom ordinals.
class OrderPass : public Pass {
public:
- void perform(std::unique_ptr<SimpleFile> &file) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override {
parallel_sort(file->definedAtoms().begin(), file->definedAtoms().end(),
DefinedAtom::compareByPosition);
+ return std::error_code();
}
};
}
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
index 1be4b9587dc..10b6d4c15f1 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationPass.cpp
@@ -254,7 +254,7 @@ public:
///
/// After all references are handled, the atoms created during that are all
/// added to mf.
- void perform(std::unique_ptr<SimpleFile> &mf) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mf) override {
ScopedTask task(getDefaultDomain(), "X86-64 GOT/PLT Pass");
// Process all references.
for (const auto &atom : mf->defined())
@@ -293,6 +293,7 @@ public:
obj->setOrdinal(ordinal++);
mf->addAtom(*obj);
}
+ return std::error_code();
}
protected:
diff --git a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
index aae81a27cd8..97925f3d1fe 100644
--- a/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
@@ -277,7 +277,7 @@ public:
_isBig(MachOLinkingContext::isBigEndian(_ctx.arch())) {}
private:
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override {
DEBUG(llvm::dbgs() << "MachO Compact Unwind pass\n");
std::map<const Atom *, CompactUnwindEntry> unwindLocs;
@@ -294,7 +294,7 @@ private:
// Skip rest of pass if no unwind info.
if (unwindLocs.empty() && dwarfFrames.empty())
- return;
+ return std::error_code();
// FIXME: if there are more than 4 personality functions then we need to
// defer to DWARF info for the ones we don't put in the list. They should
@@ -348,6 +348,8 @@ private:
mergedFile->removeDefinedAtomsIf([](const DefinedAtom *atom) {
return atom->contentType() == DefinedAtom::typeCompactUnwindInfo;
});
+
+ return std::error_code();
}
void collectCompactUnwindEntries(
diff --git a/lld/lib/ReaderWriter/MachO/GOTPass.cpp b/lld/lib/ReaderWriter/MachO/GOTPass.cpp
index 73505d760b0..28e1c8abc28 100644
--- a/lld/lib/ReaderWriter/MachO/GOTPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/GOTPass.cpp
@@ -96,7 +96,7 @@ public:
_file("<mach-o GOT Pass>") {}
private:
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override {
// Scan all references in all atoms.
for (const DefinedAtom *atom : mergedFile->defined()) {
for (const Reference *ref : *atom) {
@@ -131,6 +131,8 @@ private:
});
for (const GOTEntryAtom *slot : entries)
mergedFile->addAtom(*slot);
+
+ return std::error_code();
}
bool shouldReplaceTargetWithGOTAtom(const Atom *target, bool canBypassGOT) {
diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
index de3d5c21db1..c523470c191 100644
--- a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp
@@ -437,7 +437,7 @@ void LayoutPass::undecorate(SimpleFile::DefinedAtomRange &atomRange,
}
/// Perform the actual pass
-void LayoutPass::perform(std::unique_ptr<SimpleFile> &mergedFile) {
+std::error_code LayoutPass::perform(std::unique_ptr<SimpleFile> &mergedFile) {
// sort the atoms
ScopedTask task(getDefaultDomain(), "LayoutPass");
SimpleFile::DefinedAtomRange atomRange = mergedFile->definedAtoms();
@@ -468,6 +468,8 @@ void LayoutPass::perform(std::unique_ptr<SimpleFile> &mergedFile) {
llvm::dbgs() << "sorted atoms:\n";
printDefinedAtoms(atomRange);
});
+
+ return std::error_code();
}
void addLayoutPass(PassManager &pm, const MachOLinkingContext &ctx) {
diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.h b/lld/lib/ReaderWriter/MachO/LayoutPass.h
index 2b31e0eed3d..be061d91c42 100644
--- a/lld/lib/ReaderWriter/MachO/LayoutPass.h
+++ b/lld/lib/ReaderWriter/MachO/LayoutPass.h
@@ -46,7 +46,7 @@ public:
LayoutPass(const Registry &registry, SortOverride sorter);
/// Sorts atoms in mergedFile by content type then by command line order.
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override;
virtual ~LayoutPass() {}
diff --git a/lld/lib/ReaderWriter/MachO/ShimPass.cpp b/lld/lib/ReaderWriter/MachO/ShimPass.cpp
index 6268ba60aae..24e1937de92 100644
--- a/lld/lib/ReaderWriter/MachO/ShimPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/ShimPass.cpp
@@ -44,7 +44,7 @@ public:
: _ctx(context), _archHandler(_ctx.archHandler()),
_stubInfo(_archHandler.stubInfo()), _file("<mach-o shim pass>") {}
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override {
// Scan all references in all atoms.
for (const DefinedAtom *atom : mergedFile->defined()) {
for (const Reference *ref : *atom) {
@@ -63,7 +63,7 @@ public:
}
// Exit early if no shims needed.
if (_targetToShim.empty())
- return;
+ return std::error_code();
// Sort shim atoms so the layout order is stable.
std::vector<const DefinedAtom *> shims;
@@ -80,6 +80,8 @@ public:
for (const DefinedAtom *shim : shims) {
mergedFile->addAtom(*shim);
}
+
+ return std::error_code();
}
private:
diff --git a/lld/lib/ReaderWriter/MachO/StubsPass.cpp b/lld/lib/ReaderWriter/MachO/StubsPass.cpp
index f0b792c4d2e..25fccfd3114 100644
--- a/lld/lib/ReaderWriter/MachO/StubsPass.cpp
+++ b/lld/lib/ReaderWriter/MachO/StubsPass.cpp
@@ -209,10 +209,10 @@ public:
: _ctx(context), _archHandler(_ctx.archHandler()),
_stubInfo(_archHandler.stubInfo()), _file("<mach-o Stubs pass>") {}
- void perform(std::unique_ptr<SimpleFile> &mergedFile) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &mergedFile) override {
// Skip this pass if output format uses text relocations instead of stubs.
if (!this->noTextRelocs())
- return;
+ return std::error_code();
// Scan all references in all atoms.
for (const DefinedAtom *atom : mergedFile->defined()) {
@@ -239,7 +239,7 @@ public:
// Exit early if no stubs needed.
if (_targetToUses.empty())
- return;
+ return std::error_code();
// First add help-common and GOT slots used by lazy binding.
SimpleDefinedAtom *helperCommonAtom =
@@ -314,6 +314,8 @@ public:
// Calculate new offset
lazyOffset += target->name().size() + 12;
}
+
+ return std::error_code();
}
private:
diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
index 2c91ffb33c6..c42d6ecf185 100644
--- a/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.cpp
@@ -175,15 +175,15 @@ EdataPass::createOrdinalTable(const std::vector<TableEntry> &entries,
return ret;
}
-void EdataPass::perform(std::unique_ptr<SimpleFile> &file) {
+std::error_code EdataPass::perform(std::unique_ptr<SimpleFile> &file) {
dedupExports(_ctx);
assignOrdinals(_ctx);
std::vector<TableEntry> entries;
if (!getExportedAtoms(_ctx, file.get(), entries))
- return;
+ return std::error_code();
if (entries.empty())
- return;
+ return std::error_code();
int ordinalBase, maxOrdinal;
std::tie(ordinalBase, maxOrdinal) = getOrdinalBase(entries);
@@ -221,6 +221,8 @@ void EdataPass::perform(std::unique_ptr<SimpleFile> &file) {
file->addAtom(*ordinalTable);
addDir32NBReloc(table, ordinalTable, _ctx.getMachineType(),
offsetof(export_directory_table_entry, OrdinalTableRVA));
+
+ return std::error_code();
}
} // namespace pecoff
diff --git a/lld/lib/ReaderWriter/PECOFF/EdataPass.h b/lld/lib/ReaderWriter/PECOFF/EdataPass.h
index 0132c9ca5f2..94ba705ff71 100644
--- a/lld/lib/ReaderWriter/PECOFF/EdataPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/EdataPass.h
@@ -66,7 +66,7 @@ public:
EdataPass(PECOFFLinkingContext &ctx)
: _ctx(ctx), _file(ctx), _is64(ctx.is64Bit()), _stringOrdinal(1024) {}
- void perform(std::unique_ptr<SimpleFile> &file) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override;
private:
edata::EdataAtom *
diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp b/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp
index e19024a15d3..37b0030422c 100644
--- a/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.cpp
@@ -287,9 +287,9 @@ DelayLoaderAtom::createContent(MachineTypes machine) const {
} // namespace idata
-void IdataPass::perform(std::unique_ptr<SimpleFile> &file) {
+std::error_code IdataPass::perform(std::unique_ptr<SimpleFile> &file) {
if (file->sharedLibrary().empty())
- return;
+ return std::error_code();
idata::IdataContext context(*file, _dummyFile, _ctx);
std::map<StringRef, std::vector<COFFSharedLibraryAtom *>> sharedAtoms =
@@ -322,6 +322,8 @@ void IdataPass::perform(std::unique_ptr<SimpleFile> &file) {
new (_alloc) idata::DelayNullImportDirectoryAtom(context);
replaceSharedLibraryAtoms(*file);
+
+ return std::error_code();
}
std::map<StringRef, std::vector<COFFSharedLibraryAtom *>>
diff --git a/lld/lib/ReaderWriter/PECOFF/IdataPass.h b/lld/lib/ReaderWriter/PECOFF/IdataPass.h
index 7cf41558369..ccc59bcb576 100644
--- a/lld/lib/ReaderWriter/PECOFF/IdataPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/IdataPass.h
@@ -195,7 +195,7 @@ class IdataPass : public lld::Pass {
public:
IdataPass(const PECOFFLinkingContext &ctx) : _dummyFile(ctx), _ctx(ctx) {}
- void perform(std::unique_ptr<SimpleFile> &file) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override;
private:
std::map<StringRef, std::vector<COFFSharedLibraryAtom *>>
diff --git a/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h b/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h
index f17c26e7a98..33bea44f255 100644
--- a/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/InferSubsystemPass.h
@@ -22,13 +22,13 @@ class InferSubsystemPass : public lld::Pass {
public:
InferSubsystemPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {}
- void perform(std::unique_ptr<SimpleFile> &file) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override {
if (_ctx.getSubsystem() != WindowsSubsystem::IMAGE_SUBSYSTEM_UNKNOWN)
- return;
+ return std::error_code();
if (_ctx.isDll()) {
_ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI);
- return;
+ return std::error_code();
}
// Scan the resolved symbols to infer the subsystem.
@@ -45,15 +45,17 @@ public:
if (atom->name() == wWinMain || atom->name().startswith(wWinMainAt) ||
atom->name() == winMain || atom->name().startswith(winMainAt)) {
_ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_GUI);
- return;
+ return std::error_code();
}
if (atom->name() == wmain || atom->name().startswith(wmainAt) ||
atom->name() == main || atom->name().startswith(mainAt)) {
_ctx.setSubsystem(WindowsSubsystem::IMAGE_SUBSYSTEM_WINDOWS_CUI);
- return;
+ return std::error_code();
}
}
llvm::report_fatal_error("Failed to infer subsystem");
+
+ return std::error_code();
}
private:
diff --git a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp
index f2a9609e863..bebe26bf825 100644
--- a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.cpp
@@ -49,9 +49,9 @@ LoadConfigAtom::LoadConfigAtom(VirtualFile &file, const DefinedAtom *sxdata,
} // namespace loadcfg
-void LoadConfigPass::perform(std::unique_ptr<SimpleFile> &file) {
+std::error_code LoadConfigPass::perform(std::unique_ptr<SimpleFile> &file) {
if (_ctx.noSEH())
- return;
+ return std::error_code();
// Find the first atom in .sxdata section.
const DefinedAtom *sxdata = nullptr;
@@ -64,11 +64,13 @@ void LoadConfigPass::perform(std::unique_ptr<SimpleFile> &file) {
}
}
if (!sxdata)
- return;
+ return std::error_code();
auto *loadcfg = new (_alloc)
loadcfg::LoadConfigAtom(_file, sxdata, sectionSize / sizeof(uint32_t));
file->addAtom(*loadcfg);
+
+ return std::error_code();
}
} // namespace pecoff
diff --git a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h
index c8ab5944701..a3c704a7ea3 100644
--- a/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/LoadConfigPass.h
@@ -49,7 +49,7 @@ class LoadConfigPass : public lld::Pass {
public:
LoadConfigPass(PECOFFLinkingContext &ctx) : _ctx(ctx), _file(ctx) {}
- void perform(std::unique_ptr<SimpleFile> &file) override;
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override;
private:
PECOFFLinkingContext &_ctx;
diff --git a/lld/lib/ReaderWriter/PECOFF/OrderPass.h b/lld/lib/ReaderWriter/PECOFF/OrderPass.h
index 9ffe179487a..44177283f2a 100644
--- a/lld/lib/ReaderWriter/PECOFF/OrderPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/OrderPass.h
@@ -55,9 +55,10 @@ static bool compare(const DefinedAtom *lhs, const DefinedAtom *rhs) {
class OrderPass : public lld::Pass {
public:
- void perform(std::unique_ptr<SimpleFile> &file) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override {
SimpleFile::DefinedAtomRange defined = file->definedAtoms();
parallel_sort(defined.begin(), defined.end(), compare);
+ return std::error_code();
}
};
diff --git a/lld/lib/ReaderWriter/PECOFF/PDBPass.h b/lld/lib/ReaderWriter/PECOFF/PDBPass.h
index 2fbe60eed98..79a6066fb1c 100644
--- a/lld/lib/ReaderWriter/PECOFF/PDBPass.h
+++ b/lld/lib/ReaderWriter/PECOFF/PDBPass.h
@@ -21,9 +21,10 @@ class PDBPass : public lld::Pass {
public:
PDBPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {}
- void perform(std::unique_ptr<SimpleFile> &file) override {
+ std::error_code perform(std::unique_ptr<SimpleFile> &file) override {
if (_ctx.getDebug())
touch(_ctx.getPDBFilePath());
+ return std::error_code();
}
private:
OpenPOWER on IntegriCloud