summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Symbols.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-05-31 20:17:44 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-05-31 20:17:44 +0000
commitdb5e56f7b2c8fd96321bed5b829e77b6e699bfdf (patch)
tree4caf5d172b7bd90a4842c904d9936f942c1e82e3 /lld/ELF/Symbols.cpp
parent1d4cde62832ac8cd8d4955a864bc794523f932d9 (diff)
downloadbcm5719-llvm-db5e56f7b2c8fd96321bed5b829e77b6e699bfdf.tar.gz
bcm5719-llvm-db5e56f7b2c8fd96321bed5b829e77b6e699bfdf.zip
Store a single Parent pointer for InputSectionBase.
Before InputSectionBase had an OutputSection pointer, but that was not always valid. For example, if it was a merge section one actually had to look at MergeSec->OutSec. This was brittle and caused bugs like the one fixed by r304260. We now have a single Parent pointer that points to an OutputSection for InputSection, but to a SyntheticSection for merge sections and .eh_frame. This makes it impossible to accidentally access an invalid OutSec. llvm-svn: 304338
Diffstat (limited to 'lld/ELF/Symbols.cpp')
-rw-r--r--lld/ELF/Symbols.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 7ce1f5354b1..67e57d9c8f0 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -101,12 +101,12 @@ static uint64_t getSymVA(const SymbolBody &Body, int64_t &Addend) {
case SymbolBody::DefinedCommonKind:
if (!Config->DefineCommon)
return 0;
- return InX::Common->OutSec->Addr + InX::Common->OutSecOff +
+ return InX::Common->getParent()->Addr + InX::Common->OutSecOff +
cast<DefinedCommon>(Body).Offset;
case SymbolBody::SharedKind: {
auto &SS = cast<SharedSymbol>(Body);
if (SS.NeedsCopy)
- return SS.CopyRelSec->OutSec->Addr + SS.CopyRelSec->OutSecOff +
+ return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff +
SS.CopyRelSecOff;
if (SS.NeedsPltAddr)
return Body.getPltVA();
@@ -207,13 +207,13 @@ OutputSection *SymbolBody::getOutputSection() const {
if (auto *S = dyn_cast<SharedSymbol>(this)) {
if (S->NeedsCopy)
- return S->CopyRelSec->OutSec;
+ return S->CopyRelSec->getParent();
return nullptr;
}
if (isa<DefinedCommon>(this)) {
if (Config->DefineCommon)
- return InX::Common->OutSec;
+ return InX::Common->getParent();
return nullptr;
}
OpenPOWER on IntegriCloud