This is the mail archive of the gcc-patches@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: [PATCH] Fix COMDAT group of thunks


Jakub Jelinek wrote:

The problem is that use_thunk puts the thunk into the same section as
its THUNK_TARGET, but as COMDAT group for it g++ uses DECL_ASSEMBLER_NAME
of the thunk.


2005-02-25 Jakub Jelinek <jakub@redhat.com>


	PR c++/20206
	* decl.c (cxx_comdat_group): Put thunks for
	TARGET_USE_LOCAL_THUNK_ALIAS_P (function) functions into the same
	comdat group as the thunk target.

* g++.dg/opt/thunk2.C: New test.

--- gcc/cp/decl.c.jj 2005-02-24 22:20:24.000000000 +0100
+++ gcc/cp/decl.c 2005-02-25 11:36:53.729017752 +0100
@@ -11117,6 +11117,17 @@ cxx_comdat_group (tree decl)
else
name = DECL_ASSEMBLER_NAME (decl);
+ if (DECL_THUNK_P (decl))
+ {
+ /* If TARGET_USE_LOCAL_THUNK_ALIAS_P, use_thunk puts the thunk
+ into the same section as the target function. In that case
+ we must return target's name. */
+ tree target = THUNK_TARGET (decl);
+ if (TARGET_USE_LOCAL_THUNK_ALIAS_P (target)
+ && DECL_SECTION_NAME (target) != NULL
+ && DECL_ONE_ONLY (target))
+ name = DECL_ASSEMBLER_NAME (target);

With covariancy THUNK_TARGET can itself be a thunk. Do you need an additional if (THUNK_P (target)) target = THUNK_TARGET (target) here? (and in use_thunk?)

I should clarify that in the documentation ...

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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