On 03/31/2010 06:24 PM, Jack Howarth wrote:
On Wed, Mar 31, 2010 at 05:50:14PM +0200, Paolo Bonzini wrote:

[MacPro:darwin_objdir/x86_64-apple-darwin10.3.0/libgcc] howarth% nm
libgcc_ext.10.5.dylib | grep emutls
00013e70 T ___emutls_get_address
00014070 T ___emutls_register_common

I suppose they are not exported.

Richard.

Richard,
      Shouldn't these still show up in the output from...

nm libgcc_s.1.dylib | grep emutls

with a lower case symbol type?

Not if they end up as private_extern symbols (i.e. hidden in GCC/ELF
parlance).

Paolo

Paolo,
    So are you saying that we need to use...

Index: gcc/tree-profile.c
===================================================================
--- gcc/tree-profile.c  (revision 157873)
+++ gcc/tree-profile.c  (working copy)
@@ -79,7 +79,7 @@
                  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_INITIAL (ic_void_ptr_var) = NULL;
    DECL_TLS_MODEL (ic_void_ptr_var) = decl_default_tls_model (ic_void_ptr_var);
@@ -91,7 +91,7 @@
                  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_INITIAL (ic_gcov_type_ptr_var) = NULL;
    DECL_TLS_MODEL (ic_gcov_type_ptr_var) = decl_default_tls_model 
(ic_gcov_type_ptr_var);

I assume also adding...

Index: tree-profile.c
===================================================================
--- tree-profile.c      (revision 157873)
+++ tree-profile.c      (working copy)
@@ -64,8 +64,8 @@
  /* Do initialization work for the edge profiler.  */

  /* Add code:
-   static gcov*        __gcov_indirect_call_counters; // pointer to actual 
counter
-   static void*        __gcov_indirect_call_callee; // actual callee address
+   static gcov*        __gcov_indirect_call_counters __attribute__ 
((visibility("default")); // pointer to actual counter
+   static void*        __gcov_indirect_call_callee __attribute__ 
((visibility("default")); // actual callee address
  */
  static void
  tree_init_ic_make_global_vars (void)

would be redundant. Or do we just really need to delete the TREE_PUBLIC's 
instead...

Index: tree-profile.c
===================================================================
--- tree-profile.c      (revision 157873)
+++ tree-profile.c      (working copy)
@@ -79,7 +79,6 @@
                  get_identifier ("__gcov_indirect_call_callee"),
                  ptr_void);
    TREE_STATIC (ic_void_ptr_var) = 1;
-  TREE_PUBLIC (ic_void_ptr_var) = 0;
    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 +90,6 @@
                  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;
    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);

I was thinking of DECL_VISIBILITY/DECL_VISIBILITY_SPECIFIED, but if the symbols are not public, the visibility should not matter.

You need to do more debugging, including seeing what the decl actually looks like (breakpoint on assemble_variable).

BTW, here there seems to be a bug:

tree
emutls_decl (tree decl)
{
  tree name, to;
  struct tree_map *h, in;
  void **loc;
  ...
  DECL_WEAK (to) = DECL_WEAK (decl);
  DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);

  return to;
}

DECL_VISIBILITY_SPECIFIED is not copied; same in get_emutls_init_templ_addr. Also BTW, a possible cleanup in emutls_decl should be to change

  if (targetm.have_tls || decl == NULL || decl == error_mark_node
      || TREE_CODE (decl) != VAR_DECL || ! DECL_THREAD_LOCAL_P (decl))
    return decl;

to

  assert (!targetm.have_tls && TREE_CODE (decl) == VAR_DECL
          && DECL_THREAD_LOCAL_P (decl));

Maybe looking at these will allow you to find the real cause...

Paolo

Reply via email to