aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/ELFAsmParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-10-27 18:45:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-10-27 18:45:20 +0000
commit4fa3478fc2bf622eaa249602c23b9b3c23d7f2eb (patch)
tree7ec7d6dd8d150f48b155e20a6d13e83155366fda /lib/MC/MCParser/ELFAsmParser.cpp
parent82203218d1d801e5c0bdc33fe6afac2e91939a03 (diff)
Set default type and flags for .init and .fini.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/ELFAsmParser.cpp')
-rw-r--r--lib/MC/MCParser/ELFAsmParser.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp
index 33fdf98bcf..83c562bf4a 100644
--- a/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/lib/MC/MCParser/ELFAsmParser.cpp
@@ -240,6 +240,15 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
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 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
}
}
- unsigned Type = MCSectionELF::SHT_NULL;
if (!TypeName.empty()) {
if (TypeName == "init_array")
Type = MCSectionELF::SHT_INIT_ARRAY;