1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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
This commit is contained in:
Chris Lattner 2010-01-19 06:22:22 +00:00
parent 79166b498e
commit dcd325e360
2 changed files with 10 additions and 1 deletions

View File

@ -63,6 +63,8 @@ public:
void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
const MCAsmInfo &getMAI() const { return MAI; }
private:
int getNextChar();
AsmToken ReturnError(const char *Loc, const std::string &Msg);

View File

@ -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))