[LLVMdev] .align 0

Jim Grosbach grosbach at apple.com
Tue Oct 29 10:00:43 PDT 2013


I do not see that behavior on Darwin with either the old assembler or the integrated assembler:
enkidu: ~/tmp $ cat t.s
.align 0
enkidu: ~/tmp $ as t.s
enkidu: ~/tmp $ clang -c t.s

Yeah, it looks like a combination of target and platform logic determines how the value is interpreted. It’s x86 ELF that’s the outlier here, expecting a value in number of bytes.

There is no mention of the special case for zero in https://sourceware.org/binutils/docs/as/Align.html#Align. From that, I would argue that the diagnostic is correct and the test cases are in error. If gas actually does default to ‘2’ for a specified value of zero, that seems really terrible and an error not to be repeated.

-Jim

On Oct 29, 2013, at 6:05 AM, Sid Manning <sidneym at codeaurora.org> wrote:

> 
> ".align 0" triggers the following error:
> 
> a.s:2:8: error: alignment must be a power of 2
> .align 0
>       ^
> In this case would it be reasonable to query the target for a default
> or minimum value?  Only targets not implementing this would error out.
> 
> Thanks,
> 
> On 10/28/2013 03:00 PM, Jim Grosbach wrote:
>> Apple’s assembler does use power-of-two for .align. I believe binutils
>> does as well. I suspect the header file comment is in error and what’s
>> actually happening is that the section in question has a minimum
>> alignment on the system(s) in question, and so it just looks like it’s
>> redundant. That is, I doubt we need to do anything here.
>> 
>> -Jim
>> 
>> On Oct 28, 2013, at 11:54 AM, Renato Golin <renato.golin at linaro.org
>> <mailto:renato.golin at linaro.org>> wrote:
>> 
>>> Hi Sid,
>>> 
>>> It seems Apple's assembler used to treat .align 0 differently:
>>> 
>>> https://developer.apple.com/library/mac/documentation/developertools/Reference/Assembler/040-Assembler_Directives/asm_directives.html
>>> 
>>> If this is still the case, than we should have an option for what to
>>> do in this case, maybe defaulting based on the triple?
>>> 
>>> cheers,
>>> --renato
>>> 
>>> 
>>> On 28 October 2013 17:53, Sid Manning <sidneym at codeaurora.org
>>> <mailto:sidneym at codeaurora.org>> wrote:
>>> 
>>> 
>>>    I have several assembly files in a testsuite that use, ".align 0".
>>>    I found a reference to, ".align 0" in ARM's elf.h that says .align
>>>    0 is redundant and gas treats this as align 2.
>>> 
>>>    Should the llvm-mc follow this convention?
>>> 
>>>    --
>>>    Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>>>    hosted by The Linux Foundation
>>>    _________________________________________________
>>>    LLVM Developers mailing list
>>>    LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>
>>>    http://llvm.cs.uiuc.edu <http://llvm.cs.uiuc.edu/>
>>>    http://lists.cs.uiuc.edu/__mailman/listinfo/llvmdev
>>>    <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>>> 
>>> 
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> 
> 
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131029/43fa849a/attachment.html>


More information about the llvm-dev mailing list