[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.
GitOrigin-RevId: e80a0b353c31e2303c44141ab8b2ca63627ab5c2
diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp
index 9de5125..054944e 100644
--- a/ELF/LinkerScript.cpp
+++ b/ELF/LinkerScript.cpp
@@ -53,12 +53,6 @@
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 @@
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 {