[PATCH] D44679: [ELF] - Another fix for "LLD crashes with --emit-relocs when trying to proccess .eh_frame"

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 12:43:59 PDT 2018


espindola added inline comments.


================
Comment at: ELF/LinkerScript.cpp:664
+      Add(IS);
+  for (InputSectionBase *IS : InputSections)
+    Add(IS);
----------------
It turns out that we can do this with just one loop.

The requirement that we have is that relocated sections are added before the corresponding section. We can implement that with

+    if ((IS->Type == SHT_REL || IS->Type == SHT_RELA) && !isa<SyntheticSection>(IS))
+      if (auto *Rel = cast<InputSection>(IS)->getRelocatedSection())
+        if (auto *RelIS = dyn_cast_or_null<InputSectionBase>(Rel->Parent))
+          Add(RelIS);
+    Add(IS);



https://reviews.llvm.org/D44679





More information about the llvm-commits mailing list