public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook?
@ 2022-06-27 12:32 Matthew Malcomson
  2022-06-27 13:20 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Malcomson @ 2022-06-27 12:32 UTC (permalink / raw)
  To: binutils

Hello,

As the title mentions I want to call SYMBOL_REFERENCES_LOCAL​ at the time that the check_relocs​ hook is being called.
For context: the reason I'm curious is that the AArch64 backend determines whether to relax a TLS access sequence to local-exec based on whether the symbol is marked local (i.e. h == NULL​) or not rather than based on whether the symbol we access is in the executable or not.

I did a grep across the codebase and it seems there's only one place that we call SYMBOL_REFERENCES_LOCAL​ so early, and that's in the x86 backend.
However it's through a wrapper SYMBOL_REFERENCES_LOCAL_P​ which is implemented by a function that has a comment specifically mentioning being safe to call from check_relocs​, and that seems like it should increase suspicion rather than allay it.

If it's not, what is the problem?
(I assume something about the symbol not being fully set up, based on that same comment above the x86 function maybe something to do with version scripts?)

Thanks,
Matthew

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook?
  2022-06-27 12:32 Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook? Matthew Malcomson
@ 2022-06-27 13:20 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2022-06-27 13:20 UTC (permalink / raw)
  To: Matthew Malcomson; +Cc: binutils

On Mon, Jun 27, 2022 at 5:33 AM Matthew Malcomson via Binutils
<binutils@sourceware.org> wrote:
>
> Hello,
>
> As the title mentions I want to call SYMBOL_REFERENCES_LOCAL at the time that the check_relocs hook is being called.
> For context: the reason I'm curious is that the AArch64 backend determines whether to relax a TLS access sequence to local-exec based on whether the symbol is marked local (i.e. h == NULL) or not rather than based on whether the symbol we access is in the executable or not.
>
> I did a grep across the codebase and it seems there's only one place that we call SYMBOL_REFERENCES_LOCAL so early, and that's in the x86 backend.
> However it's through a wrapper SYMBOL_REFERENCES_LOCAL_P which is implemented by a function that has a comment specifically mentioning being safe to call from check_relocs, and that seems like it should increase suspicion rather than allay it.
>
> If it's not, what is the problem?
> (I assume something about the symbol not being fully set up, based on that same comment above the x86 function maybe something to do with version scripts?)

It should be safe to use it now in the check_relocs hook since the hook
is called after loading all input files.


-- 
H.J.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-27 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 12:32 Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook? Matthew Malcomson
2022-06-27 13:20 ` H.J. Lu

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).