[RFC] slipping in symbol prefixes automagically via PROVIDE() in linker scripts

Mike Frysinger vapier@gentoo.org
Mon Jul 31 16:47:00 GMT 2006
On Monday 31 July 2006 06:25, Will Newton wrote:
> Hi Nick,
> > > with the new binutils-2.17, it'd be good to switch to using the
> > > generic elf.sc file ... but this _ prefix is standing in the way
> >
> > Which symbols in the elf.sc need this prefix and do not
> > already have it ?  I looked through the file and it seems
> > that most symbols are provided in an underscore prefixed
> > version and a non-underscore prefixed version.
> >   Or is it that you want to have *double* underscore prefixed
> > versions and single underscore prefixed versions ?  (If so,
> > are the double underscore prefixed versions really necessary ?)
>
> I had a similar problem with an unreleased port I maintain. The symbols
> that were problematic, which is by no means an exhaustive list, were:
>
> __preinit_array_start
> __preinit_array_end
> __init_array_start
> __init_array_end
> __fini_array_start
> __fini_array_end

yep, these were the symbols that are causing problems at the moment ... but i 
was looking to see if there was a more general solution than just fixing 
these references

so in C you would be referencing __init_array_start, but gcc would translate 
that to ___init_array_start, so we need to update the linker script to 
provide ___init_array_start

> >    ${RELOCATING+${END_SYMBOLS-_end = .; PROVIDE (${PREFIX}end = .);}}
> >
> > and in your bfin.sh file define PREFIX as "_".
>
> This looks like a much cleaner way of doing it than copying and editing
> elf.sc as we currently do.

yeah, that looks like great ... how about the attached patch ?  it doesnt seem 
to cause any regressions in the x86_64/i686/blackfin make check ... but i'll 
try running it through some blackfin tests now ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060731/47043d1b/attachment.sig>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-elf-user-label-prefix.patch
Type: text/x-diff
Size: 3265 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060731/47043d1b/attachment.bin>


More information about the Binutils mailing list