From 283b44f96adb3e369cb8ed166d6c45703738927b Mon Sep 17 00:00:00 2001 From: Ilya Enkovich Date: Wed, 4 Feb 2015 08:26:49 +0000 Subject: [PATCH] varasm.c (do_assemble_alias): Follow transparent alias chain for target. gcc/ * varasm.c (do_assemble_alias): Follow transparent alias chain for target. (default_assemble_visibility): Follow transparent alias chain for decl name. gcc/testsuite/ * gcc.target/i386/chkp-hidden-def.c: New. From-SVN: r220391 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/chkp-hidden-def.c | 15 +++++++++++++++ gcc/varasm.c | 9 ++++++--- 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/chkp-hidden-def.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44aa27f6cfd..e9ffbf9b6f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-02-04 Ilya Enkovich + + * varasm.c (do_assemble_alias): Follow transparent alias + chain for target. + (default_assemble_visibility): Follow transparent alias + chain for decl name. + 2015-02-04 Thomas Preud'homme PR middle-end/62103 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 03585db3754..ac316fd931b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-02-04 Ilya Enkovich + + * gcc.target/i386/chkp-hidden-def.c: New. + 2015-02-04 Thomas Preud'homme PR middle-end/62103 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 00000000000..8d2b2288db2 --- /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 2069432ad9a..eb65b1ff669 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); -- 2.30.2