[PATCH] D44622: [ELF] - Fix for "LLD crashes with --emit-relocs when trying to proccess .eh_frame"
Domagoj Stolfa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 19 16:00:13 PDT 2018
dstolfa added a comment.
In https://reviews.llvm.org/D44622#1042429, @espindola wrote:
> The crash is from
>
> // This is for --emit-relocs. If .text.foo is emitted as .text.bar, we want
> // to emit .rela.text.foo as .rela.text.bar for consistency (this is not
> // technically required, but not doing it is odd). This code guarantees that.
> if ((S->Type == SHT_REL || S->Type == SHT_RELA) &&
> !isa<SyntheticSection>(S)) {
> OutputSection *Out =
> cast<InputSection>(S)->getRelocatedSection()->getOutputSection();
>
>
> Where Out is null because we call this for the relocation section before .eh_frame. The caller is
>
> std::vector<OutputSection *> V;
> for (InputSectionBase *S : InputSections) {
> if (!S->Live || S->Parent)
> continue;
>
> StringRef Name = getOutputSectionName(S);
>
>
> So this suggests two options that might be simpler.
>
> - Just handle Out being null. We are just trying to get a better looking output section name. It is not critical.
> - Do two passes over the input section in LinkerScript::addOrphanSections.
This is the approach I've taken in https://reviews.llvm.org/D44601 (though it was still a workaround at that point). @arichardson pointed out that we should probably have an output similar to ld.bfd and gold, so I suppose the fix should be guided by that as well as where it would be best to handle this case?
https://reviews.llvm.org/D44622
More information about the llvm-commits
mailing list