This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ATTRIBUTE_WEAK not working in crtstuff.c?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]