[lld] r244317 - ELF: Correctly identify SHT_NOTE sections with !SHF_ALLOC as type*Note
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 07:36:04 PDT 2015
Author: tstellar
Date: Fri Aug 7 09:36:04 2015
New Revision: 244317
URL: http://llvm.org/viewvc/llvm-project?rev=244317&view=rev
Log:
ELF: Correctly identify SHT_NOTE sections with !SHF_ALLOC as type*Note
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11266
Modified:
lld/trunk/lib/ReaderWriter/ELF/Atoms.cpp
lld/trunk/test/elf/note.test
Modified: lld/trunk/lib/ReaderWriter/ELF/Atoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Atoms.cpp?rev=244317&r1=244316&r2=244317&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Atoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Atoms.cpp Fri Aug 7 09:36:04 2015
@@ -71,8 +71,13 @@ DefinedAtom::ContentType ELFDefinedAtom<
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;
Modified: lld/trunk/test/elf/note.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/note.test?rev=244317&r1=244316&r2=244317&view=diff
==============================================================================
--- lld/trunk/test/elf/note.test (original)
+++ lld/trunk/test/elf/note.test Fri Aug 7 09:36:04 2015
@@ -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:
More information about the llvm-commits
mailing list