diff options
author | Petr Hosek <phosek@chromium.org> | 2016-09-20 20:21:13 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2016-09-20 20:21:13 +0000 |
commit | 1290355f5ad38d174abca256d2f55c7b1c09912e (patch) | |
tree | 7c37268809123ccc975387ea19301b319e4a4e52 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | c7368287b74d2d0867e79944b034de974e776e6e (diff) | |
download | llvm-1290355f5ad38d174abca256d2f55c7b1c09912e.zip llvm-1290355f5ad38d174abca256d2f55c7b1c09912e.tar.gz llvm-1290355f5ad38d174abca256d2f55c7b1c09912e.tar.bz2 |
Mark ELF sections whose name start with .note as note
Previously, such section would be marked as SHT_PROGBITS which
makes it impossible to use an initialized C variable declaration
to emit an (allocated) ELF note. The new behavior is also consistent
with ELF assembly parser.
Differential Revision: https://reviews.llvm.org/D24692
llvm-svn: 282010
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 218b45c9e..b8339ee 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -151,6 +151,11 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) { static unsigned getELFSectionType(StringRef Name, SectionKind K) { + // Use SHT_NOTE for section whose name starts with ".note" to allow + // emitting ELF notes from C variable declaration. + // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77609 + if (Name.startswith(".note")) + return ELF::SHT_NOTE; if (Name == ".init_array") return ELF::SHT_INIT_ARRAY; |