Hi,

This patch fixes two more cases where alias chain should be followed to emit 
correct assembler name for instrumented functions.  Bootstrapped and tested on 
x86_64-unknown-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2015-01-30  Ilya Enkovich  <ilya.enkov...@intel.com>

        * varasm.c (do_assemble_alias): Follow transparent alias
        chain for target.
        (default_assemble_visibility): Follow transparent alias
        chain for decl name.

gcc/testsuite/

2015-01-30  Ilya Enkovich  <ilya.enkov...@intel.com>

        * gcc.target/i386/chkp-hidden-def.c: New.


diff --git a/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c 
b/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c
new file mode 100644
index 0000000..8d2b228
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target mpx } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */
+/* { dg-final { scan-assembler-not "test.chkp" } } */
+
+int test (int *p);
+extern __typeof (test) test  __asm__ ("" "__test") __attribute__ ((visibility 
("hidden")));
+
+int test (int *p)
+{
+  return *p;
+}
+
+extern __typeof (test) __test1 __asm__("" "test");
+extern __typeof (test) __test1 __attribute__((alias ("" "__test")));
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 2069432..eb65b1f 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5601,6 +5601,7 @@ do_assemble_alias (tree decl, tree target)
 
   id = DECL_ASSEMBLER_NAME (decl);
   ultimate_transparent_alias_target (&id);
+  ultimate_transparent_alias_target (&target);
 
   /* We must force creation of DECL_RTL for debug info generation, even though
      we don't use it here.  */
@@ -5612,8 +5613,6 @@ do_assemble_alias (tree decl, tree target)
 
   if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
     {
-      ultimate_transparent_alias_target (&target);
-
       if (!TREE_SYMBOL_REFERENCED (target))
        weakref_targets = tree_cons (decl, target, weakref_targets);
 
@@ -5944,8 +5943,12 @@ default_assemble_visibility (tree decl ATTRIBUTE_UNUSED,
   };
 
   const char *name, *type;
+  tree id;
+
+  id = DECL_ASSEMBLER_NAME (decl);
+  ultimate_transparent_alias_target (&id);
+  name = IDENTIFIER_POINTER (id);
 
-  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
   type = visibility_types[vis];
 
   fprintf (asm_out_file, "\t.%s\t", type);

Reply via email to