OSDN Git Service

* varasm.c (notice_global_symbol): Fix handling of variables; avoid
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 11 Oct 2003 17:38:29 +0000 (17:38 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 11 Oct 2003 17:38:29 +0000 (17:38 +0000)
re-computing of variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72343 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/varasm.c

index 825eafa..33f366c 100644 (file)
@@ -1,3 +1,8 @@
+Sat Oct 11 12:24:23 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       * varasm.c (notice_global_symbol):  Fix handling of variables; avoid
+       re-computing of variable.
+
 2003-10-11  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/alpha.c (alpha_return_in_memory): Rename from
index 3538072..561dc4a 100644 (file)
@@ -1041,13 +1041,24 @@ default_ctor_section_asm_out_constructor (rtx symbol,
 void
 notice_global_symbol (tree decl)
 {
-  if ((!first_global_object_name || !weak_global_object_name)
-      && TREE_PUBLIC (decl) && !DECL_COMMON (decl)
-      && !DECL_EXTERNAL (decl)
-      && (TREE_CODE (decl) == FUNCTION_DECL
-         || (TREE_CODE (decl) == VAR_DECL
-             && (DECL_INITIAL (decl) != 0
-                 && DECL_INITIAL (decl) != error_mark_node))))
+  const char **type = &first_global_object_name;
+
+  if (first_global_object_name
+      || !TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)
+      || !DECL_NAME (decl)
+      || (TREE_CODE (decl) != FUNCTION_DECL
+         && (TREE_CODE (decl) != VAR_DECL
+             || (DECL_COMMON (decl)
+                 && (DECL_INITIAL (decl) == 0
+                     || DECL_INITIAL (decl) == error_mark_node)))))
+    return;
+
+  /* We win when global object is found, but it is usefull to know about weak
+     symbol as well so we can produce nicer unique names.  */
+  if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl))
+    type = &weak_global_object_name;
+
+  if (!*type)
     {
       const char *p;
       char *name;
@@ -1056,10 +1067,7 @@ notice_global_symbol (tree decl)
       p = (* targetm.strip_name_encoding) (XSTR (XEXP (decl_rtl, 0), 0));
       name = xstrdup (p);
 
-      if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
-       first_global_object_name = name;
-      else
-       weak_global_object_name = name;
+      *type = name;
     }
 }