diff options
| author | Davide Italiano <davide@freebsd.org> | 2015-09-08 18:59:47 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2015-09-08 18:59:47 +0000 |
| commit | cb2da7166ad38ec1174aca3fec9e3034923806ee (patch) | |
| tree | 6b030d5c881c69d4fffe991b422d15ca359147ba /llvm/lib/MC | |
| parent | 12dd3c4ebb2956413788a301ef0daf48cbbb05d0 (diff) | |
| download | bcm5719-llvm-cb2da7166ad38ec1174aca3fec9e3034923806ee.tar.gz bcm5719-llvm-cb2da7166ad38ec1174aca3fec9e3034923806ee.zip | |
[MC/ELF] Accept zero for .align directive
.align directive refuses alignment 0 -- a comment in the code hints this is
done for GNU as compatibility, but it seems GNU as accepts .align 0
(and silently rounds up alignment to 1).
Differential Revision: http://reviews.llvm.org/D12682
llvm-svn: 247048
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 5e174de8a93..7126a909b9e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2706,7 +2706,11 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) { Alignment = 1ULL << Alignment; } else { - // Reject alignments that aren't a power of two, for gas compatibility. + // Reject alignments that aren't either a power of two or zero, + // for gas compatibility. Alignment of zero is silently rounded + // up to one. + if (Alignment == 0) + Alignment = 1; if (!isPowerOf2_64(Alignment)) Error(AlignmentLoc, "alignment must be a power of 2"); } |

