[RFC][AARCH64][GAS]Stop creating new frag for .inst directive

Nicholas Clifton nickc@redhat.com
Wed Mar 25 13:23:00 GMT 2015


Hi Renlin,

> I don't see any particular reasons why we call frag_align_code here.
> If it's indeed have reasons to do so, I would be quite happy if somebody
> could explain it to me.

Certainly.  It is there in order to ensure 4-byte alignment when 
generating instructions.  Consider this variation of your test case:

         .inst 0x01020304
         nop
         .short 0x1234
         .inst 0x12345678

With your patch applied this generates:

    0:   01020304        .inst   0x01020304 ; undefined
    4:   d503201f        nop
    8:   1234            .short  0x1234
    a:   12345678        and     w24, w19, #0xfffff003

Whereas the current code produces:

    0:   01020304        .inst   0x01020304 ; undefined
    4:   d503201f        nop
    8:   1234            .short  0x1234
    a:   0000            .short  0x0000
    c:   12345678        and     w24, w19, #0xfffff003

Note the two bytes of padding at address 0xa, so that the second .inst 
pseudo starts on a 4-byte aligned boundary.

Cheers
   Nick

PS.  Your test case was missing a 1: label, and the error message needed 
to be in quotes...



More information about the Binutils mailing list