This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: G++ shared object under AIX 4.1.4


David Edelsohn wrote:

> >>>>> Desmond Kirkpatrick writes:
>
> Desmond> I've been attempting to produce a shared object file using ECGS 1.1.2
> Desmond> under AIX 4.1.4.
>
>         _GLOBAL__DI and _GLOBAL__DD are the names the GCC's linker
> front-end (collect2) assigns to the functions which will run the static
> constructors and static destructors, respectively, for the shared object
> you are creating.  GCC currently does not utilize AIX's initialization and
> finalization mechanisms, so you need to invoke the functions manually to
> initialize the constructors before you use objects in that file.

Excellent point.  I've read about some of this in the group here, but there's not
enough to really figure out how to actually do this (ie, how do I find the names
of all the constructors, etc).  I'm worried that the implication here is I cannot
use streams or STL.  It seems these may have their own static constructors (ie,
the vector::free_list and cout/cin/cerr).  This technique could become a mini-FAQ
for unknown or 'bad' machines.

>         You may need to either create a shared version of libstdc++ or
> explicitly link with libstdc++ statically while creating the shared
> object, e.g., -Wl,-bstatic -lstdc++ -Wl,-bdynamic.

I've tried the various combinations of what you've mentioned:  I've built
libstdc++ as both shared and standard archive.  I've also tried the combination
-Wl,-bnso -lstdc++ -Wl,-bso  (using AIX linker syntax).

One person in the group recommended I try libtool, but I wonder if I will open up
more combinations to try to get to the bottom of this problem.  Has anyone really
solved this problem on this machine -- I'm worried this may require deeper hacking
on objects?  For example, IBM itself uses a MakeC++SharedLib Korn shell script for
its compiler.  I've perused it and it clearly communicates some symbol information
to the linker on externally defined symbols.  I wonder if anyone has done
something like this for G++.

Desmond Kirkpatrick





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]