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]

aix shared libraries and collect2


It seems to me the way collect2 works on aix with respect to libgcc is flawed.
The way it works now is to not add any code from libgcc to shared libs but to
import them from the executable which will eventually load that library. This
creates several problems:

1/ This approach only works if the executable was compiled with gcc and if the
executable was linked with that library;
2/ Exceptions will not work -- not even if they are thrown and caught within the
library;
3/ The versions of gcc the executable and the library were compiled with must
not mismatch.

When trying to create a c++ shared library myself 1/ was the main problem. The
libraries are used as an extension mechanism in my case and are therefore loaded
explicitly at runtime via dlopen. If the executable was not compiled with gcc
then the library will not load. But even if the executable was compiled with gcc
the library can only be loaded with varying success because only the bits of
libgcc actually used are in the executable the rest gets garbage collected, e.g.
if the library uses rtti or exceptions and the executable does not then I am out
of luck.
Regarding 3/: I thought the reason why libgcc is not a shared library but gets
included into every executable was mainly to be independent of compiler updates.
Using the import file mechanism employed under aix means making libgcc shared --
just not in a straight forward way -- fact is the libraries load libgcc at
runtime from the executable.

IMHO the import file mechanism under aix should be abondoned as it is only
correct in a limited number of setups.




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