This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Quo vadis, thunk? (Was: Re: [PATCH/RFA] PR target/16665: SH thunkwith -fPIC (fwd))
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Joern Rennecke <joern dot rennecke at superh dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 02 Aug 2004 13:17:30 -0700
- Subject: Re: Quo vadis, thunk? (Was: Re: [PATCH/RFA] PR target/16665: SH thunkwith -fPIC (fwd))
- Organization: CodeSourcery, LLC
- References: <200408021422.i72EMvC02718@chloe.uk.w2k.superh.com>
Joern Rennecke wrote:
I see that you wrote the comment in cp/method.c . Is target port supposed
to be able to rely on the thunk being emitted together with the function
that is being thunked to?
Yes, where "together with" means "in the same object file". That much
is required by the C++ ABI. The ABI does not seem to say whether or not
the thunks must be COMDAT, but it would make sense to make them COMDAT
only when their associated function is also COMDAT, and in that case
they should all be in the same group.
Thus, I would consider the fact that G++ presently makes the thunks weak
even when the underlying function is not weak to be an odd quirk, if not
a bug. I think that could safely be changed without endangering
anything. It may be that it is the way it is for historical reasons; it
could also be that until my recent linkage cleanup, one could not be
sure whether the associated function would be COMDAT or not. In any
case, I think you could change it now.
In the case that the associated function is weak, you cannot (since GCC
does not really do COMDAT groups) assume that the thunks will be "near"
the associated function; they will still be in separate .gnu.linkonce
sections.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com