summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-09-12 00:06:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-09-12 00:06:00 +0000
commita6acd23c5351d9b70251aaf25a8949b4c31bc11f (patch)
tree0bc4bb67030f7e0bcd918cd1bc80f9c1e57f4f94 /lld/ELF/LinkerScript.cpp
parent661e2422d73ad2afb9deff3106cab401a6d44dc8 (diff)
downloadbcm5719-llvm-a6acd23c5351d9b70251aaf25a8949b4c31bc11f.tar.gz
bcm5719-llvm-a6acd23c5351d9b70251aaf25a8949b4c31bc11f.zip
Align addresses, not offsets.
This fixes two more cases where we were aligning the offset in a section, instead of the final address. llvm-svn: 312983
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