public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Joseph Faulls <Joseph.Faulls@imgtec.com>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>,
	 "palmer@rivosinc.com" <palmer@rivosinc.com>,
	 "nelson@rivosinc.com" <nelson@rivosinc.com>
Subject: RE: [EXTERNAL] Re: [PATCH] RISC-V: Do not gp relax against an ABS symbol if it is far away.
Date: Tue, 8 Aug 2023 13:04:05 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2308081253390.38537@angie.orcam.me.uk> (raw)
In-Reply-To: <LO4P265MB59144C9A915B70461B7A7012800DA@LO4P265MB5914.GBRP265.PROD.OUTLOOK.COM>

On Tue, 8 Aug 2023, Joseph Faulls wrote:

> > What's the use case for using AUIPC/LW to load an absolute symbol?  
> > Such symbols are not used in contexts where an address could 
> > alternatively be expected, so the correct sequence, and in PIC or PIE 
> > code indeed the only valid, for direct references from code is 
> > LUI/ADDI
> 
> For my clarification, are you saying that the AUIPC/LW should never have 
> been generated? If so, how is it possible for the compiler to know that 
> the symbol referenced will be an absolute symbol?

 No, the compiler won't ever know that a reference will ultimately resolve 
to an absolute symbol; I don't think there's a way to tell it.  Then such 
symbols aren't usually used in compiled code as they are awkward to refer 
to (e.g. in C you'll only ever use `&symbol' to get at one).  Most often 
I'd expect them to be referred in handcoded assembly, via the LI macro, 
and possibly defined via the GAS's or LD's `--defsym' command-line option, 
or in a linker script.

  Maciej

  reply	other threads:[~2023-08-08 12:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 16:48 Joseph Faulls
2023-07-27 17:02 ` Andreas Schwab
2023-07-27 21:08 ` Palmer Dabbelt
2023-07-28  1:02   ` Nelson Chu
2023-07-28  1:15     ` Nelson Chu
2023-07-28  9:18       ` [EXTERNAL] " Joseph Faulls
2023-07-28 15:03         ` Palmer Dabbelt
2023-07-28 15:52           ` Joseph Faulls
2023-07-28 16:12             ` Palmer Dabbelt
2023-08-08  9:49 ` Maciej W. Rozycki
2023-08-08 10:38   ` [EXTERNAL] " Joseph Faulls
2023-08-08 12:04     ` Maciej W. Rozycki [this message]
2023-08-23 11:16     ` Joseph Faulls

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=alpine.DEB.2.21.2308081253390.38537@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=Joseph.Faulls@imgtec.com \
    --cc=binutils@sourceware.org \
    --cc=nelson@rivosinc.com \
    --cc=palmer@rivosinc.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).