[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #23 from iains at gcc dot gnu dot org 2010-05-24 14:36 --- Subject: Bug 43602 Author: iains Date: Mon May 24 14:36:32 2010 New Revision: 159781 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=159781 Log: 2010-05-24 Iain Sandoe ia...@gcc.gnu.org PR target/44132 PR middle-end/43602 * varasm.c (get_emutls_init_templ_addr): Copy DECL_PRESERVE_P, DECL_VISIBILITY_SPECIFIED. (emutls_decl): Set DECL_PRESERVE_P and copy DECL_VISIBILITY_SPECIFIED, DECL_RESTRICTED_P. (emutls_finalize_control_var): New callback. (emutls_finish): Finalize emutls control variables. * toplev.c (compile_file): Move the call to emutls_finish () before varpool_assemble_pending_decls (). Modified: trunk/gcc/ChangeLog trunk/gcc/toplev.c trunk/gcc/varasm.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #22 from iains at gcc dot gnu dot org 2010-05-19 14:54 --- I would imagine that this will ultimately affect all EMUTLS targets even tho it's against darwin. tree-profile.c is generating gimple directly for the inserted statements - AFAICT it's assuming that these don't need further expansion/gimplification... We need to substitute a reference and call for each emutls var ref. so that needs to be stuffed in and gimplified.. on my TODO if unless someone gets there first .. -- iains at gcc dot gnu dot org changed: What|Removed |Added CC|developer at sandoe-|iains at gcc dot gnu dot org |acoustics dot co dot uk | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #21 from iains at gcc dot gnu dot org 2010-05-15 15:40 --- updated: http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01119.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #20 from developer at sandoe-acoustics dot co dot uk 2010-04-05 08:32 --- see: http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00129.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #14 from howarth at nitro dot med dot uc dot edu 2010-04-01 11:27 --- Reverting back to... TREE_PUBLIC (ic_void_ptr_var) = 0; in the proposed patch results in the missing symbols again. Can we just leave... TREE_PUBLIC (ic_void_ptr_var) = 1; and find some way to coalesce the symbols so that the failure in... FAIL: gcc.dg/tree-prof/ic-misattribution-1.c compilation, -fprofile-generate -D_PROFILE_GENERATE disappears. Lastly, any chance we can change this to a P1 so that it is fixed before the gcc 4.5 release? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #15 from rguenth at gcc dot gnu dot org 2010-04-01 13:25 --- Subject: Bug 43602 Author: rguenth Date: Thu Apr 1 13:24:58 2010 New Revision: 157907 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157907 Log: 2010-04-01 Richard Guenther rguent...@suse.de PR middle-end/43602 Revert 2010-03-30 Seongbae Park seongbae.p...@gmail.com Jack Howarth howa...@bromo.med.uc.edu * tree-profile.c (tree_init_ic_make_global_vars): Make static variables TLS. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-profile.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #16 from rguenth at gcc dot gnu dot org 2010-04-01 13:26 --- Fixed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #17 from bonzini at gnu dot org 2010-04-01 15:42 --- Subject: Re: ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin* On 04/01/2010 01:27 PM, howarth at nitro dot med dot uc dot edu wrote: --- Comment #14 from howarth at nitro dot med dot uc dot edu 2010-04-01 11:27 --- Reverting back to... TREE_PUBLIC (ic_void_ptr_var) = 0; in the proposed patch results in the missing symbols again. Can we just leave... TREE_PUBLIC (ic_void_ptr_var) = 1; No, I don't see how this can be correct. The symbols must _not_ be coalesced, that's why TREE_PUBLIC is zero. Paolo -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #18 from howarth at nitro dot med dot uc dot edu 2010-04-01 16:00 --- Paolo, Is there any other debug info I can provide (on gcc trunk pre-reversion) to help debug this issue? Also could you switch an x86_64 linux build of gcc trunk over to using emutls and try to reproduce it under ELF? Jack -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #19 from bonzini at gnu dot org 2010-04-01 16:01 --- No, I don't have time to debug this further, sorry. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #1 from howarth at nitro dot med dot uc dot edu 2010-03-31 13:29 --- The commit of the patch to eliminate race conditions in indirect value profiling (r157822) hasn't triggered the same profile related testsuite failures in any other target. This leads to two questions... 1) Does any other target really use emulated tls besides darwin? 2) Is standard tls the same as native tls? In other words, are there really three forms, (tls, native tls and emulated tls, or just two forms (native) tls and emulated tls? I ask because according to... case ${host} in i[34567]86-*-linux* | x86_64-*-linux* | \ i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | \ i[34567]86-*-gnu*) tmake_file=${tmake_file} t-tls ;; esac ...only those targets are using native tls which would suggest (if there are only two forms of tls) that targets like powerpc64-*-linux* should be using emulated tls like darwin and thus be failing the profile testcases now. This isn't the case. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #2 from howarth at nitro dot med dot uc dot edu 2010-03-31 13:42 --- Richard Guenther has suggested that these two unresolved symbols need to be exported. I'll test that this evening. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #3 from howarth at nitro dot med dot uc dot edu 2010-03-31 14:53 --- Does this change applied to libmudflap (which we don't build on darwin) provide a template for what we might need to do? Author: jiez Date: Fri Jan 23 04:58:03 2009 New Revision: 143583 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=143583 Log: libmudflap/ * mf-impl.h (__mf_get_state, __mf_set_state): Don't use __thread when TLS support is emulated. * mf-hooks3.c (__mf_get_state, __mf_set_state): Likewise. * mf-runtime.c (__mf_state_1): Likewise. * configure.ac: Use GCC_CHECK_EMUTLS. * configure: Regenerate. * config.h.in: Regenerate. config/ * tls.m4 (GCC_CHECK_EMUTLS): Define. Modified: trunk/config/ChangeLog trunk/config/tls.m4 trunk/libmudflap/ChangeLog trunk/libmudflap/config.h.in trunk/libmudflap/configure trunk/libmudflap/configure.ac trunk/libmudflap/mf-hooks3.c trunk/libmudflap/mf-impl.h trunk/libmudflap/mf-runtime.c I noticed they they are opting out of using __thread in a particular case for emulated TLS. Perhaps this is another instance requiring a similar change. This was proposed in... http://gcc.gnu.org/ml/gcc-patches/2009-01/msg00406.html and discussed in the thread leading up to that post (which terminates the thread). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #4 from howarth at nitro dot med dot uc dot edu 2010-03-31 15:19 --- If I am reading gcc/configure.ac correctly, darwin shouldn't using TLS in that part of the build. So perhaps we just need to add a wrapper like... Index: gcc/tree-profile.c === --- gcc/tree-profile.c (revision 157868) +++ gcc/tree-profile.c (working copy) @@ -82,7 +82,9 @@ TREE_PUBLIC (ic_void_ptr_var) = 0; DECL_ARTIFICIAL (ic_void_ptr_var) = 1; DECL_INITIAL (ic_void_ptr_var) = NULL; + #ifdef HAVE_AS_TLS DECL_TLS_MODEL (ic_void_ptr_var) = decl_default_tls_model (ic_void_ptr_var); + #endif varpool_finalize_decl (ic_void_ptr_var); gcov_type_ptr = build_pointer_type (get_gcov_type ()); or do we need more tests for TLS in configure.ac there? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #5 from howarth at nitro dot med dot uc dot edu 2010-03-31 15:23 --- Of course this does beg the question of why other instances of... DECL_TLS_MODEL ()=decl_default_tls_model (); ...such as... DECL_TLS_MODEL (v) = decl_default_tls_model (v); ...in gcc/c-parser.c and... DECL_TLS_MODEL (decl) = decl_default_tls_model (decl); in gcc/c-decl.c don't trigger undefined symbols on darwin. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #6 from howarth at nitro dot med dot uc dot edu 2010-03-31 20:21 --- Untested patch... Index: varasm.c === --- varasm.c(revision 157893) +++ 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; @@ -353,8 +354,8 @@ struct tree_map *h, in; void **loc; - if (targetm.have_tls || decl == NULL || decl == error_mark_node - || TREE_CODE (decl) != VAR_DECL || ! DECL_THREAD_LOCAL_P (decl)) + assert (!targetm.have_tls TREE_CODE (decl) == VAR_DECL + DECL_THREAD_LOCAL_P (decl)); return decl; /* Look up the object in the hash; return the control structure if @@ -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: tree-profile.c === --- tree-profile.c (revision 157893) +++ tree-profile.c (working copy) @@ -79,7 +79,8 @@ 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_COMMON (ic_void_ptr_var) = 1; DECL_ARTIFICIAL (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); @@ -91,7 +92,8 @@ 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_COMMON (ic_void_ptr_var) = 1; DECL_ARTIFICIAL (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); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #7 from dominiq at lps dot ens dot fr 2010-03-31 20:40 --- + assert (!targetm.have_tls TREE_CODE (decl) == VAR_DECL + DECL_THREAD_LOCAL_P (decl)); s/assert/gcc_assert/ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #8 from dominiq at lps dot ens dot fr 2010-03-31 20:54 --- With the patch in comment #6, I get: [macbook] f90/bug% gcc45 -fprofile-generate -O3 /opt/gcc/work/gcc/testsuite/gcc.dg/matrix/transpose-1.c gcc45: Internal error: Segmentation fault (program cc1) Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x7fff5bc00ff8 0x000100811f9b in lookup_attribute (attr_name=0x10098a348 ms_abi, list=0x141dafbb8) at ../../work/gcc/tree.c:5073 5073{ (gdb) bt #0 0x000100811f9b in lookup_attribute (attr_name=0x10098a348 ms_abi, list=0x141dafbb8) at ../../work/gcc/tree.c:5073 #1 0x00010087020c in ix86_function_type_abi (fntype=value temporarily unavailable, due to optimizations) at ../../work/gcc/config/i386/i386.c:4816 #2 0x000100870a45 in ix86_reg_parm_stack_space (fndecl=value temporarily unavailable, due to optimizations) at ../../work/gcc/config/i386/i386.c:4798 #3 0x000100317db4 in expand_call (exp=0x101774288, target=0x0, ignore=0) at ../../work/gcc/calls.c:2082 #4 0x0001002fab1e in expand_builtin (exp=0x101774288, target=0x0, subtarget=0x0, mode=value temporarily unavailable, due to optimizations, ignore=0) at ../../work/gcc/builtins.c:6418 #5 0x000100405673 in expand_expr_real_1 (exp=0x101774288, target=value temporarily unavailable, due to optimizations, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9251 #6 0x000100415092 in expand_expr_real_2 (ops=0x7fff5bc01630, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL) at expr.h:558 #7 0x00010040401f in expand_expr_real_1 (exp=0x101773810, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9650 #8 0x000100412127 in expand_expr_addr_expr_1 (exp=value temporarily unavailable, due to optimizations, target=0x0, tmode=DImode, modifier=EXPAND_NORMAL, as=value temporarily unavailable, due to optimizations) at expr.h:558 #9 0x000100405d16 in expand_expr_real_1 (exp=0x101773720, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:7007 #10 0x00010031a656 in expand_call (exp=0x101774240, target=0x0, ignore=0) at expr.h:564 #11 0x0001002fab1e in expand_builtin (exp=0x101774240, target=0x0, subtarget=0x0, mode=value temporarily unavailable, due to optimizations, ignore=0) at ../../work/gcc/builtins.c:6418 #12 0x000100405673 in expand_expr_real_1 (exp=0x101774240, target=value temporarily unavailable, due to optimizations, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9251 #13 0x000100415092 in expand_expr_real_2 (ops=0x7fff5bc01fb0, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL) at expr.h:558 #14 0x00010040401f in expand_expr_real_1 (exp=0x101773780, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9650 #15 0x000100412127 in expand_expr_addr_expr_1 (exp=value temporarily unavailable, due to optimizations, target=0x0, tmode=DImode, modifier=EXPAND_NORMAL, as=value temporarily unavailable, due to optimizations) at expr.h:558 #16 0x000100405d16 in expand_expr_real_1 (exp=0x101773690, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:7007 #17 0x00010031a656 in expand_call (exp=0x1017741f8, target=0x0, ignore=0) at expr.h:564 #18 0x0001002fab1e in expand_builtin (exp=0x1017741f8, target=0x0, subtarget=0x0, mode=value temporarily unavailable, due to optimizations, ignore=0) at ../../work/gcc/builtins.c:6418 #19 0x000100405673 in expand_expr_real_1 (exp=0x1017741f8, target=value temporarily unavailable, due to optimizations, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9251 #20 0x000100415092 in expand_expr_real_2 (ops=0x7fff5bc02930, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL) at expr.h:558 #21 0x00010040401f in expand_expr_real_1 (exp=0x1017736f0, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:9650 #22 0x000100412127 in expand_expr_addr_expr_1 (exp=value temporarily unavailable, due to optimizations, target=0x0, tmode=DImode, modifier=EXPAND_NORMAL, as=value temporarily unavailable, due to optimizations) at expr.h:558 #23 0x000100405d16 in expand_expr_real_1 (exp=0x101773600, target=value temporarily unavailable, due to optimizations, tmode=DImode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at ../../work/gcc/expr.c:7007 ... and so on ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #9 from howarth at nitro dot med dot uc dot edu 2010-03-31 21:05 --- What happens if you revert the section... @@ -353,8 +354,8 @@ struct tree_map *h, in; void **loc; - if (targetm.have_tls || decl == NULL || decl == error_mark_node - || TREE_CODE (decl) != VAR_DECL || ! DECL_THREAD_LOCAL_P (decl)) + assert (!targetm.have_tls TREE_CODE (decl) == VAR_DECL + DECL_THREAD_LOCAL_P (decl)); return decl; /* Look up the object in the hash; return the control structure if -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #10 from howarth at nitro dot med dot uc dot edu 2010-03-31 23:30 --- Is it expected that the lines... /* Add code: static gcov* __gcov_indirect_call_counters; // pointer to actual counter static void* __gcov_indirect_call_callee; // actual callee address */ are commented in tree-profile.c? It is curious that these happen to be the same two symbols that end up unresolved. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #11 from howarth at nitro dot med dot uc dot edu 2010-03-31 23:51 --- Those add code comments are from the patch first proposed... http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00918.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #12 from howarth at nitro dot med dot uc dot edu 2010-04-01 05:11 --- Proposed patch posted to http://gcc.gnu.org/ml/gcc-patches/2010-04/msg5.html. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602
[Bug middle-end/43602] ___emutls_v.__gcov_indirect_call_[counters|callee] undefined on *-*-darwin*
--- Comment #13 from howarth at nitro dot med dot uc dot edu 2010-04-01 05:13 --- Created an attachment (id=20268) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20268action=view) proposed patch to fix visibility issues on darwin -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43602