This is the mail archive of the 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: [PATCH] aarch64: Fix the documentation on :pg_hi21:

On Thu, 29 May 2014, Yufeng Zhang wrote:

On 05/29/14 13:19, Yufeng Zhang wrote:
Hi Martin,

On 05/29/14 13:00, Martin Storsjo wrote:
The syntax described, including a leading '#', was not supported
in practice. (For :lo12: it is optional.)

I believe this is an issue in the parser; '#' should be optional in
either case.

It looks like gas/config/tc-aarch64.c:parse_adrp () is missing the
skip_past_char (&p, '#') at its beginning; see parse_half () for an example.

After spending some time this afternoon reading ARMv8 Architecture Reference Manual (ARMARM) and having a discussion with a colleague, I think I'll have to take back what I just said. Sorry!

The A64 assembly language allows the optional # character to introduce constant immediate operands, e.g. in LDR instructions with immediate offset:

 LDR <Wt>, [<Xn|SP>], #<simm>

and in the bitfield move instructions:

 BFM <Wd>, <Wn>, #<immr>, #<imms>

The ADRP instruction, however, has the following syntax:

 ADRP <Xd>, <label>

whose second operand is a program label whose 4KB page address is to be calculated, and for such a operand, it doesn't make much sense to allow the # character as an optional prefix, e.g. ADRP X0, #foo would look weird and confusing.

So I think your original patch is the right one to go with, and my only comment is to remove both # characters from the line of

 @samp{#:pg_hi21:} and @samp{#:lo12:} respectively.

Apologize again for the previous wrong direction.

Please get an approval from Marcus.

Ok, thanks - this explanation makes sense.

// Martin

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