This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR43602
- From: Richard Guenther <rguenther at suse dot de>
- To: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, bonzini at gnu dot org, mikestump at comcast dot net
- Date: Thu, 1 Apr 2010 14:09:22 +0200 (CEST)
- Subject: Re: [PATCH] Fix PR43602
- References: <20100401051025.GA31746@bromo.med.uc.edu>
On Thu, 1 Apr 2010, Jack Howarth wrote:
> The attached patch eliminates the profile testcase failures
> caused by the unresolved symbols for ___emutls_v.__gcov_indirect_call_counters
> and ___emutls_v.__gcov_indirect_call_callee on *-*-darwin*. This
> problem was exposed by r157822 which made static variables TLS in
> tree_init_ic_make_global_vars() of tree-profile.c.
> This patch adds the missing copies for DECL_VISIBILITY_SPECIFIED to
> both get_emutls_init_templ_addr() and emutls_decl(). It also sets
> TREE_PUBLIC, DECL_VISIBILITY and DECL_VISIBILITY_SPECIFIED for
> __gcov_indirect_call_callee and __gcov_indirect_call_counters
> in tree_init_ic_make_global_vars().
> Bootstrapped and regression tested on x86_64-apple-darwin10
> against current gcc trunk. This eliminates all of the current
> profile related regressions on darwin but introduces one new
> regression...
>
> FAIL: gcc.dg/tree-prof/ic-misattribution-1.c compilation, -fprofile-generate -D_PROFILE_GENERATE
>
> which appears as...
>
> Executing on host: /sw/src/fink.build/gcc45-4.4.999-20100331/darwin_objdir/gcc/xgcc -B/sw/src/fink.build/gcc45-4.4.999-20100331/darwin_objdir/gcc/ /sw/src/fink.build/gcc45-4.4.999-20100331/gcc-4.5-20100331/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c /sw/src/fink.build/gcc45-4.4.999-20100331/gcc-4.5-20100331/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1a.c -O2 -fdump-tree-tree_profile -fprofile-generate -D_PROFILE_GENERATE -lm -o /sw/src/fink.build/gcc45-4.4.999-20100331/darwin_objdir/gcc/testsuite/gcc/ic-misattribution-1.x01 (timeout = 300)
> ld: duplicate symbol ___emutls_v.__gcov_indirect_call_callee in /var/tmp//ccj58uzN.o and /var/tmp//ccc3SqNt.o
> collect2: ld returned 1 exit status
> compiler exited with status 1
> output is:
> ld: duplicate symbol ___emutls_v.__gcov_indirect_call_callee in /var/tmp//ccj58uzN.o and /var/tmp//ccc3SqNt.o
> collect2: ld returned 1 exit status
>
> FAIL: gcc.dg/tree-prof/ic-misattribution-1.c compilation, -fprofile-generate -D_PROFILE_GENERATE
> UNRESOLVED: gcc.dg/tree-prof/ic-misattribution-1.c execution, -fprofile-generate -D_PROFILE_GENERATE
> UNRESOLVED: gcc.dg/tree-prof/ic-misattribution-1.c compilation, -fprofile-use -D_PROFILE_USE
> UNRESOLVED: gcc.dg/tree-prof/ic-misattribution-1.c execution, -fprofile-use -D_PROFILE_USE
>
> Okay for gcc trunk and gcc 4.5 branch?
The varasm.c change is ok. You can't make the decls public as that
causes the duplicate symbols, thus the tree-profile.c parts need
to be reworked. Why do static TLS vars with no specified visibility
not work?
Thanks,
Richard.
> Jack
>
> 2010-04-01 Paolo Bonzini <bonzini@gnu.org>
> Jack Howarth <howarth@bromo.med.uc.edu>
>
> PR43602
> * varasm.c (get_emutls_init_templ_addr): Copy
> DECL_VISIBILITY_SPECIFIED.
> (emutls_decl): Same.
> * tree-profile.c: (tree_init_ic_make_global_vars): Set
> TREE_PUBLIC, DECL_VISIBILITY and DECL_VISIBILITY_SPECIFIED
> for __gcov_indirect_call_callee and __gcov_indirect_call_counters.
>
> Index: gcc/varasm.c
> ===================================================================
> --- gcc/varasm.c (revision 157899)
> +++ gcc/varasm.c (working copy)
> @@ -332,6 +332,7 @@
> TREE_STATIC (to) = TREE_STATIC (decl);
> TREE_PUBLIC (to) = TREE_PUBLIC (decl);
> DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
> + DECL_VISIBILITY_SPECIFIED (to) = DECL_VISIBILITY_SPECIFIED (decl);
> }
> else
> TREE_STATIC (to) = 1;
> @@ -413,6 +414,7 @@
> DECL_COMMON (to) = DECL_COMMON (decl);
> DECL_WEAK (to) = DECL_WEAK (decl);
> DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
> + DECL_VISIBILITY_SPECIFIED (to) = DECL_VISIBILITY_SPECIFIED (decl);
>
> return to;
> }
> Index: gcc/tree-profile.c
> ===================================================================
> --- gcc/tree-profile.c (revision 157899)
> +++ gcc/tree-profile.c (working copy)
> @@ -79,8 +79,10 @@
> get_identifier ("__gcov_indirect_call_callee"),
> ptr_void);
> TREE_STATIC (ic_void_ptr_var) = 1;
> - TREE_PUBLIC (ic_void_ptr_var) = 0;
> + TREE_PUBLIC (ic_void_ptr_var) = 1;
> DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
> + DECL_VISIBILITY (ic_void_ptr_var) = VISIBILITY_DEFAULT;
> + DECL_VISIBILITY_SPECIFIED (ic_void_ptr_var) = 1;
> DECL_INITIAL (ic_void_ptr_var) = NULL;
> DECL_TLS_MODEL (ic_void_ptr_var) = decl_default_tls_model (ic_void_ptr_var);
> varpool_finalize_decl (ic_void_ptr_var);
> @@ -91,8 +93,10 @@
> get_identifier ("__gcov_indirect_call_counters"),
> gcov_type_ptr);
> TREE_STATIC (ic_gcov_type_ptr_var) = 1;
> - TREE_PUBLIC (ic_gcov_type_ptr_var) = 0;
> + TREE_PUBLIC (ic_gcov_type_ptr_var) = 1;
> DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
> + DECL_VISIBILITY (ic_gcov_type_ptr_var) = VISIBILITY_DEFAULT;
> + DECL_VISIBILITY_SPECIFIED (ic_gcov_type_ptr_var) = 1;
> DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
> DECL_TLS_MODEL (ic_gcov_type_ptr_var) = decl_default_tls_model (ic_gcov_type_ptr_var);
> varpool_finalize_decl (ic_gcov_type_ptr_var);
>
>
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex