AIX & shared libstdc++

David Edelsohn dje@watson.ibm.com
Tue Oct 7 11:41:00 GMT 1997


>>>>> Andrey Slepuhin writes:

Andrey> I tried to build egcs-970929 on AIX 4.2.1 configured with
Andrey> --enable-shared
Andrey> option. The resulting shared libstdc++ was only ~600K instead of ~3M
Andrey> static one.
Andrey> This is because AIX linker does not know what symbols must be exported.
Andrey> Passing option -bexpall to linker did not solve the problem, so I tried
Andrey> to build export file manually by hacking makeC++SharedLib script. After
Andrey> removing some symbols causing linker warnings from resulting export
Andrey> file,
Andrey> I obtain shared libstdc++ with size ~2.3M and I can successfully link my
Andrey> programs with this library.
Andrey> I'm not sure that all my operation were correct and I can't check if all
Andrey> necessary symbols are included into the export file. But it seems to me,
Andrey> that the only way to receive correct shared version of libstdc++ on AIX
Andrey> is to use explicit export file. Any help will be appreciated.

	I am somewhat surprised that -bexpall does not export all
necessary symbols.  That is not the default because it can cause
significant bloat and is not the way that XLC operates.  AIX linker
performs garbage collection on symbols and removes any symbols which are
not referenced or exported.  If -bexpall does not trivially work around
the problem, one must use something like makeC++SharedLib.  Note: IBM's
C++ compiler and G++ use different name mangling schemes, so assumptions
about the internal structure of C++ symbols is incorrect.

Andrey> PS: Passing option -unix to linker is incorrect on AIX, because AIX
Andrey> linker
Andrey> recognize it as option -u with a parameter "nix". As a result there
Andrey> are
Andrey> many linker warnings.

	Who is passing -unix option to linker?  That is not in the GCC
specs.  Does libstdc++ assume that?

David



More information about the Gcc mailing list