[vxworks] PLT to weak symbol
Nathan Sidwell
nathan@codesourcery.com
Wed Apr 11 09:56:00 GMT 2007
this patch fixes a problem that vxworks rtp has with weak symbols. Consider:
app.c
void Weak (void);
void (*const ptr) (void) = &Weak;
lib.c
void __attribute__((weak)) Weak (void) {}
This is what you get with a C++ class that has no key virtual function. Weak is
an inline virtual function.
The problem vxworks has is that .rodata (where 'ptr' resides) is relocated by
the kernel loader, and that doesn't know anything about 'Weak'. It blithely
*ignores* the relocation we emit, and we end up with a broken image.
The rtp dynamic loader is responsible for filling in relocs to Weak, but it
doesn't relocate .rodata and the like.
We already have special code to deal with the non-weak case here, and change the
reloc for ptr's initializer to refer to .plt, which the kernel loader does know
about. This patch makes it do the same thing for weak definitions too.
ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: all.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20070411/65ce4b80/attachment.ksh>
More information about the Binutils
mailing list