diff mbox

[CHKP,Solaris,PR,target/69917,committed] Respect transparent alias chains of assembler names

Message ID 20160323113054.GB309@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich March 23, 2016, 11:30 a.m. UTC
Hi,

This patch fixes gcc.target/i386/chkp-hidden-def.c test failure
on Solaris.  Failure happens because some Solaris emit code
ignores transparent alias chains for assembler names.  The patch
was tested and approved by Rainer Orth (see [1] for more details).
Applied to trunk.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69917

Thanks,
Ilya
--
gcc/

2016-03-23  Ilya Enkovich  <enkovich.gnu@gmail.com>

	PR target/69917
	* config/i386/sol2.h (ASM_OUTPUT_DEF_FROM_DECLS): Follow
	transparent alias chain for decl assembler name.
	* config/sol2.c (solaris_assemble_visibility): Likewise.

Comments

Rainer Orth March 30, 2016, 4:28 p.m. UTC | #1
Hi Ilya,

> This patch fixes gcc.target/i386/chkp-hidden-def.c test failure
> on Solaris.  Failure happens because some Solaris emit code
> ignores transparent alias chains for assembler names.  The patch
> was tested and approved by Rainer Orth (see [1] for more details).
> Applied to trunk.
>
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69917

I've now backported the patch to the gcc-5 branch after testing on
i386-pc-solaris2.1[0-2] and sparc-sun-solaris2.1[0-2].

Thanks.
        Rainer
diff mbox

Patch

diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index e56e554..368c2d2 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -137,8 +137,9 @@  along with GCC; see the file COPYING3.  If not see
 /* The Solaris assembler wants a .local for non-exported aliases.  */
 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)	\
   do {							\
-    const char *declname =				\
-      IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));	\
+    tree id = DECL_ASSEMBLER_NAME (DECL);		\
+    ultimate_transparent_alias_target (&id);		\
+    const char *declname = IDENTIFIER_POINTER (id);	\
     ASM_OUTPUT_DEF ((FILE), declname,			\
 		    IDENTIFIER_POINTER (TARGET));	\
     if (! TREE_PUBLIC (DECL))				\
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c
index 560a07b..47b41fd 100644
--- a/gcc/config/sol2.c
+++ b/gcc/config/sol2.c
@@ -142,8 +142,11 @@  solaris_assemble_visibility (tree decl, int vis ATTRIBUTE_UNUSED)
   };
 
   const char *name, *type;
+  tree id = DECL_ASSEMBLER_NAME (decl);
 
-  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  while (IDENTIFIER_TRANSPARENT_ALIAS (id))
+    id = TREE_CHAIN (id);
+  name = IDENTIFIER_POINTER (id);
   type = visibility_types[vis];
 
   fprintf (asm_out_file, "\t.%s\t", type);