diff options
author | Fangrui Song <maskray@google.com> | 2019-09-20 15:03:21 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-09-20 15:03:21 +0000 |
commit | 267205149587595e956db25a12252835a51cd372 (patch) | |
tree | bb4e841a9dd2e00124099adbec65e8ab11e311e8 /llvm/lib | |
parent | be428513cb05893e74a7276a21b12b709db53bb9 (diff) | |
download | bcm5719-llvm-267205149587595e956db25a12252835a51cd372.tar.gz bcm5719-llvm-267205149587595e956db25a12252835a51cd372.zip |
[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
Diffstat (limited to 'llvm/lib')
0 files changed, 0 insertions, 0 deletions