This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/29943] [4.2/4.3 Regression] gcc generate incorrect alias symbols for PPC
- From: "amodra at bigpond dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Nov 2006 08:01:36 -0000
- Subject: [Bug target/29943] [4.2/4.3 Regression] gcc generate incorrect alias symbols for PPC
- References: <bug-29943-10179@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from amodra at bigpond dot net dot au 2006-11-23 08:01 -------
This is the simple patch I've bootstrapped and am currently regression testing.
Index: varasm.c
===================================================================
--- varasm.c (revision 119100)
+++ varasm.c (working copy)
@@ -981,6 +981,10 @@ use_blocks_for_decl_p (tree decl)
if (DECL_INITIAL (decl) == decl)
return false;
+ /* If this decl is an alias, then we don't want to emit a definition. */
+ if (lookup_attribute ("alias", DECL_ATTRIBUTES (decl)))
+ return false;
+
return true;
}
Another possibility is to check for named sections in handle_alias_attribute
(and alias attributes in handle_section_attribute), possibly giving a
diagnostic. It's clear that code like
extern int a __attribute__ ((section (".sec1")));
extern int b __attribute__ ((section (".sec2")))
__attribute__ ((alias ("a")));
is invalid; b can't alias a and be in a different section. However, from the
previous discussion over 28598 I gather we don't want to go down the path of
checking section attributes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29943