This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: "Generic" gthread model
>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
> On Wed, Aug 22, 2001 at 02:14:28PM +0100, Jason Merrill wrote:
>> This seems rather bogus; instances of #ifdef HANDLE_PRAGMA_WEAK
>> in varasm.c should be changed to test SUPPORTS_WEAK instead.
> Yep, discovered this yesterday playing with mips bits with echristo.
> I fixed it all in his tree; I was going to let him test the changes
> before submitting them.
Do they look something like this?
*** varasm.c.~1~ Wed Aug 22 15:53:58 2001
--- varasm.c Wed Aug 22 16:17:30 2001
*************** output_constructor (exp, size, align)
*** 4801,4807 ****
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. */
--- 4801,4818 ----
assemble_zeros (size - total_bytes);
}
! /* This structure contains any weak symbol declarations waiting to be
! emitted. */
!
! struct weak_syms
! {
! struct weak_syms * next;
! const char * name;
! const char * value;
! };
!
! struct weak_syms * weak_decls;
!
/* Add function NAME to the weak symbols list. VALUE is a weak alias
associatd with NAME. */
*************** add_weak (name, value)
*** 4817,4822 ****
--- 4828,4838 ----
if (weak == NULL)
return 0;
+ #ifndef ASM_OUTPUT_WEAK_ALIAS
+ if (value)
+ abort ();
+ #endif
+
weak->next = weak_decls;
weak->name = name;
weak->value = value;
*************** add_weak (name, value)
*** 4824,4830 ****
return 1;
}
- #endif /* HANDLE_PRAGMA_WEAK */
/* Declare DECL to be a weak symbol. */
--- 4840,4845 ----
*************** declare_weak (decl)
*** 4836,4865 ****
error_with_decl (decl, "weak declaration of `%s' must be public");
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)
{
struct weak_syms *t;
for (t = weak_decls; t; t = t->next)
{
if (t->name)
ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value);
}
}
#endif
--- 4851,4881 ----
error_with_decl (decl, "weak declaration of `%s' must be public");
else if (TREE_ASM_WRITTEN (decl))
error_with_decl (decl, "weak declaration of `%s' must precede definition");
! else if (! (SUPPORTS_WEAK))
! warning_with_decl (decl, "weak declaration of `%s' not supported");
!
! DECL_WEAK (decl) = 1;
! add_weak (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), NULL);
}
/* Emit any pending weak declarations. */
void
weak_finish ()
{
! #ifdef ASM_WEAKEN_LABEL
! if (SUPPORTS_WEAK)
{
struct weak_syms *t;
for (t = weak_decls; t; t = t->next)
{
+ #ifdef ASM_OUTPUT_WEAK_ALIAS
if (t->name)
ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value);
+ #else
+ if (t->name)
+ ASM_WEAKEN_LABEL (asm_out_file, t->name);
+ #endif
}
}
#endif
*************** weak_finish ()
*** 4868,4891 ****
/* 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)
{
! struct weak_syms *t;
! for (t = weak_decls; t; t = t->next)
! {
! if (t->name && strcmp (name, t->name) == 0)
! t->name = NULL;
! }
}
- #endif
}
! #endif
void
assemble_alias (decl, target)
--- 4884,4904 ----
/* Remove NAME from the pending list of weak symbols. This prevents
the compiler from emitting multiple .weak directives which confuses
some assemblers. */
!
static void
remove_from_pending_weak_list (name)
const char *name ATTRIBUTE_UNUSED;
{
! struct weak_syms *t;
! for (t = weak_decls; t; t = t->next)
{
! if (t->name && strcmp (name, t->name) == 0)
! t->name = NULL;
}
}
!
! /* Emit an assembler directive to make the symbol for DECL an alias to
! the symbol for TARGET. */
void
assemble_alias (decl, target)
*** c-pragma.h.~1~ Wed Aug 22 15:53:49 2001
--- c-pragma.h Wed Aug 22 16:58:51 2001
*************** Software Foundation, 59 Temple Place - S
*** 43,59 ****
#ifdef HANDLE_PRAGMA_WEAK
- /* This structure contains any weak symbol declarations waiting to be emitted. */
- struct weak_syms
- {
- struct weak_syms * next;
- const char * name;
- const char * value;
- };
-
- /* Declared in varasm.c */
- extern struct weak_syms * weak_decls;
-
extern int add_weak PARAMS ((const char *, const char *));
#endif /* HANDLE_PRAGMA_WEAK */
--- 43,48 ----