gcc2.95 shared library scheme for AIX doesn't work on AIX 4.1

Stuart D. Gathman stuart@bmsi.com
Fri Apr 7 15:19:00 GMT 2000


The shared library implementation for AIX in GCC 2.95.2 uses an import file
for libgcc.a which begins with

#! .

On AIX 4.2 and later, this tells the loader to link these symbols against the
main program.  AIX 4.1 does not support this.

Recommendation:  If you are going to require AIX 4.2, then a much cleaner
method is supported.  The AIX linker supports a "-binitfini" option beginning
with 4.2.  This option specifies an initilization and a cleanup function for
the library.  With this feature, collect2 needs only to scan the current
module being linked and pass __do_global_ctors and __do_global_dtors to the
linker with -binitfini.  I would make this change if I had an AIX 4.2 of 4.3
development machine . . .

To support AIX 4.1, I am reimplementing the scheme I have been using with
gcc2.7.2.  This involves splitting libgcc.a into shared and static modules.
Most routines in libgcc.a can be shared between all library modules.  For
instance, the __main.o object must be statically linked with the main
program.   I suspect that in gcc2.95, some modules must be shared - perhaps
the typeinfo or expection support.  I will have to research this.  AIX
supports mixing shared and static objects in the same archive.  If anyone is
interested, I will share the results.

An alternative would be to reverse engineer the undocumented scheme used by
xlC in AIX 4.1.

--
   Stuart D. Gathman <stuart@bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
 "Microsoft is the QWERTY of Operating Systems" - SDG
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
 (HINT: Find a translation of the "Dies Irae".)




More information about the Gcc-bugs mailing list