[PATCH] D44679: [ELF] - Another fix for "LLD crashes with --emit-relocs when trying to proccess .eh_frame"
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 21 03:08:18 PDT 2018
grimar added inline comments.
================
Comment at: ELF/LinkerScript.cpp:664
+ Add(IS);
+ for (InputSectionBase *IS : InputSections)
+ Add(IS);
----------------
espindola wrote:
> 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);
>
Such approach is much more test case friendly, thanks.
We use/can use `(IS->Type == SHT_REL || IS->Type == SHT_RELA) && !isa<SyntheticSection>(IS)`
condition so many times in code that I even think about some kind of helper for that.
https://reviews.llvm.org/D44679
More information about the llvm-commits
mailing list