Fangrui Song 2672051495 [ELF] Error if the linked-to section of a SHF_LINK_ORDER section is discarded
Summary:
If st_link(A)=B, and A has the SHF_LINK_ORDER flag, we may dereference
a null pointer if B is garbage collected (PR43147):

1. In Wrter.cpp:compareByFilePosition, `aOut->sectionIndex` or `bOut->sectionIndex`
2. In OutputSections::finalize, `d->getParent()->sectionIndex`

Simply error and bail out to avoid null pointer dereferences. ld.bfd has
a similar error:

    sh_link of section `.bar' points to discarded section `.foo0' of `a.o'

ld.bfd is more permissive in that it just checks whether the linked-to
section of the first input section is discarded. This is likely because
it sets sh_link of the output section according to the first input
section.

Reviewed By: grimar

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

llvm-svn: 372400
2019-09-20 15:03:21 +00:00
..
2018-07-05 16:03:20 +00:00
2019-07-22 11:37:03 +00:00
2019-07-22 11:37:03 +00:00
2019-07-22 11:37:03 +00:00
2019-07-22 11:37:03 +00:00
2019-07-22 11:37:03 +00:00
2019-07-22 11:37:03 +00:00
2017-09-30 21:28:49 +00:00
2018-04-09 12:45:29 +00:00
2017-09-30 21:28:49 +00:00
2017-11-22 22:00:50 +00:00
2017-09-28 17:15:02 +00:00
2019-09-07 10:42:11 +00:00
2019-09-07 10:42:11 +00:00
2017-11-28 20:17:58 +00:00
2018-04-25 00:29:13 +00:00
2017-12-12 20:00:30 +00:00
2019-08-01 09:25:34 +00:00
2019-08-01 09:25:34 +00:00
2019-09-07 10:42:11 +00:00
2017-02-27 13:21:18 +00:00
2018-08-08 14:50:33 +00:00
2018-08-08 14:50:33 +00:00
2018-08-08 14:50:33 +00:00
2018-08-08 14:50:33 +00:00
2018-03-27 16:10:01 +00:00
2019-09-07 10:42:11 +00:00
2017-10-18 04:45:09 +00:00
2019-07-25 07:12:23 +00:00
2019-07-25 07:12:23 +00:00
2019-09-07 10:42:11 +00:00
2019-09-07 10:42:11 +00:00
2017-11-28 20:13:12 +00:00
2019-07-16 05:58:03 +00:00
2019-02-06 01:00:49 +00:00
2018-12-21 22:57:11 +00:00
2018-04-24 23:03:58 +00:00
2019-09-07 10:42:11 +00:00
2019-09-12 08:55:17 +00:00