Is `SYMBOL_REFERENCES_LOCAL` safe to call in `*check_relocs` hook?
Matthew Malcomson
Matthew.Malcomson@arm.com
Mon Jun 27 12:32:54 GMT 2022
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
More information about the Binutils
mailing list