This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fno-weak, typeinfo, and AIX
- To: Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>
- Subject: Re: -fno-weak, typeinfo, and AIX
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Fri, 26 Jan 2001 10:01:43 -0800
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org,Jason Merrill <jason at cygnus dot com>
- References: <20010125161745K.mitchell@codesourcery.com> <20010126161847.C7096@pcep-jamie.cern.ch>
On Fri, Jan 26, 2001 at 04:18:47PM +0100, Jamie Lokier wrote:
> Mark Mitchell wrote:
> > - Modify the run-time library to do a string comparison, not an
> > address comparison, of the typeinfo strings.
>
> You can make the typeinfo object a pointer to the string and coalesce
> strings at run time. The typeinfo would contain another pointer to link
> together all the initialised typeinfos.
>
> Typeinfo comparison would reduce to comparing two pointers from memory,
> which is nearly as fast as address comparison.
>
> > [...] the weak symbols approach works much more smoothly.
>
> It does as long as you don't use dynamic loading.
>
> Consider this:
>
> 1. Load libA.so -- defines typeinfo A.
> 2. Load libB.so -- also defines typeinfo A, the one in libA.so wins.
> 3. Unload libA.so -- still with references to typeinfo A from libB.so.
>
> Oh dear. We have an address in unmapped memory. Maybe something will
> get mapped in it later, such as typeinfo C from libC.so.
>
I don't think it is a problem for glibc. Bascially, libA.so won't
get unloaded with dlclose () since there is still a reference to
libA.so. BTW, you don't need typeinfo for that to happen.
--
H.J. Lu (hjl@valinux.com)