SOURCES: gcc-pr29943.patch (NEW) - ppc fix.

pluto pluto at pld-linux.org
Wed Feb 14 21:23:07 CET 2007


Author: pluto                        Date: Wed Feb 14 20:23:07 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- ppc fix.

---- Files affected:
SOURCES:
   gcc-pr29943.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/gcc-pr29943.patch
diff -u /dev/null SOURCES/gcc-pr29943.patch:1.1
--- /dev/null	Wed Feb 14 21:23:07 2007
+++ SOURCES/gcc-pr29943.patch	Wed Feb 14 21:23:02 2007
@@ -0,0 +1,46 @@
+This patch fixes a problem with -fsection-anchors and variables
+declared with "attribute ((alias ()))".  In some circumstances, both
+an alias (symbol equated to another symbol) and a normal definition
+(label plus space allocation) were being emitted.  See the PR for
+details.  This causes current glibc ld.so to fail on powerpc-linux
+where section anchors are enabled by default.
+
+The reduced testcatse from the PR looks like:
+
+extern char **_dl_argv __attribute__ ((section (".data.rel.ro")));
+extern char **_dl_argv_internal __attribute__ ((visibility ("hidden")))
+  __attribute__ ((section (".data.rel.ro")));
+
+char **_dl_argv __attribute__ ((section (".data.rel.ro"))) = ((void *)0);
+extern __typeof (_dl_argv) _dl_argv_internal
+  __attribute__ ((alias ("_dl_argv")));
+
+char* foo () { return _dl_argv_internal[0]; }
+
+The section attribute on _dl_argv_internal is one of the triggers
+for this bug.  I think glibc is doing something slightly dodgy in
+specifying a section on an aliased variable, but at least the section
+agrees with the real variable.
+
+:ADDPATCH target rs6000:
+
+Bootstrapped and regression tested powerpc-linux, all languages but
+ada.
+
+	PR target/29943
+	* varasm.c (use_blocks_for_decl_p): Return false for decls with
+	alias attribute.
+
+--- gcc/gcc/varasm.c	(revision 119100)
++++ gcc/gcc/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;
+ }
+ 
================================================================


More information about the pld-cvs-commit mailing list