ELF: Fix ICF crash on absolute symbol relocations.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 20 Jan 2017 04:58:12 +0000 (04:58 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 20 Jan 2017 04:58:12 +0000 (04:58 +0000)
commitdbd8d9b5a21f39634120d15f96ba632f40cdaad9
tree47112452681e7bdfe6c121a4cce46472c0bf0361
parentccf18131500917133a0eff97d16cd71572473e54
ELF: Fix ICF crash on absolute symbol relocations.

If two sections contained relocations to absolute symbols with the same
value we would crash when trying to access their sections. Add a check that
both symbols point to sections before accessing their sections, and treat
absolute symbols as equal if their values are equal.

Differential Revision: https://reviews.llvm.org/D28935

llvm-svn: 292578
lld/ELF/ICF.cpp
lld/test/ELF/Inputs/icf-absolute.s [new file with mode: 0644]
lld/test/ELF/icf-absolute.s [new file with mode: 0644]