summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 121f2fb0c37..3ccc2c9a66e 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -70,6 +70,10 @@ uint64_t ExprValue::getSecAddr() const {
return 0;
}
+uint64_t ExprValue::getSectionOffset() const {
+ return getValue() - getSecAddr();
+}
+
static SymbolBody *addRegular(SymbolAssignment *Cmd) {
Symbol *Sym;
uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;
@@ -141,7 +145,7 @@ void LinkerScript::assignSymbol(SymbolAssignment *Cmd, bool InSec) {
Sym->Value = V.getValue();
} else {
Sym->Section = V.Sec;
- Sym->Value = V.getValue() - V.getSecAddr();
+ Sym->Value = V.getSectionOffset();
}
}
OpenPOWER on IntegriCloud