aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-21 23:30:15 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-21 23:30:15 +0000
commit2330df6b66e6ca7cfad54be9088f0d931cc66441 (patch)
tree0f11e02054811d0ff4ac85eed9115585f938481d /tools/llvm-mc
parenta887ae4608c97f75feae6c89af33ecc2eadbc210 (diff)
llvm-mc: Improve handling of implicit alignment for magic section directives
(e.g., .objc_message_refs). - Just emit a .align when we see the directive; this isn't exactly what 'as' does but in practice it should be ok, at least for now. See FIXME. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/AsmParser.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 9db0ac0351..1978121297 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -794,13 +794,24 @@ bool AsmParser::ParseDirectiveSectionSwitch(const char *Segment,
// FIXME: Arch specific.
// FIXME: Cache this!
- // FIXME: Handle the implicit alignment!!
MCSection *S = 0; // Ctx.GetSection(Section);
if (S == 0)
S = MCSectionMachO::Create(Segment, Section, TAA, StubSize,
SectionKind(), Ctx);
Out.SwitchSection(S);
+
+ // Set the implicit alignment, if any.
+ //
+ // FIXME: This isn't really what 'as' does; I think it just uses the implicit
+ // alignment on the section (e.g., if one manually inserts bytes into the
+ // section, then just issueing the section switch directive will not realign
+ // the section. However, this is arguably more reasonable behavior, and there
+ // is no good reason for someone to intentionally emit incorrectly sized
+ // values into the implicitly aligned sections.
+ if (Align)
+ Out.EmitValueToAlignment(Align, 0, 1, 0);
+
return false;
}