diff options
| author | Sean Fertile <sfertile@ca.ibm.com> | 2019-06-06 20:16:59 +0000 |
|---|---|---|
| committer | Sean Fertile <sfertile@ca.ibm.com> | 2019-06-06 20:16:59 +0000 |
| commit | 6a573e3ec3ead4266e9f1092033295f9bb402955 (patch) | |
| tree | 957d8c346d96342f98736cd3f10169dc48f6b0d0 /lld/ELF/InputSection.cpp | |
| parent | 6ba76dd77952af32d08fa547e8b3984c7816bbd1 (diff) | |
| download | bcm5719-llvm-6a573e3ec3ead4266e9f1092033295f9bb402955.tar.gz bcm5719-llvm-6a573e3ec3ead4266e9f1092033295f9bb402955.zip | |
Revert "Revert "[ELF] Suppress "STT_SECTION symbol should be defined" on .eh_frame, .debug*, .zdebug* and .gcc_except_table""
This reverts commit f49f58527a6d8147524d8d6f2eb1feb70f856292.
llvm-svn: 362744
Diffstat (limited to 'lld/ELF/InputSection.cpp')
| -rw-r--r-- | lld/ELF/InputSection.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 832e02cb2a8..d09eae1a2f4 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -412,7 +412,8 @@ void InputSection::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels) { for (const RelTy &Rel : Rels) { RelType Type = Rel.getType(Config->IsMips64EL); - Symbol &Sym = getFile<ELFT>()->getRelocTargetSym(Rel); + const ObjFile<ELFT> *File = getFile<ELFT>(); + Symbol &Sym = File->getRelocTargetSym(Rel); auto *P = reinterpret_cast<typename ELFT::Rela *>(Buf); Buf += sizeof(RelTy); @@ -435,10 +436,20 @@ void InputSection::copyRelocations(uint8_t *Buf, ArrayRef<RelTy> Rels) { // .eh_frame is horribly special and can reference discarded sections. To // avoid having to parse and recreate .eh_frame, we just replace any // relocation in it pointing to discarded sections with R_*_NONE, which - // hopefully creates a frame that is ignored at runtime. + // hopefully creates a frame that is ignored at runtime. Also, don't warn + // on .gcc_except_table and debug sections. auto *D = dyn_cast<Defined>(&Sym); if (!D) { - warn("STT_SECTION symbol should be defined"); + if (!Sec->Name.startswith(".debug") && + !Sec->Name.startswith(".zdebug") && Sec->Name != ".eh_frame" && + Sec->Name != ".gcc_except_table") { + uint32_t SecIdx = cast<Undefined>(Sym).DiscardedSecIdx; + Elf_Shdr_Impl<ELFT> Sec = + CHECK(File->getObj().sections(), File)[SecIdx]; + warn("relocation refers to a discarded section: " + + CHECK(File->getObj().getSectionName(&Sec), File) + + "\n>>> referenced by " + getObjMsg(P->r_offset)); + } P->setSymbolAndType(0, 0, false); continue; } |

