aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 06:22:22 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 06:22:22 +0000
commit258281d8ac7b6ab61d64948340038e5f6692e3c0 (patch)
tree72a6b3f76b0f30ef80614721c1ddac414c0703cf /tools/llvm-mc/AsmParser.cpp
parentf4d9a555ba99a9def419c57fd96d253961c05c84 (diff)
fix parsing .comm directives on systems which do not represent alignments
as a power of 2. This fixes MC/AsmParser/directive_comm.s git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index d4af4bd0df..0e7c3443d5 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -1278,6 +1278,13 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {
Pow2AlignmentLoc = Lexer.getLoc();
if (ParseAbsoluteExpression(Pow2Alignment))
return true;
+
+ // If this target takes alignments in bytes (not log) validate and convert.
+ if (Lexer.getMAI().getAlignmentIsInBytes()) {
+ if (!isPowerOf2_64(Pow2Alignment))
+ return Error(Pow2AlignmentLoc, "alignment must be a power of 2");
+ Pow2Alignment = Log2_64(Pow2Alignment);
+ }
}
if (Lexer.isNot(AsmToken::EndOfStatement))