Hi David,

this is the patch I'm currently testing with gcc-4.8.4 for
http://gcc.gnu.org/PR65058

Thanks!
/haubi/
>From 0f5003fb25608cdae53445777e6a13fec3fbfffc Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com>
Date: Fri, 13 Feb 2015 19:26:27 +0100
Subject: [PATCH 1/5] Fix decorating referenced externals for xcoff.

2015-02-13  Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com>

	PR target/65058
	* config/rs6000/rs6000.c: (rs6000_output_symbol_ref) Decorate
	referenced external variable or function accordingly.
	* config/rs6000/xcoff.h: (ASM_OUTPUT_EXTERNAL) Stop decorating
	referenced variable or function.
---
 gcc/config/rs6000/rs6000.c | 13 +++++++++++++
 gcc/config/rs6000/xcoff.h  |  9 ---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 86ef0fe..15dd25f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -26030,6 +26030,19 @@ rs6000_output_symbol_ref (FILE *file, rtx x)
      section.  */
   const char *name = XSTR (x, 0);
 
+  tree decl = SYMBOL_REF_DECL (x);
+  if (decl /* sync condition with assemble_external () */
+      && DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)
+      && (TREE_CODE (decl) == VAR_DECL
+       || TREE_CODE (decl) == FUNCTION_DECL)
+      && name[strlen (name) - 1] != ']')
+    {
+      name = concat (name,
+		     (TREE_CODE (decl) == FUNCTION_DECL
+		      ? "[DS]" : "[RW]"),
+		     NULL);
+      XSTR (x, 0) = name;
+    }									\
   if (VTABLE_NAME_P (name))
     {
       RS6000_OUTPUT_BASENAME (file, name);
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 6dc1207..db024fc 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -170,15 +170,6 @@
       putc ('\n', FILE);						\
       fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME);		\
     }									\
-  if ((TREE_CODE (DECL) == VAR_DECL					\
-       || TREE_CODE (DECL) == FUNCTION_DECL)				\
-      && (NAME)[strlen (NAME) - 1] != ']')				\
-    {									\
-      XSTR (_symref, 0) = concat (XSTR (_symref, 0),			\
-				  (TREE_CODE (DECL) == FUNCTION_DECL	\
-				   ? "[DS]" : "[RW]"),			\
-				  NULL);				\
-    }									\
 }
 
 /* This is how to output a reference to a user-level label named NAME.
-- 
2.0.5

Reply via email to