ELF: Correctly identify SHT_NOTE sections with !SHF_ALLOC as type*Note

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11266

llvm-svn: 244317
This commit is contained in:
Tom Stellard 2015-08-07 14:36:04 +00:00
parent 2ab51bf13a
commit 01da42d8db
2 changed files with 10 additions and 3 deletions

View File

@ -71,8 +71,13 @@ DefinedAtom::ContentType ELFDefinedAtom<ELFT>::doContentType() const {
return typeGnuLinkOnce;
uint64_t flags = _section->sh_flags;
if (!(flags & SHF_ALLOC))
if (!(flags & SHF_ALLOC)) {
if (_section->sh_type == SHT_NOTE)
return (flags == SHF_WRITE) ? typeRWNote : typeRONote;
return _contentType = typeNoAlloc;
}
if (_section->sh_flags == (SHF_ALLOC | SHF_WRITE | SHF_TLS))
return _section->sh_type == SHT_NOBITS ? typeThreadZeroFill
: typeThreadData;

View File

@ -1,9 +1,11 @@
# Check that the linker is not ignoring input sections.
# RUN: yaml2obj -format=elf %s > %t.obj
# RUN: lld -flavor gnu -target x86_64 %t.obj -o %t.exe --noinhibit-exec
# RUN: llvm-objdump -h %t.exe | FileCheck %s
# RUN: llvm-readobj -s %t.exe | FileCheck %s
# CHECK: {{[0-9]+}} .note
# CHECK: Section {
# CHECK: Name: .note
# CHECK-NEXT: Type: SHT_NOTE
---
FileHeader: