[lld] r304009 - Avoid using EhFrameHdr->Sections.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 10:28:17 PDT 2017
Author: rafael
Date: Fri May 26 12:28:17 2017
New Revision: 304009
URL: http://llvm.org/viewvc/llvm-project?rev=304009&view=rev
Log:
Avoid using EhFrameHdr->Sections.
This is a necessary step for moving clearOutputSections earlier.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=304009&r1=304008&r2=304009&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri May 26 12:28:17 2017
@@ -1785,7 +1785,9 @@ template <class ELFT> void Writer<ELFT>:
}
OutputSection *EhFrameHdr =
- In<ELFT>::EhFrameHdr ? In<ELFT>::EhFrameHdr->OutSec : nullptr;
+ (In<ELFT>::EhFrameHdr && !In<ELFT>::EhFrameHdr->empty())
+ ? In<ELFT>::EhFrameHdr->OutSec
+ : nullptr;
// In -r or -emit-relocs mode, write the relocation sections first as in
// ELf_Rel targets we might find out that we need to modify the relocated
@@ -1811,7 +1813,7 @@ template <class ELFT> void Writer<ELFT>:
// The .eh_frame_hdr depends on .eh_frame section contents, therefore
// it should be written after .eh_frame is written.
- if (EhFrameHdr && !EhFrameHdr->Sections.empty()) {
+ if (EhFrameHdr) {
OutputSectionCommand *Cmd = Script->getCmd(EhFrameHdr);
Cmd->writeTo<ELFT>(Buf + EhFrameHdr->Offset);
}
More information about the llvm-commits
mailing list