OSDN Git Service

* c-pragma.c (add_weak); Delete. Moved into...
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 1999 01:29:21 +0000 (01:29 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 1999 01:29:21 +0000 (01:29 +0000)
        * varasm.c (add_weak): New external function.
        (declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to
        the list of weak functions.
        * c-pragma (add_weak): Declare.

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

gcc/ChangeLog
gcc/c-pragma.c
gcc/c-pragma.h
gcc/varasm.c

index 69d0497..76e57ea 100644 (file)
@@ -1,3 +1,11 @@
+Fri Feb 26 02:24:57 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * c-pragma.c (add_weak); Delete.  Moved into...
+       * varasm.c (add_weak): New external function.
+       (declare_weak): If HANDLE_PRAGMA_WEAK, then add the function to
+       the list of weak functions.
+       * c-pragma (add_weak): Declare.
+
 Thu Feb 25 23:43:59 1999  Richard Henderson  <rth@cygnus.com>
 
        Flow rewrite to use basic block structures and edge lists:
index d83789d..09fac1f 100644 (file)
@@ -192,30 +192,6 @@ insert_pack_attributes (node, attributes, prefix)
 }
 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
 \f
-#ifdef HANDLE_PRAGMA_WEAK
-static int add_weak PROTO((char *, char *));
-
-static int
-add_weak (name, value)
-     char * name;
-     char * value;
-{
-  struct weak_syms * weak;
-
-  weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
-
-  if (weak == NULL)
-    return 0;
-  
-  weak->next  = weak_decls;
-  weak->name  = name;
-  weak->value = value;
-  weak_decls  = weak;
-
-  return 1;
-}
-#endif /* HANDLE_PRAGMA_WEAK */
-\f
 /* Handle one token of a pragma directive.  TOKEN is the current token, and
    STRING is its printable form.  Some front ends do not support generating
    tokens, and will only pass in a STRING.  Also some front ends will reuse
index 195f175..ddc74d1 100644 (file)
@@ -56,6 +56,8 @@ struct weak_syms
 
 /* Declared in varasm.c */
 extern struct weak_syms * weak_decls;
+
+extern int add_weak PROTO((char *, char *));
 #endif /* HANDLE_PRAGMA_WEAK */
 
 
index a247cd7..a6ee794 100644 (file)
@@ -4269,6 +4269,31 @@ output_constructor (exp, size)
     assemble_zeros (size - total_bytes);
 }
 
+#ifdef HANDLE_PRAGMA_WEAK
+/* Add function NAME to the weak symbols list.  VALUE is a weak alias
+   associatd with NAME.  */
+   
+int
+add_weak (name, value)
+     char *name;
+     char *value;
+{
+  struct weak_syms *weak;
+
+  weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
+
+  if (weak == NULL)
+    return 0;
+
+  weak->next = weak_decls;
+  weak->name = name;
+  weak->value = value;
+  weak_decls = weak;
+
+  return 1;
+}
+#endif /* HANDLE_PRAGMA_WEAK */
+
 /* Declare DECL to be a weak symbol.  */
 
 void
@@ -4281,6 +4306,9 @@ declare_weak (decl)
     error_with_decl (decl, "weak declaration of `%s' must precede definition");
   else if (SUPPORTS_WEAK)
     DECL_WEAK (decl) = 1;
+#ifdef HANDLE_PRAGMA_WEAK
+   add_weak (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), NULL);
+#endif
 }
 
 /* Emit any pending weak declarations.  */