[ELF] Fallback to sh_link=0 if neither .dynsym nor .symtab exists
authorFangrui Song <maskray@google.com>
Tue, 30 Oct 2018 20:54:54 +0000 (20:54 +0000)
committerFangrui Song <maskray@google.com>
Tue, 30 Oct 2018 20:54:54 +0000 (20:54 +0000)
commite0799a72683e5dd0570537755c5afea409e89484
tree648a196add45cf8986bec3dae2c846a6182c5f04
parent4c39dfc91e1feb9f937f2ed2b79c5479a2323b65
[ELF] Fallback to sh_link=0 if neither .dynsym nor .symtab exists

Summary: .rela.plt may only contain R_*_{,I}RELATIVE relocations and not need a symbol table link. bfd/gold fallbacks to sh_link=0 in this case. Without this patch, ld.lld --strip-all caused lld to dereference a null pointer.

Reviewers: ruiu, grimar, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 345648
lld/ELF/SyntheticSections.cpp
lld/test/ELF/gnu-ifunc-relative.s