This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ATTRIBUTE_WEAK not working in crtstuff.c?
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Raja R Harinath <harinath at cs dot umn dot edu>
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 18 Apr 2002 17:22:05 +0930
- Subject: Re: ATTRIBUTE_WEAK not working in crtstuff.c?
- References: <d9d6wxx233.fsf@bose.cs.umn.edu>
Hmm, we put the new decl on weakdecls list, but then never use the
new one so the !TREE_USED test in weak_finish prevents the asm
.weak being emitted. This is one way to fix the problem.
gcc/ChangeLog
* c-decl.c (duplicate_decls): Call declare_weak on olddecl.
diff -urpN -xCVS -x*~ gcc-ppc64-31.orig/gcc/c-decl.c gcc-ppc64-31/gcc/c-decl.c
--- gcc-ppc64-31.orig/gcc/c-decl.c Wed Apr 3 09:00:04 2002
+++ gcc-ppc64-31/gcc/c-decl.c Thu Apr 18 17:14:08 2002
@@ -1421,6 +1421,9 @@ duplicate_decls (newdecl, olddecl, diffe
}
}
+ if (DECL_WEAK (newdecl) && !DECL_WEAK (olddecl))
+ declare_weak (olddecl);
+
DECL_ATTRIBUTES (newdecl)
= (*targetm.merge_decl_attributes) (olddecl, newdecl);
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre