From: Martin Liska Date: Fri, 16 Mar 2018 14:53:45 +0000 (+0100) Subject: Redirect reference in the symbol table (PR ipa/84833). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5aabfc9a629a7c323f59c9f19dd78519f2803ef;p=gcc.git Redirect reference in the symbol table (PR ipa/84833). 2018-03-16 Martin Liska PR ipa/84833 * multiple_target.c (create_dispatcher_calls): Redirect reference in the symbol table. 2018-03-16 Martin Liska PR ipa/84833 * gcc.target/i386/mvc11.c: New test. From-SVN: r258596 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96b45d4d2f7..78f492b728c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-16 Martin Liska + + PR ipa/84833 + * multiple_target.c (create_dispatcher_calls): Redirect + reference in the symbol table. + 2018-03-16 Martin Liska PR ipa/84722 diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index 95297f3cd30..b006a5ab6ec 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -144,6 +144,10 @@ create_dispatcher_calls (struct cgraph_node *node) if (ref->referring->decl != resolver_decl) walk_gimple_stmt (&it, NULL, replace_function_decl, &wi); } + + symtab_node *source = ref->referring; + ref->remove_reference (); + source->create_reference (inode, IPA_REF_ADDR); } else if (ref->use == IPA_REF_ALIAS) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d4fbd1b94e5..e3795cdc8f0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-16 Martin Liska + + PR ipa/84833 + * gcc.target/i386/mvc11.c: New test. + 2018-03-16 Martin Liska PR ipa/84722 diff --git a/gcc/testsuite/gcc.target/i386/mvc11.c b/gcc/testsuite/gcc.target/i386/mvc11.c new file mode 100644 index 00000000000..5bd10f4651d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mvc11.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-std=gnu99" } */ + +__attribute__((noipa)) int +baz (int (*fn) (void)) +{ + asm volatile ("" : "+g" (fn) : : "memory"); + return fn (); +} + +__attribute__((target_clones("arch=sandybridge", "default"))) static int +bar (void) +{ + return 1; +} + +__attribute__((target_clones("arch=sandybridge", "default"))) int +foo (void) +{ + baz (bar) - 1; +} + +int +main () +{ + foo (); +}