]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
lld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC
authoremaste <emaste@FreeBSD.org>
Wed, 9 May 2018 11:17:01 +0000 (11:17 +0000)
committeremaste <emaste@FreeBSD.org>
Wed, 9 May 2018 11:17:01 +0000 (11:17 +0000)
commit2149cb08d126b20a12dff057cce5183280727a5b
tree436ac4557d3d7100242384ccad78203feb25fee7
parent0490c97003af3593d267cae1f89ebf3afe01af12
lld: Omit PT_NOTE for SHT_NOTE without SHF_ALLOC

A non-alloc note section should not have a PT_NOTE program header.

Found while linking ghc (Haskell compiler) with lld on FreeBSD.  Haskell
emits a .debug-ghc-link-info note section (as the name suggests, it
contains link info) as a SHT_NOTE section without SHF_ALLOC set.

For this case ld.bfd does not emit a PT_NOTE segment for
.debug-ghc-link-info.  lld previously emitted a PT_NOTE with p_vaddr = 0
and FreeBSD's rtld segfaulted when trying to parse a note at address 0.

LLVM PR: https://llvm.org/pr37361
LLVM review: https://reviews.llvm.org/D46623

PR: 226872
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
contrib/llvm/tools/lld/ELF/Writer.cpp
lib/clang/include/lld/Common/Version.inc