Commit 0e9264a2 by Jeffrey A Law Committed by Jeff Law

* 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.

From-SVN: r25454
parent cdf62c54
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> Thu Feb 25 23:43:59 1999 Richard Henderson <rth@cygnus.com>
Flow rewrite to use basic block structures and edge lists: Flow rewrite to use basic block structures and edge lists:
......
...@@ -192,30 +192,6 @@ insert_pack_attributes (node, attributes, prefix) ...@@ -192,30 +192,6 @@ insert_pack_attributes (node, attributes, prefix)
} }
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#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 */
/* Handle one token of a pragma directive. TOKEN is the current token, and /* 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 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 tokens, and will only pass in a STRING. Also some front ends will reuse
......
...@@ -56,6 +56,8 @@ struct weak_syms ...@@ -56,6 +56,8 @@ struct weak_syms
/* Declared in varasm.c */ /* Declared in varasm.c */
extern struct weak_syms * weak_decls; extern struct weak_syms * weak_decls;
extern int add_weak PROTO((char *, char *));
#endif /* HANDLE_PRAGMA_WEAK */ #endif /* HANDLE_PRAGMA_WEAK */
......
...@@ -4269,6 +4269,31 @@ output_constructor (exp, size) ...@@ -4269,6 +4269,31 @@ output_constructor (exp, size)
assemble_zeros (size - total_bytes); 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. */ /* Declare DECL to be a weak symbol. */
void void
...@@ -4281,6 +4306,9 @@ declare_weak (decl) ...@@ -4281,6 +4306,9 @@ declare_weak (decl)
error_with_decl (decl, "weak declaration of `%s' must precede definition"); error_with_decl (decl, "weak declaration of `%s' must precede definition");
else if (SUPPORTS_WEAK) else if (SUPPORTS_WEAK)
DECL_WEAK (decl) = 1; DECL_WEAK (decl) = 1;
#ifdef HANDLE_PRAGMA_WEAK
add_weak (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), NULL);
#endif
} }
/* Emit any pending weak declarations. */ /* Emit any pending weak declarations. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment