diff options
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r-- | lld/ELF/OutputSections.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 042bc44f11c..b456ac6fe79 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1168,8 +1168,16 @@ template <class ELFT> void EHOutputSection<ELFT>::writeTo(uint8_t *Buf) { } } - for (EHInputSection<ELFT> *S : Sections) - S->relocate(Buf); + for (EHInputSection<ELFT> *S : Sections) { + const Elf_Shdr *RelSec = S->RelocSection; + if (!RelSec) + continue; + ELFFile<ELFT> &EObj = S->getFile()->getObj(); + if (RelSec->sh_type == SHT_RELA) + S->relocate(Buf, nullptr, EObj.relas(RelSec)); + else + S->relocate(Buf, nullptr, EObj.rels(RelSec)); + } } template <class ELFT> |