[lld] r313095 - Add a comment about a workaround for ld.gold -r.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 16:43:45 PDT 2017


Author: ruiu
Date: Tue Sep 12 16:43:45 2017
New Revision: 313095

URL: http://llvm.org/viewvc/llvm-project?rev=313095&view=rev
Log:
Add a comment about a workaround for ld.gold -r.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=313095&r1=313094&r2=313095&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Sep 12 16:43:45 2017
@@ -435,8 +435,15 @@ bool EhFrameSection<ELFT>::isFdeLive(EhS
                                      ArrayRef<RelTy> Rels) {
   auto *Sec = cast<EhInputSection>(Piece.ID);
   unsigned FirstRelI = Piece.FirstRelocation;
+
+  // An FDE should point to some function because FDEs are to describe
+  // functions. That's however not always the case due to an issue of
+  // ld.gold with -r. ld.gold may discard only functions and leave their
+  // corresponding FDEs, which results in creating bad .eh_frame sections.
+  // To deal with that, we ignore such FDEs.
   if (FirstRelI == (unsigned)-1)
     return false;
+
   const RelTy &Rel = Rels[FirstRelI];
   SymbolBody &B = Sec->template getFile<ELFT>()->getRelocTargetSym(Rel);
   auto *D = dyn_cast<DefinedRegular>(&B);




More information about the llvm-commits mailing list