This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi Nick,

Thank you for the explanation, it's now clear to me.
I will try to reconsider it and find another approach.

Regards,
Renlin

On 25/03/15 13:23, Nicholas Clifton wrote:
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...



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]