summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-05-26 17:28:17 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-05-26 17:28:17 +0000
commit881cc1643a707b06951c7424b4caacd9e3ecab66 (patch)
tree70def2619dbd92590f14d1b71c6f278d9c5f1f3d
parentd23e9267a6a5b82c12c4c53e0f00479926734e3b (diff)
downloadbcm5719-llvm-881cc1643a707b06951c7424b4caacd9e3ecab66.tar.gz
bcm5719-llvm-881cc1643a707b06951c7424b4caacd9e3ecab66.zip
Avoid using EhFrameHdr->Sections.
This is a necessary step for moving clearOutputSections earlier. llvm-svn: 304009
-rw-r--r--lld/ELF/Writer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index eae533776a2..7e0b0f1d3c7 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1785,7 +1785,9 @@ template <class ELFT> void Writer<ELFT>::writeSections() {
}
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>::writeSections() {
// 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);
}
OpenPOWER on IntegriCloud