From ab9cd3e132a86f99c8784c6025c6f55bb5cf2612 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 19 Jan 2010 06:22:22 +0000 Subject: fix parsing .comm directives on systems which do not represent alignments as a power of 2. This fixes MC/AsmParser/directive_comm.s llvm-svn: 93867 --- llvm/tools/llvm-mc/AsmParser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/tools/llvm-mc/AsmParser.cpp') diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp index d4af4bd0df6..0e7c3443d5a 100644 --- a/llvm/tools/llvm-mc/AsmParser.cpp +++ b/llvm/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)) -- cgit v1.2.3