[PATCH] D24750: [GC] Don't crash while processing Discarded sections
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 11:58:44 PDT 2016
davide added a comment.
Circling back to this. I implemented a diagnostic in https://reviews.llvm.org/D24837
I think we should still skip sections here. They're not compliant to the ELF spec but the comment in Symbols.cpp suggests we can't do otherwise.
// According to the ELF spec reference to a local symbol from outside
// the group are not allowed. Unfortunately .eh_frame breaks that rule
// and must be treated specially. For now we just replace the symbol with
// 0.
if (SC == &InputSection<ELFT>::Discarded)
return 0;
Already other parts of this algorithm skip the section if `IS == &InputSection<ELFT>::Discarded` and the reasons why we didn't notice in the non `--gc-sections` case I think is that `markLive()` runs earlier than `scanRelocs()` , does resolve relocation itself and there's no special handling in there for `::Discarded`.
That said, I think that a better place to put this check would be the `Enqueue` lambda. That goes without saying, I might be mistaken, so, comments welcome.
https://reviews.llvm.org/D24750
More information about the llvm-commits
mailing list