public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: Arm64: assembling adrp with operand involving .
Date: Mon, 14 Feb 2022 13:35:13 +0000	[thread overview]
Message-ID: <84567b31-7ed1-a377-7d05-8b6596871ae7@redhat.com> (raw)
In-Reply-To: <2b85b841-e617-618c-9a3d-50101faded80@suse.com>

Hi Jan,

> 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.  Would you care to open a BZ for this ?

Cheers
   Nick


  reply	other threads:[~2022-02-14 13:35 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 [this message]
2022-02-14 14:04   ` Jan Beulich
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=84567b31-7ed1-a377-7d05-8b6596871ae7@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).