summaryrefslogtreecommitdiff
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index f6b62b778b36..ddfda6ca34b8 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -2635,6 +2635,23 @@ template <class ELFT> void Writer<ELFT>::setPhdrs(Partition &part) {
OutputSection *first = p->firstSec;
OutputSection *last = p->lastSec;
+ // .ARM.exidx sections may not be within a single .ARM.exidx
+ // output section. We always want to describe just the
+ // SyntheticSection.
+ if (part.armExidx && p->p_type == PT_ARM_EXIDX) {
+ p->p_filesz = part.armExidx->getSize();
+ p->p_memsz = part.armExidx->getSize();
+ p->p_offset = first->offset + part.armExidx->outSecOff;
+ p->p_vaddr = first->addr + part.armExidx->outSecOff;
+ p->p_align = part.armExidx->addralign;
+ if (part.elfHeader)
+ p->p_offset -= part.elfHeader->getParent()->offset;
+
+ if (!p->hasLMA)
+ p->p_paddr = first->getLMA() + part.armExidx->outSecOff;
+ return;
+ }
+
if (first) {
p->p_filesz = last->offset - first->offset;
if (last->type != SHT_NOBITS)