------- 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

Reply via email to