This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Question re: Thunks (was Re: [PATCH] - Fix PR 21956 and PR 22003)
Dale Johannesen wrote:
This would not work on Darwin; the linker does not support multiple
entry points, and can move the thunk away from the main function.
>
I can't see a good reason to force both to be in the same section if
profile info shows the
thunk is lightly executed and the main function isn't, for example. You
really don't want
unexecuted code cluttering up your I-cache.
Well, fine. I'd be rather surprised if two-ish extra instructions would
be a major penalty, especially given that virtual function calls are
typically (yes, I know, not if called with an explicit scoping operator)
paying the evil indirect-jump penalty to call the function, but it
clearly depends on the processor, the exact profile, etc.
This is clearly a psABI detail, though; Darwin can do what it likes.
However, putting these in the same COMDAT groups as their targets on ELF
systems sure seems to make sense to me, as a default. If profiling
tells you to rip them apart, you can do that.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304