https://reviews.llvm.org/rL312796 meant that references to garbage collected common symbols would cause a segfault.
This change fixes the behaviour for references to stripped common symbols.
Differential D37718
[ELF] Handle references to garbage collected common symbols bd1976llvm on Sep 11 2017, 3:47 PM. Authored by
Details https://reviews.llvm.org/rL312796 meant that references to garbage collected common symbols would cause a segfault. This change fixes the behaviour for references to stripped common symbols.
Diff Detail
Event TimelineComment Actions I don't remember why we don't have this check in getSymVA() for DefinedRegularKind. Should we actually be returning 0 for DefinedRegular if sections are dead too? Comment Actions Why is there a relocation for "unused" if it's marked not live? Offset Info Type Sym. Value Sym. Name + Addend 000000000000 000200000001 R_X86_64_64 0000000000000004 unused + 0 Comment Actions Definitely. I also think that we should change the code to treat regular and common symbols in the same way when it is possible. Comment Actions The target of the relocation is "unused". The relocation patches a section that remains live. This case commonly arises where the section that is being patched is informational and the linker can't garbage collect it e.g .debug_info. p.s: strech goal for the brave - actually a linker could garbage collect these sections but it would be a lot of work. Comment Actions I have a patch for what you are suggesting - is it ok to get this patch in first and put the improvements in as a later patch? Comment Actions I'm seeing breakages caused by this as well. Thanks for the fix! I'm also supportive of getting this patch in ASAP and looking into further improvements as a follow-up, since it fixes a linker crash. Comment Actions I posted this to the mailing list (copy here):
I have finally got around to doing this improvement work, please take a look at:
|