Set default type and flags for .init and .fini.
llvm-svn: 117471
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 33fdf98..83c562b 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -240,6 +240,15 @@
return TokError("unexpected token in directive");
unsigned Flags = 0;
+ unsigned Type = MCSectionELF::SHT_NULL;
+
+ // Set the defaults first.
+ if (SectionName == ".fini" || SectionName == ".init") {
+ Type = MCSectionELF::SHT_PROGBITS;
+ Flags |= MCSectionELF::SHF_ALLOC;
+ Flags |= MCSectionELF::SHF_EXECINSTR;
+ }
+
for (unsigned i = 0; i < FlagsStr.size(); i++) {
switch (FlagsStr[i]) {
case 'a':
@@ -271,7 +280,6 @@
}
}
- unsigned Type = MCSectionELF::SHT_NULL;
if (!TypeName.empty()) {
if (TypeName == "init_array")
Type = MCSectionELF::SHT_INIT_ARRAY;