symbol type in ->check_relocs()

David Miller davem@davemloft.net
Tue Feb 2 18:49:00 GMT 2010


All of the IFUNC BFD backend changes have added code
which is conditional upon the symbol type to the
target ->check_relocs() method.

But this doesn't seem to be kosher.

The final symbol type isn't known at this point.  And it
won't be until all of the object file symbol tables have
been slurped in.

The ->check_relocs() method is called one by one as each symbol table
is read in.

Things like crashes (because proper IFUNC processing is not performed)
are easy to trigger, for example:

1) a.o - calls "extern int foo ();", symbol type for
   "foo" here will be NOTYPE

2) b.o - defines STT_GNU_IFUNC symbol foo()

Then link with something like: "-o test a.o b.o"

a.o will be seen first, as will the relocs in a.o against
"foo", but "foo"'s symbol will be STT_NOTYPE so none of
the special IFUNC processing will occur in ->check_relocs().

Later b.o will have it's symbols read in and we'll learn
that "foo" is STT_GNU_IFUNC, but by this time it's too
late.

Doing "-o test b.o a.o" works, but only by luck.

I just hit this while debugging my sparc STT_GNU_IFUNC patches.



More information about the Binutils mailing list