This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PowerpC pointer_equality_needed optimisation
On Mon, Feb 25, 2008 at 07:57:27PM -0800, H.J. Lu wrote:
> On Mon, Feb 25, 2008 at 7:51 PM, Alan Modra <amodra@bigpond.net.au> wrote:
> > On Mon, Feb 25, 2008 at 03:39:40PM -0800, H.J. Lu wrote:
> > > I am not sure if it should work. deflib.so and nodeflib.so have
> >
> > > different ABIs. This behavior isn't well defined.
> >
> > Yes, the ELF gABI is sadly lacking in defining the behaviour of weak
> > symbols.
> >
> > I think that a good guiding principle is that shared libraries should
> > behave as closely as possible to archives. Therefore, it would be
> > good if, as much as possible, weak references to definitions in a
> > shared library behaved the same as weak references to definitions in a
> > static library.
> >
> > With shared libraries you always have the possibility of updating the
> > library, then running your executable using the new library version.
> > Conceptually this is like relinking the executable object files
> > against a new static library. Of course if you relink with a new
> > static library, weak references may change. They will resolve to zero
> > (if the archive doesn't define the symbol in question), or to a symbol
> > in the library (if the archive does define the symbol), regardless of
> > how they resolved using an old static library. We don't currently
> > support this for shared libraries due to not emitting the necessary
> > dynamic relocations.
> >
>
> I don't think we support changing ABI with the same soname. Removing
> a symbol from a DSO is a ABI change. Many applications linked with
> the old DSO will simply crash with normal reference. I don't think
> weak reference should be an exception here.
I agree that removing an exported symbol from a dynamic library is an
ABI change for the library in question. I claim that removing an
exported symbol from a static library is exactly the same. It changes
the library ABI too. Relinking with a normal reference to the removed
symbol will result in a link-time failure.
Undefined weak references are designed to handle such ABI changes.
--
Alan Modra
Australia Development Lab, IBM