[ELF] Remove unneeded getOutputSectionVA. NFC

I attempted to remove it 1 or 2 year ago but kept it just to have a good
diagnostic in case the output section is nullptr (should be impossible).
It is long enough that we haven't seen such a case.
This commit is contained in:
Fangrui Song 2021-11-28 16:17:10 -08:00
parent 85e50c1080
commit e80a0b353c

View File

@ -53,12 +53,6 @@ static bool isSectionPrefix(StringRef prefix, StringRef name) {
return name.startswith(prefix) || name == prefix.drop_back();
}
static uint64_t getOutputSectionVA(SectionBase *sec) {
OutputSection *os = sec->getOutputSection();
assert(os && "input section has no output section assigned");
return os ? os->addr : 0;
}
static StringRef getOutputSectionName(const InputSectionBase *s) {
if (config->relocatable)
return s->name;
@ -118,15 +112,13 @@ static StringRef getOutputSectionName(const InputSectionBase *s) {
uint64_t ExprValue::getValue() const {
if (sec)
return alignTo(sec->getOffset(val) + getOutputSectionVA(sec),
return alignTo(sec->getOutputSection()->addr + sec->getOffset(val),
alignment);
return alignTo(val, alignment);
}
uint64_t ExprValue::getSecAddr() const {
if (sec)
return sec->getOffset(0) + getOutputSectionVA(sec);
return 0;
return sec ? sec->getOutputSection()->addr + sec->getOffset(0) : 0;
}
uint64_t ExprValue::getSectionOffset() const {