This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: Quo vadis, thunk? (Was: Re: [PATCH/RFA] PR target/16665: SH thunkwith -fPIC (fwd))


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


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