This is an archive of the discontinued LLVM Phabricator instance.

[MC/ELF] Accept zero for .align directive
ClosedPublic

Authored by davide on Sep 7 2015, 5:00 PM.

Details

Summary

.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). This patch is an attempt to fix.

$ ./llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu blah.s -o blah
blah.s:4:8: error: alignment must be a power of 2
.align 0

^

$ as blah.s -o blah
$

$ cat blah.s
.global _start
.global bar

.align 0
.text
_start:
bar:

movl $bar, %edx

Diff Detail

Repository
rL LLVM

Event Timeline

davide updated this revision to Diff 34171.Sep 7 2015, 5:00 PM
davide retitled this revision from to [MC/ELF] Accept zero for .align directive.
davide updated this object.
davide added reviewers: Bigcheese, rafael, grosbach.
davide set the repository for this revision to rL LLVM.
davide added a subscriber: llvm-commits.
This revision was automatically updated to reflect the committed changes.