public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: Arm64: assembling adrp with operand involving .
Date: Mon, 14 Feb 2022 15:04:51 +0100	[thread overview]
Message-ID: <716e0452-bbd3-2e97-84c9-f5f11d8b9b0a@suse.com> (raw)
In-Reply-To: <84567b31-7ed1-a377-7d05-8b6596871ae7@redhat.com>

On 14.02.2022 14:35, Nick Clifton wrote:
>> I would expect these two
>>
>> 	adrp	x0, .
>> 1:	adrp	x0, 1b
>>
>> to assemble to the same encoding with similar attached relocations.
> 
> Me too.
> 
>> The first, however, appears to have evaluation of . deferred until the
>> end of assembly, i.e. the resulting operand depends on the number of
>> subsequent insns in the same source file. At a guess this is fallout
>> from eac4eb8ecb26 "Fix a problem assembling AArch64 sources when a
>> relocation is generated against a..." (for some reason the title is
>> truncated).
> 
> That is because I put the rest of the description on a second line, sorry.
> The second line reads:
> 
>   generated against a symbol that has a defined value.
> 
> The patch was created as a fix for PR 27217.
> 
>>  According to my observations other insns aren't affected,
>> yet the change to parse_adrp() doesn't really stand out in said commit.
>> Hence I'm neither really certain that's the one, nor how a possible fix
>> could look like. Do you have any thoughts?
> 
> Well the change added a new argument to the ...get_expression() function,
> so all callers were updated.  There was no specific intention to change
> parse_adrp for some other reason.
> 
> Anyway - this does look like a bug, although I think that it might be
> restricted to just an unadorned reference to dot.  ie:
> 
>    adrp	x0, .
>    1:	adrp	x0, 1b
>    adrp	x0, . - 8
> 
> When assembled and then dumped, gives:
> 
> 0000000000000000 <.text>:
>     0:	90000000 	adrp	x0, 0 <.text>
> 			0: R_AARCH64_ADR_PREL_PG_HI21	.text+0xc
>     4:	90000000 	adrp	x0, 0 <.text>
> 			4: R_AARCH64_ADR_PREL_PG_HI21	.text+0x4
>     8:	90000000 	adrp	x0, 0 <.text>
> 			8: R_AARCH64_ADR_PREL_PG_HI21	.text+0x4
> 
> So the ". - 8" expression has evaluated correctly, but the "." expression
> has not.

I've mentioned this aspect in the bug (see below), but now that I look
again I'm not sure anymore: Wouldn't this be .text+0? And isn't it
getting close only because no further insns are following?

>  Would you care to open a BZ for this ?

Bug 28888.

Jan


  reply	other threads:[~2022-02-14 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14  7:55 Jan Beulich
2022-02-14 13:35 ` Nick Clifton
2022-02-14 14:04   ` Jan Beulich [this message]
2022-05-03 13:26   ` Jan Beulich
2022-05-09 15:21     ` Nick Clifton
2022-05-18  7:26       ` Jan Beulich
2022-06-27 14:03         ` Jan Beulich
2022-06-27 14:34           ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=716e0452-bbd3-2e97-84c9-f5f11d8b9b0a@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).