[ELF] --gc-sections: retain dependent sections of non-SHF_ALLOC sections
authorFangrui Song <i@maskray.me>
Wed, 21 Oct 2020 17:11:20 +0000 (10:11 -0700)
committerFangrui Song <i@maskray.me>
Wed, 21 Oct 2020 17:11:26 +0000 (10:11 -0700)
commitb6e4aae2cc269bbdce9263cd49dcd582840b333a
treee3406f8f81ec458d984d03c2f2370af362c1e5b7
parentcdc90ec7876d3d6b343aa2917e6e3d5436c0a99e
[ELF] --gc-sections: retain dependent sections of non-SHF_ALLOC sections

Fix http://lists.llvm.org/pipermail/llvm-dev/2020-October/145908.html

Currently non-SHF_ALLOC SHT_REL[A] (due to --emit-relocs) and SHF_LINK_ORDER are not
marked live.

Reviewed By: grimar, psmith

Differential Revision: https://reviews.llvm.org/D89841
lld/ELF/MarkLive.cpp
lld/test/ELF/gc-sections-linkorder2.s