summaryrefslogtreecommitdiff
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 1820e3cd9d0c..e95cca993bec 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3496,7 +3496,7 @@ void ARMExidxSyntheticSection::finalizeContents() {
}
executableSections = std::move(selectedSections);
}
-
+ // offset is within the SyntheticSection.
size_t offset = 0;
size = 0;
for (InputSection *isec : executableSections) {
@@ -3538,7 +3538,10 @@ void ARMExidxSyntheticSection::writeTo(uint8_t *buf) {
dataOffset += 4)
write32(buf + offset + dataOffset,
read32(d->content().data() + dataOffset));
- target->relocateAlloc(*d, buf + d->outSecOff);
+ // Recalculate outSecOff as finalizeAddressDependentContent()
+ // may have altered syntheticSection outSecOff.
+ d->outSecOff = offset + outSecOff;
+ target->relocateAlloc(*d, buf + offset);
offset += d->getSize();
} else {
// A Linker generated CANTUNWIND section.