This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.1 Prerelease
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 23 Apr 2002 19:58:40 +0930
- Subject: Re: GCC 3.1 Prerelease
- References: <14800000.1019552485@gandalf.codesourcery.com>
On Tue, Apr 23, 2002 at 02:01:25AM -0700, Mark Mitchell wrote:
>
> Joseph, if you have time to look at PR 6343 (C front end regression
> involving "attribute((weak))"), please do so. I can imagine this
> being a significant problem.
I've been using this, which at least cures the problem with
__register_frame_info*. Credit for the patch goes to Franz Sirl.
diff -urpN -xCVS -x'*~' -xTAGS gcc-31.orig/gcc/c-decl.c gcc-31/gcc/c-decl.c
--- gcc-31.orig/gcc/c-decl.c 2002-04-03 09:00:04.000000000 +0930
+++ gcc-31/gcc/c-decl.c 2002-04-23 18:06:31.000000000 +0930
@@ -1955,7 +1955,16 @@ duplicate_decls (newdecl, olddecl, diffe
}
/* Merge the storage class information. */
- DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
+ if (DECL_WEAK (newdecl) && !DECL_WEAK (olddecl))
+ declare_weak (olddecl);
+ if (!DECL_WEAK (newdecl) && DECL_WEAK (olddecl))
+ declare_weak (newdecl);
+ if (DECL_WEAK (newdecl) && DECL_RTL (newdecl)
+ && GET_CODE (DECL_RTL (newdecl)) == MEM
+ && XEXP (DECL_RTL (newdecl), 0)
+ && GET_CODE (XEXP (DECL_RTL (newdecl), 0)) == SYMBOL_REF)
+ SYMBOL_REF_WEAK (XEXP (DECL_RTL (newdecl), 0)) = 1;
+
/* For functions, static overrides non-static. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
diff -urpN -xCVS -x'*~' -xTAGS gcc-31.orig/gcc/cp/decl.c gcc-31/gcc/cp/decl.c
--- gcc-31.orig/gcc/cp/decl.c 2002-04-17 18:56:57.000000000 +0930
+++ gcc-31/gcc/cp/decl.c 2002-04-23 18:06:31.000000000 +0930
@@ -3645,7 +3645,15 @@ duplicate_decls (newdecl, olddecl)
}
/* Merge the storage class information. */
- DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
+ if (DECL_WEAK (newdecl) && !DECL_WEAK (olddecl))
+ declare_weak (olddecl);
+ if (!DECL_WEAK (newdecl) && DECL_WEAK (olddecl))
+ declare_weak (newdecl);
+ if (DECL_WEAK (newdecl) && DECL_RTL (newdecl)
+ && GET_CODE (DECL_RTL (newdecl)) == MEM
+ && XEXP (DECL_RTL (newdecl), 0)
+ && GET_CODE (XEXP (DECL_RTL (newdecl), 0)) == SYMBOL_REF)
+ SYMBOL_REF_WEAK (XEXP (DECL_RTL (newdecl), 0)) = 1;
DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl);
DECL_DEFER_OUTPUT (newdecl) |= DECL_DEFER_OUTPUT (olddecl);
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
--
Alan Modra
IBM OzLabs - Linux Technology Centre