ld: rebinding refs to A to symbol B
Alan Modra
amodra@gmail.com
Thu Feb 6 22:35:47 GMT 2025
On Wed, Feb 05, 2025 at 01:49:18PM +0000, Richard Earnshaw (lists) wrote:
> On 01/02/2025 01:05, Alan Modra wrote:
> > On Fri, Jan 31, 2025 at 06:31:51PM +0000, Richard Earnshaw (lists) wrote:
> >> I suspect the problem is that PROVIDE is documented as only generating the definition iff __sync_synchronize is *not* defined, but in my case that isn't true and I need to override the existing definition in libgcc with the alternative.
> >
> > Yes, that would prevent PROVIDE from doing anything.
> >
>
> Right, which brings me back to my original question: is there a way of overriding an unresolved reference, iff it exists without creating a reference as as --defsym does?
I don't think we have that capability in the linker script language.
I suppose you could add "REFERENCED (sym)", implemented using
something like the WARN code in _bfd_generic_link_add_one_symbol, then
use that to conditionally assign. Of course trying to do that might
open a can of worms..
--
Alan Modra
More information about the Binutils
mailing list