This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: "Generic" gthread model
On 22 Aug 2001 12:20:36 -0700, Richard Henderson wrote:
> On Wed, Aug 22, 2001 at 08:13:58PM +0100, Jason Merrill wrote:
> > Do they look something like this?
>
> Something like that.
>
Here's what it was :) I'm just getting to integrating all of the mips
changes in...
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.202
diff -u -p -w -r1.202 varasm.c
--- varasm.c 2001/08/22 14:35:50 1.202
+++ varasm.c 2001/08/23 18:24:12
@@ -163,9 +163,7 @@ static void output_after_function_consta
static unsigned HOST_WIDE_INT array_size_for_constructor PARAMS ((tree));
static unsigned min_align PARAMS ((unsigned, unsigned));
static void output_constructor PARAMS ((tree, int, unsigned));
-#ifdef ASM_WEAKEN_LABEL
static void remove_from_pending_weak_list PARAMS ((const char *));
-#endif
static int in_named_entry_eq PARAMS ((const PTR, const PTR));
static hashval_t in_named_entry_hash PARAMS ((const PTR));
#ifdef ASM_OUTPUT_BSS
@@ -4801,10 +4799,11 @@ output_constructor (exp, size, align)
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. */
+struct weak_syms * weak_decls;
+
int
add_weak (name, value)
const char *name;
@@ -4812,7 +4811,7 @@ add_weak (name, value)
{
struct weak_syms *weak;
- weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
+ weak = (struct weak_syms *) xmalloc (sizeof (struct weak_syms));
if (weak == NULL)
return 0;
@@ -4824,7 +4823,6 @@ add_weak (name, value)
return 1;
}
-#endif /* HANDLE_PRAGMA_WEAK */
/* Declare DECL to be a weak symbol. */
@@ -4837,55 +4835,52 @@ declare_weak (decl)
else if (TREE_ASM_WRITTEN (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. */
-#ifdef HANDLE_PRAGMA_WEAK
-struct weak_syms * weak_decls;
-#endif
-
void
weak_finish ()
{
-#ifdef HANDLE_PRAGMA_WEAK
- if (HANDLE_PRAGMA_WEAK)
+ if (SUPPORTS_WEAK)
{
struct weak_syms *t;
for (t = weak_decls; t; t = t->next)
{
- if (t->name)
+#ifdef ASM_OUTPUT_WEAK_ALIAS
ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value);
+#endif
}
}
-#endif
}
/* Remove NAME from the pending list of weak symbols. This prevents
the compiler from emitting multiple .weak directives which confuses
some assemblers. */
-#ifdef ASM_WEAKEN_LABEL
static void
remove_from_pending_weak_list (name)
const char *name ATTRIBUTE_UNUSED;
{
-#ifdef HANDLE_PRAGMA_WEAK
- if (HANDLE_PRAGMA_WEAK)
+ if (SUPPORTS_WEAK)
{
- struct weak_syms *t;
- for (t = weak_decls; t; t = t->next)
+ struct weak_syms **pt, *t;
+
+ for (pt = &weak_decls, t = *pt; t ; t = *pt)
{
- if (t->name && strcmp (name, t->name) == 0)
- t->name = NULL;
+ if (strcmp (name, t->name) == 0)
+ {
+ *pt = t->next;
+ free (t);
}
+ else
+ pt = &t->next;
}
-#endif
}
-#endif
+}
void
assemble_alias (decl, target)
--
Look out behind you!