* 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
+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:
}
#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
/* Declared in varasm.c */
extern struct weak_syms * weak_decls;
+
+extern int add_weak PROTO((char *, char *));
#endif /* HANDLE_PRAGMA_WEAK */
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
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. */