This is the mail archive of the gcc-bugs@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: Problems with AIX and shared libs


On 22-Jun-99 Didier.Spezia@sip.fr wrote:
> 
> Hi Andrey, many thanks for your answer.
> 
> I've checked the AIX documentation ( 4.1.5 and 4.2.1 ). Importing from main
> executable in a shared lib seems to be a new feature of AIX 4.2, so it is
> not available
> on a 4.1.5 platform.

:( Unfortunately AIX 4.2 man page doesn't mark this as AIX 4.2 feature.

> 
> I've modified collect2.c the way you proposed and rebuilt EGCS. It works
> very well.
> We can now link against a shared stdc++ library without any problem.
> 
> We've performed a few tests with shared libs and exceptions. As you pointed
> out,
> it didn't work very well. If a shared library use exceptions, it must be
> statically linked
> with libgcc, therefore we got multiple defined symbols during the linking
> of the main
> program. We have noticed the following behavior :
> 
> - an exception raised in a function or method of the shared lib and caught
> within the lib works as expected.
> 
> - an exception raised in a function or method in the library, not caught
> within the library but in the main program results in a core dump. So the
> main program can't catch exceptions generated in shared libs.

You obtained exactly the expected behavior. The trick with importing
from the main exeputable was done to disable linking shared libraries
with libgcc.a to avoid multiple defined symbols.

Now we have a problem: how to correctly separate collect2 behavior
for AIX 4.1.x and >=AIX 4.2.

> So, it's probably better to avoid C++ in shared libs on AIX 4.1.5. except
> for
> the stdc++ library. ( It doesn't use exceptions and RTTI, does it ? )

I'm not sure about current version... (I'm personally don't use libstdc++ at all :) )
But future versions will use.

Regards,
Andrey.


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