libgcc problems with shared libraries
H.J. Lu
hjl@lucon.org
Wed Jan 14 04:17:00 GMT 1998
>
> >>>>> Andrey Slepuhin writes:
>
> Andrey> I found a serious problem with libgcc using shared libraries on AIX.
> Andrey> The problem is following:
> Andrey> 1) Because every shared library is linked with static libgcc.a,
> Andrey> it has its own instances of libgcc's static variables.
> Andrey> 2) This causes the following effect: if, for example, a function
> Andrey> in shared library calls set_terminate(), then a local instance
> Andrey> of __terminate_func is changed, while a program linked with this
> Andrey> shared library uses its own instance of __terminate_func which
> Andrey> is still set to default.
>
> Andrey> I can suggest the following possible workarounds:
> Andrey> 1) to move static variables into libstdc++,
> Andrey> 2) to create a shared libgcc,
> Andrey> but both are not good.
>
> This should not be limited to AIX. It should affect any system
> using shared libraries where libgcc.a is a static library.
>
It should not be a problem. The dynamic linker and linker should
make sure only one copy of set_terminate () is used in any case.
That is what happens on ELF systems.
--
H.J. Lu (hjl@gnu.org)
More information about the Gcc
mailing list