* varasm.c (assemble_start_function): Add weak_global_object_name.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jun 1998 22:09:24 +0000 (22:09 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jun 1998 22:09:24 +0000 (22:09 +0000)
        * tree.c (get_file_function_name): Use it.

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

gcc/ChangeLog
gcc/tree.c
gcc/varasm.c

index d323b75..b93e2d1 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 19 23:06:33 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * varasm.c (assemble_start_function): Add weak_global_object_name.
+       * tree.c (get_file_function_name): Use it.
+
 Fri Jun 19 22:55:14 1998  Jeffrey A Law  (law@cygnus.com)
 
        * c-lang.c (GNU_xref_begin, GNU_xref_end): Deleted.
index f388cea..75e1e1f 100644 (file)
@@ -4793,6 +4793,7 @@ dump_tree_statistics ()
 #endif /* NO_DOLLAR_IN_LABEL */
 
 extern char * first_global_object_name;
+extern char * weak_global_object_name;
 
 /* If KIND=='I', return a suitable global initializer (constructor) name.
    If KIND=='D', return a suitable global clean-up (destructor) name.  */
@@ -4806,6 +4807,8 @@ get_file_function_name (kind)
 
   if (first_global_object_name)
     p = first_global_object_name;
+  else if (weak_global_object_name)
+    p = weak_global_object_name;
   else if (main_input_filename)
     p = main_input_filename;
   else
index cd65c90..22b752d 100644 (file)
@@ -85,6 +85,7 @@ extern FILE *asm_out_file;
 
 /* The (assembler) name of the first globally-visible object output.  */
 char *first_global_object_name;
+char *weak_global_object_name;
 
 extern struct obstack *current_obstack;
 extern struct obstack *saveable_obstack;
@@ -1003,14 +1004,19 @@ assemble_start_function (decl, fnname)
 
   if (TREE_PUBLIC (decl))
     {
-      if (!first_global_object_name && ! DECL_WEAK (decl)
-         && ! DECL_ONE_ONLY (decl))
+      if (! first_global_object_name)
        {
          char *p;
+         char **name;
+
+         if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
+           name = &first_global_object_name;
+         else
+           name = &weak_global_object_name;
 
          STRIP_NAME_ENCODING (p, fnname);
-         first_global_object_name = permalloc (strlen (p) + 1);
-         strcpy (first_global_object_name, p);
+         *name = permalloc (strlen (p) + 1);
+         strcpy (*name, p);
        }
 
 #ifdef ASM_WEAKEN_LABEL