[PATCH] D104169: [lld-macho][nfc] Put back shouldOmitFromOutput() asserts
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 16 12:23:36 PDT 2021
This revision was automatically updated to reflect the committed changes.
int3 marked an inline comment as done.
Closed by commit rGb8bbb9723af3: [lld-macho][nfc] Put back shouldOmitFromOutput() asserts (authored by int3).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104169/new/
https://reviews.llvm.org/D104169
Files:
lld/MachO/InputSection.cpp
lld/MachO/InputSection.h
lld/MachO/MapFile.cpp
lld/MachO/UnwindInfoSection.cpp
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -174,6 +174,7 @@
}
if (auto *referentIsec = r.referent.dyn_cast<InputSection *>()) {
+ assert(!isCoalescedWeak(referentIsec));
// Personality functions can be referenced via section relocations
// if they live in the same object file. Create placeholder synthetic
// symbols for them in the GOT.
Index: lld/MachO/MapFile.cpp
===================================================================
--- lld/MachO/MapFile.cpp
+++ lld/MachO/MapFile.cpp
@@ -65,8 +65,10 @@
if (isa<ObjFile>(file))
for (Symbol *sym : file->symbols)
if (auto *d = dyn_cast_or_null<Defined>(sym))
- if (d->isLive() && d->isec && d->getFile() == file)
+ if (d->isLive() && d->isec && d->getFile() == file) {
+ assert(!shouldOmitFromOutput(d->isec));
v.push_back(d);
+ }
return v;
}
@@ -142,6 +144,7 @@
os << "# Address\t File Name\n";
for (InputSection *isec : inputSections) {
auto symsIt = sectionSyms.find(isec);
+ assert(!shouldOmitFromOutput(isec) || (symsIt == sectionSyms.end()));
if (symsIt == sectionSyms.end())
continue;
for (Symbol *sym : symsIt->second) {
Index: lld/MachO/InputSection.h
===================================================================
--- lld/MachO/InputSection.h
+++ lld/MachO/InputSection.h
@@ -110,6 +110,18 @@
uint64_t outSecOff = 0;
};
+// Helper functions to make it easy to sprinkle asserts.
+
+inline bool shouldOmitFromOutput(InputSection *isec) {
+ return isa<ConcatInputSection>(isec) &&
+ cast<ConcatInputSection>(isec)->shouldOmitFromOutput();
+}
+
+inline bool isCoalescedWeak(InputSection *isec) {
+ return isa<ConcatInputSection>(isec) &&
+ cast<ConcatInputSection>(isec)->isCoalescedWeak();
+}
+
// We allocate a lot of these and binary search on them, so they should be as
// compact as possible. Hence the use of 31 rather than 64 bits for the hash.
struct StringPiece {
Index: lld/MachO/InputSection.cpp
===================================================================
--- lld/MachO/InputSection.cpp
+++ lld/MachO/InputSection.cpp
@@ -64,6 +64,7 @@
minuendVA = toSym->getVA() + minuend.addend;
else {
auto *referentIsec = minuend.referent.get<InputSection *>();
+ assert(!::shouldOmitFromOutput(referentIsec));
minuendVA = referentIsec->getVA(minuend.addend);
}
referentVA = minuendVA - fromSym->getVA();
@@ -82,6 +83,7 @@
referentVA -= firstTLVDataSection->addr;
}
} else if (auto *referentIsec = r.referent.dyn_cast<InputSection *>()) {
+ assert(!::shouldOmitFromOutput(referentIsec));
referentVA = referentIsec->getVA(r.addend);
}
target->relocateOne(loc, r, referentVA, getVA() + r.offset);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104169.352512.patch
Type: text/x-patch
Size: 2981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210616/34127bc1/attachment.bin>
More information about the llvm-commits
mailing list