forked from OSchip/llvm-project
MCParser: Reject .balign with non-pow2 alignments.
GNU as rejects them and there are configure scripts in the wild that check if the assembler rejects ".align 3" to determine whether the alignment is in bytes or powers of two. llvm-svn: 175360
This commit is contained in:
parent
d784d96074
commit
64bf78046e
|
@ -2456,6 +2456,10 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
|
|||
}
|
||||
|
||||
Alignment = 1ULL << Alignment;
|
||||
} else {
|
||||
// Reject alignments that aren't a power of two, for gas compatibility.
|
||||
if (!isPowerOf2_64(Alignment))
|
||||
Error(AlignmentLoc, "alignment must be a power of 2");
|
||||
}
|
||||
|
||||
// Diagnose non-sensical max bytes to align.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# RUN: llvm-mc -triple i386-linux-gnu < %s 2>&1 | FileCheck %s -check-prefix=ELF
|
||||
# RUN: llvm-mc -triple i386-apple-darwin < %s 2>&1 | FileCheck %s -check-prefix=DARWIN
|
||||
|
||||
.align 3
|
||||
# ELF: error: alignment must be a power of 2
|
||||
# DARWIN-NOT: error
|
||||
|
||||
.align 32
|
||||
# ELF-NOT: error
|
||||
# DARWIN: error: invalid alignment value
|
Loading…
Reference in New Issue