summaryrefslogtreecommitdiff
path: root/lld/ELF/InputSection.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-04-19 16:54:30 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-04-19 16:54:30 +0000
commitae68a09b7539ce6e4ba6527b5d45905e73a463ee (patch)
treed08a6593cd3a6e9adc58b29ecc2e21ee71a07481 /lld/ELF/InputSection.cpp
parent8ec1cf7576915f7bf8bbe1aa5306c15f8db073e6 (diff)
Simplify getOffset for synthetic sections.
We had a single symbol using -1 with a synthetic section. It is simpler to just update its value. This is not a big will by itself, but will allow having a simple getOffset for InputSeciton.
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r--lld/ELF/InputSection.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index f094be5f6f2..00cc0127a17 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -142,12 +142,8 @@ uint64_t SectionBase::getOffset(uint64_t Offset) const {
return Offset == uint64_t(-1) ? OS->Size : Offset;
}
case Regular:
+ case Synthetic:
return cast<InputSection>(this->Repl)->OutSecOff + Offset;
- case Synthetic: {
- auto *IS = cast<InputSection>(this->Repl);
- // For synthetic sections we treat offset -1 as the end of the section.
- return IS->OutSecOff + (Offset == uint64_t(-1) ? IS->getSize() : Offset);
- }
case EHFrame:
// The file crtbeginT.o has relocations pointing to the start of an empty
// .eh_frame that is known to be the first in the link. It does that to