minuendVA = toSym->getVA() + minuend.addend;
else {
auto *referentIsec = minuend.referent.get<InputSection *>();
+ assert(!::shouldOmitFromOutput(referentIsec));
minuendVA = referentIsec->getVA(minuend.addend);
}
referentVA = minuendVA - fromSym->getVA();
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);
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 {
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;
}
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) {
}
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.