On Mon, 10 Apr 2006, Tim Jenness wrote:
> I've discovered that OSX Tiger has a broken linker when common blocks, block
> data and static archives are involved.
>
> ie if you put a BLOCK DATA in a .a file and link it with your main program
> the "D" (DATA) section in the .a file will never actually be read because
> there is bound to be a "C" (COMMON) section in the file somewhere that will
> be extracted instead (if it's even needed since the common block may well be
> used in the main program).
>
> This all works fine for shared libraries. The issue is that autoconf uses
> "convenience libraries" to build figaro, specx and others and these simply
> don't work.
>
> My options are:
>
> 1. Add -Wl,-all_load to the link options. This forces the linker to be
> greedy. What's the best way to do this in the Makefile.am?
>
> 2. Add a dummy routine in the BLOCK DATA file and a dummy call to it
> anywhere else. The linker then slurps in the section of the archive
> containing the dummy call and the "D" section gets slurped in as
> collateral damage.
>
> 3. Make sure that the BLOCK DATA object code is linked directly into
> the main routine.
>
> #2 won't do any damage to the source other than making it less clear but the
> "fix" is needed in quite a few routines (figaro, specx, sst, photom).
> [but only if the initialisation sets it to a non-zero value].
>
> #1 may be best but I'm not sure how to go about it.
Shouldn't you be able to just set "LDFLAGS=-Wl,-all_load" and then
configure the tree to use it? Having platform specific _LDFLAGS in the
Makefile.am's seems a bit drastic for what is hopefully a bug that will be
fixed, although no doubt you could do that using some magic in the
configure.ac file to test the platform and set some macro for expansion or
maybe an AM_CONDITIONAL (did something a bit like that for a compiler
problem under Tru64 in GAIA, and for all the PIC related changes, like in
NDF).
> I'm sure this worked on Panther (but I haven't been able to test it).
Clearly it did.
Cheers,
Peter.
|