Hi, I got this and the next mail I'll forward from Jack (I'm not sure if he did also send them to you).
cu Adrian ---------- Forwarded message ---------- Date: Tue, 1 May 2001 22:00:44 -0400 (EDT) From: Jack Howarth <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: gcc 2.95.4 fix Hello, In case Franz Sirl hasn't passed this along, he has a work-around for gcc 2.95.4 that allows glibc 2.2.3 to be built. Franz pointed me to his bulk patch for gcc 2.95.4 that didn't have this fix parsed out by itself however I believe this section is self-contained. Index: gcc/varasm.c =================================================================== RCS file: /cvs/gcc/egcs/gcc/varasm.c,v retrieving revision 1.59.4.8 diff -u -p -r1.59.4.8 varasm.c --- gcc/varasm.c 2001/03/28 09:02:17 1.59.4.8 +++ gcc/varasm.c 2001/05/01 17:11:28 @@ -118,6 +118,8 @@ struct constant_descriptor; struct rtx_const; struct pool_constant; +void declare_weak PROTO ((tree)); + static const char *strip_reg_name PROTO((const char *)); static int contains_pointers_p PROTO((tree)); static void decode_addr_const PROTO((tree, struct addr_const *)); @@ -143,6 +145,7 @@ static int output_addressed_constants PR static void output_after_function_constants PROTO((void)); static void output_constructor PROTO((tree, int)); static void remove_from_pending_weak_list PROTO ((char *)); +static int is_on_pending_weak_list PROTO ((char *)); #ifdef ASM_OUTPUT_BSS static void asm_output_bss PROTO((FILE *, tree, char *, int, int)); #endif @@ -755,6 +758,9 @@ make_decl_rtl (decl, asmspec, top_level) DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl), gen_rtx_SYMBOL_REF (Pmode, name)); MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl); + if (is_on_pending_weak_list (name)) + declare_weak (decl); + SYMBOL_REF_WEAK (XEXP (DECL_RTL (decl), 0)) = DECL_WEAK (decl); /* If this variable is to be treated as volatile, show its tree node has side effects. If it has side effects, either @@ -4344,8 +4350,15 @@ declare_weak (decl) { if (! TREE_PUBLIC (decl)) error_with_decl (decl, "weak declaration of `%s' must be public"); +#if 0 + /* Due to a bug this error was never active, enabling it now would break + glibc. */ else if (TREE_ASM_WRITTEN (decl)) error_with_decl (decl, "weak declaration of `%s' must precede definition"); + /* This would be a new error, but it would break glibc too :-(. */ + else if (TREE_USED (decl)) + error_with_decl (decl, "weak declaration of `%s' must precede its uses"); +#endif else if (SUPPORTS_WEAK) DECL_WEAK (decl) = 1; #ifdef HANDLE_PRAGMA_WEAK @@ -4397,6 +4410,24 @@ remove_from_pending_weak_list (name) } } #endif +} + +static int +is_on_pending_weak_list (name) + char *name; +{ +#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) + return 1; + } + } +#endif + return 0; } void You can check with Franz Sirl <[EMAIL PROTECTED]> if you have any questions on the hack but I know this works ppc for building glibc 2.2.3. Please do let me know if you apply this patch to any test packages of gcc 2.95.4 so I can build them on ppc and try them out. Jack Howarth