bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "as" data alignment bug


From: Nick Clifton
Subject: Re: "as" data alignment bug
Date: 20 Sep 2001 11:27:52 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Shannon,

> As version 2.10.91 from the IA64 Redhat release 7.1.

There is a later release available (2.11.2) but this also has the same
behaviour that you describe.

> I Think there is a bug in the way "as" is aligning the data when I 
> compile and data assembly file. For example the following snippit
> does not compile correctly.

It is not really a bug, it is a "feature" of the current
implementation of the IA64 port of GAS. :-)  Long term it should be
fixed, but for now there is a workaround available:

> Testasm:
>       .byte 0x11 0x22 0x33 0x44 0x55 0x66
>              .word 0x0077
>              .byte 0x88
>              .word 0x0099
>              .word 0x00aa
>              .byte 0xbb
>              .byte 0xcc
>              .byte 0xdd
   
> when I compile the Assembly above I get this
> 
> 11 22 33 44 55 66 77 00 88 00 99 00 aa 00 bb cc dd
> 
> but I am expecting
> 
> 11 22 33 44 55 66 77 00 88 99 00 aa 00 bb cc dd

The solution is to use the .2byte directive instead of the .word
directive.  This is an unaligned version of the .word directive.  ie:

   .byte  0x11, 0x22, 0x33, 0x44, 0x55, 0x66
   .2byte 0x0077
   .byte  0x88
   .2byte 0x0099
   .2byte 0x00aa
   .byte  0xbb
   .byte  0xcc
   .byte  0xdd

This will give you the output that you want.

Cheers
        Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]