This is an archive of the discontinued LLVM Phabricator instance.

[ELF] -r: don't crash when a non-SHF_LINK_ORDER orphan is added before a SHF_LINK_ORDER orphan
ClosedPublic

Authored by MaskRay on Oct 26 2020, 5:21 PM.

Details

Summary

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.

Diff Detail

Event Timeline

MaskRay created this revision.Oct 26 2020, 5:21 PM
MaskRay requested review of this revision.Oct 26 2020, 5:21 PM
grimar added inline comments.Oct 27 2020, 12:06 AM
lld/ELF/LinkerScript.cpp
693–697

Probably you shouldn't use auto, because the return type is not obvious here.

lld/test/ELF/linkorder-mixed2.s
13

I'd add the Hex dump of section 'foo' check line and used CHECK-NEXT for this one, just in case.

MaskRay marked 2 inline comments as done.Oct 27 2020, 9:30 AM
grimar accepted this revision.Oct 28 2020, 12:00 AM

LGTM

This revision is now accepted and ready to land.Oct 28 2020, 12:00 AM