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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user