[ELF] -r: don't crash when a non-SHF_LINK_ORDER orphan is added before a SHF_LINK_ORD...
authorFangrui Song <i@maskray.me>
Tue, 27 Oct 2020 16:30:10 +0000 (09:30 -0700)
committerFangrui Song <i@maskray.me>
Wed, 28 Oct 2020 15:56:42 +0000 (08:56 -0700)
commitae73091f30245852817c5c0af050a5a731dee50a
treee7dd04cb586b2c753e0090b42a8f7820715aa87e
parent0d17dc2e75428885e37e53a1524ce7b607501cfa
[ELF] -r: don't crash when a non-SHF_LINK_ORDER orphan is added before a SHF_LINK_ORDER orphan

Fixes https://github.com/ClangBuiltLinux/linux/issues/1186

If a non-SHF_LINK_ORDER orphan is added first, `firstIsec->flags & SHF_LINK_ORDER`
will be zero and we currently assert when calling `getLinkOrderDep`.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D90200
lld/ELF/LinkerScript.cpp
lld/test/ELF/linkorder-mixed2.s [new file with mode: 0644]