[PATCH] D33500: [LLD][ELF] .ARM.exidx sentinel section writeTo() should use InputSectionDescriptions.
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 07:03:05 PDT 2017
peter.smith updated this revision to Diff 100240.
peter.smith added a comment.
Updated due to https://reviews.llvm.org/D33496 needing inputSectionRanges() so we don't need to add it here as well. This patch now depends on https://reviews.llvm.org/D33496.
https://reviews.llvm.org/D33500
Files:
ELF/SyntheticSections.cpp
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -2181,13 +2181,19 @@
// This section will have been sorted last in the .ARM.exidx table.
// This table entry will have the form:
// | PREL31 upper bound of code that has exception tables | EXIDX_CANTUNWIND |
+// The sentinel must have the PREL31 value of an address higher than any
+// address described by any other table entry.
void ARMExidxSentinelSection::writeTo(uint8_t *Buf) {
- // Get the InputSection before us, we are by definition last
- auto RI = cast<OutputSection>(this->OutSec)->Sections.rbegin();
- InputSection *LE = *(++RI);
- InputSection *LC = cast<InputSection>(LE->getLinkOrderDep());
- uint64_t S = LC->OutSec->Addr + LC->getOffset(LC->getSize());
- uint64_t P = this->getVA();
+ uint64_t S = 0;
+ uint64_t P = getVA();
+ std::vector<std::vector<InputSection *> *> Ranges =
+ Script->inputSectionRanges(OutSec->Name);
+ for (std::vector<InputSection *> *Range : Ranges)
+ for (InputSection *IS : *Range)
+ if (IS->kind() != InputSectionBase::Synthetic) {
+ InputSection *LS = cast<InputSection>(IS->getLinkOrderDep());
+ S = std::max(S, LS->OutSec->Addr + LS->getOffset(LS->getSize()));
+ }
Target->relocateOne(Buf, R_ARM_PREL31, S - P);
write32le(Buf + 4, 0x1);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33500.100240.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/0664a0c6/attachment.bin>
More information about the llvm-commits
mailing list