Dynamic linking again

Duncan Coutts duncan@coutts.uklinux.net
Mon, 2 Sep 2002 17:13:08 +0100


On Mon, 2 Sep 2002 15:16:37 +0100
"Simon Marlow" <simonmar@microsoft.com> wrote:

> > I got lots of linking errors about duplicate symbols doing using
> > --whole-archive for the standard packages. Perhaps someone who knows a
> > bit more about linking could advise me.
> 
> I couldn't get it to work either - although I didn't get any duplicate
> symbols when linking, it seems the resulting binary didn't have all the
> symbol information from the library in it.  It looks like
> -export-dynamic doesn't work properly with --whole-archive.

I discovered that just giving -optl--whole-archive.didn't actually pass
it on to the linker for some reason. If you use -optl-verbose it'll tell
you exaclty what's going on, and --whole-archive was missing.

> I'm not sure exactly what's going here.  RtsAPIDeprec.o does refer to
> Addr_Azh_con_info, which is defined in the Addr module in the lang
> package.  However, RtsAPIDeprec normally isn't linked in, because
> nothing refers to anything in it.

If anyone's interested, in dynamic linking in general or this poroblem
in particular my code is here (including a makefile):
http://charlesstreet22.force9.co.uk/~duncan/projects/dynlink/

> That's a good plan.  We can probably make it easier too, perhaps by
> providing a flag to do the right magic at link-time.  I need to think
> about this some more.

Linking in HSbase.o directly is *very* slow. I don't know enough about
linking to know why.

Duncan