PATCH: Check symbol type for symbol alias

H.J. Lu hjl@lucon.org
Fri Jul 20 13:07:00 GMT 2007


On Fri, Jul 20, 2007 at 10:12:42AM +0100, Richard Sandiford wrote:
> "H.J. Lu" <hjl@lucon.org> writes:
> > Here is a patch to add a testcase and check symbol type for symbol
> > alias.
> 
> In case anyone's in any doubt, this really doesn't fix my original
> problem.  Although the strong symbol in the test's shared library was
> defined by the linker script, that was mostly for test convenience.
> We can still have a situation in which an object symbol "bar" in a
> shared library is overridden by an assignment "PROVIDE (bar = .);" in
> the linker script of an object being linked against the shared library.
> (And as I said in the covering note, we do handle that situation
> correctly; we use relocations against the original weak symbol instead.)
> I can adjust the testcase in the obvious way if this patch goes in.

The problem is linker creates a wrong symbol alias for a dynamic
object. We don't have a reliable way to tell if a symbol is an aliase
in a shared library. It can lead to many problems. Can we use
STT_SECTION for linker created symbols? Gabi says

STT_SECTION
    The symbol is associated with a section. Symbol table entries of
this type exist primarily for relocation and normally have STB_LOCAL
binding.

It doesn't forbid STB_GLOBAL binding. At least, we won't make a weak
symbol an alias of linker created symbols.


H.J.



More information about the Binutils mailing list