Add an entry for rodata constant merge sections to the default
section flags in the ELF assembler. This matches the defaults
given in the rest of MC.
Fixes PR37997 where we couldn't assemble our own assembly output
without warnings.
llvm-svn: 336072
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 93513a2..67e3512 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -486,6 +486,9 @@
// defaults.
static unsigned defaultSectionFlags(StringRef SectionName) {
+ if (hasPrefix(SectionName, ".rodata.cst"))
+ return ELF::SHF_ALLOC | ELF::SHF_MERGE;
+
if (hasPrefix(SectionName, ".rodata.") || SectionName == ".rodata1")
return ELF::SHF_ALLOC;