public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: Fangrui Song <maskray@google.com>
Cc: Alan Modra <amodra@gmail.com>, Joseph Myers <josmyers@redhat.com>,
	binutils@sourceware.org, Fangrui Song <maskray@gcc.gnu.org>
Subject: Re: [PATCH v2] sh: Make protected symbols local for FDPIC -shared
Date: Sat, 09 Mar 2024 02:07:46 -0300	[thread overview]
Message-ID: <orbk7ogfh9.fsf@lxoliva.fsfla.org> (raw)
In-Reply-To: <20240307083206.deeatabdkuxsg4jk@google.com> (Fangrui Song's message of "Thu, 7 Mar 2024 00:32:06 -0800")

On Mar  7, 2024, Fangrui Song <maskray@google.com> wrote:

>>> /* Decide whether a reference to a symbol can be resolved locally or
>>> not.  If the symbol is protected, we want the local address, but
>>> its function descriptor must be assigned by the dynamic linker.  */
>> 
>> If the comment is wrong as your proposed change suggests, it ought to be
>> fixed along with the patch that changes this behavior.

> The comment looks correct to me, so I did not update it.

The point was about having the descriptor assigned by the dynamic
linker.  You seem to be arguing against it to enable GOTOFF references
to the descriptor.  You can only use GOTOFF for descriptors that are
local to the module, I hope you'll agree.

I understand the motivations for performance, but ISTM that twisting the
meaning of protected to satisfy those motivations is not a desirable
path to take; hidden aliases seem to satisfy that goal without deviating
from any standard behaviors.

Now, I'm not aware of any special provisions in SH FDPIC specs that
would justify this change, so I'd rather stick to the overall standard.

> Let's say a.so defines protected `foo`, which is referenced by b.so
> using the default visibility symbol.

That is unclear to me.  Are we talking about two different symbols, each
with different visibility, or about two different views of the same
global symbol?

> The references within a.so use GOTOFF relocations, which are resolved
> to the canonical function descriptor.

That can't be.  The comments in place (quoted above) state that it is
the dynamic linker that assigns the descriptor for the symbol, so you
can't possibly refer to it with GOTOFF, even if the symbol otherwise
binds locally.


Now, one could conceive of using a local descriptor as the canonical
one.  FDPIC has never had provisions for that AFAIK: the dynamic loader
has no visibility into local descriptors or their associations to local
symbols.  IMHO some means to enable that would have to be added before
this kind of change could be considered.

-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

      reply	other threads:[~2024-03-09  5:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  0:43 Fangrui Song
2024-03-06 20:12 ` Alexandre Oliva
2024-03-07  8:32   ` Fangrui Song
2024-03-09  5:07     ` Alexandre Oliva [this message]

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=orbk7ogfh9.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=josmyers@redhat.com \
    --cc=maskray@gcc.gnu.org \
    --cc=maskray@google.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).