This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix __cxa_exception ABI breakage in 4.4 (PR libstdc++/38732)
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 07 Jan 2009 17:23:04 +0100
- Subject: Re: [PATCH] Fix __cxa_exception ABI breakage in 4.4 (PR libstdc++/38732)
- References: <20090107154932.GC25055@tyan-ft48-01.lab.bos.redhat.com>
Hi,
> As discussed in the PR, OpenOffice.org wants to get at current exception's
> type, but as it needs to support pre-4.4 libstdc++ (and was written
> in the pre-exception_ptr era), instead of using current_exception()
> it copies part of unwind-cxx.h header (which isn't installed) and
> uses __cxa_get_globals() to get at it.
> In 4.4 referenceCount field was added, which changes the layout of
> the __cxa_exception structure. As __cxa_exception layout is
> part of C++ ABI, I think what OO.o does is something we should support.
>
Thanks for the clarification, I was confused about why / how we didn't
anticipate this issue...
> The following patch fixes it by removing referenceCount from __cxa_exception
> (so that it is layed out as before) and using a new struct with
> __cxa_exception as last member for the referenceCount. As long as
> the __cxa_exception in the new struct is not followed by padding
> (given that one of the __cxa_exception fields is __attribute__((aligned))
> I think it won't happen and we rely on it already for the unwind header
> anyway), apps using the C++ ABI described __cxa_exception will continue
> working.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
Ok. First blush all those reinterpret_cast made me nervous about
possible aliasing issues, but then I noticed that you are following
existing practice in unwind-cxx.h, thus everything should be fine... (if
you could double check that -Wstrict-aliasing is always happy both
during the build and the testing, before committing, it would be great)
Thanks again,
Paolo.