* [PATCH] Redirect reference in the symbol table (PR ipa/84833).
@ 2018-03-13 13:35 Martin Liška
2018-03-16 14:50 ` Martin Liška
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2018-03-13 13:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Jan Hubicka, Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
Hi.
This fixed issue where we have an ifunc function called from another ifunc function.
One needs to properly make a reference redirection.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
MVC tests on x86_64 also work fine.
Ready for trunk?
Thanks,
Martin
gcc/ChangeLog:
2018-03-13 Martin Liska <mliska@suse.cz>
PR ipa/84833
* multiple_target.c (create_dispatcher_calls): Redirect
reference in the symbol table.
gcc/testsuite/ChangeLog:
2018-03-13 Martin Liska <mliska@suse.cz>
PR ipa/84833
* gcc.target/i386/mvc11.c: New test.
---
gcc/multiple_target.c | 4 ++++
gcc/testsuite/gcc.target/i386/mvc11.c | 28 ++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/mvc11.c
[-- Attachment #2: 0001-Redirect-reference-in-the-symbol-table-PR-ipa-84833.patch --]
[-- Type: text/x-patch, Size: 1200 bytes --]
diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c
index a6767985774..46cf7a30733 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
gcc_unreachable ();
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 ();
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Redirect reference in the symbol table (PR ipa/84833).
2018-03-13 13:35 [PATCH] Redirect reference in the symbol table (PR ipa/84833) Martin Liška
@ 2018-03-16 14:50 ` Martin Liška
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liška @ 2018-03-16 14:50 UTC (permalink / raw)
To: gcc-patches; +Cc: Jan Hubicka, Jakub Jelinek
On 03/13/2018 02:35 PM, Martin Liška wrote:
> Hi.
>
> This fixed issue where we have an ifunc function called from another ifunc function.
> One needs to properly make a reference redirection.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> MVC tests on x86_64 also work fine.
>
> Ready for trunk?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> 2018-03-13 Martin Liska <mliska@suse.cz>
>
> Â Â Â Â PR ipa/84833
> Â Â Â Â * multiple_target.c (create_dispatcher_calls): Redirect
> Â Â Â Â reference in the symbol table.
>
> gcc/testsuite/ChangeLog:
>
> 2018-03-13 Martin Liska <mliska@suse.cz>
>
> Â Â Â Â PR ipa/84833
> Â Â Â Â * gcc.target/i386/mvc11.c: New test.
> ---
>  gcc/multiple_target.c                | 4 ++++
> Â gcc/testsuite/gcc.target/i386/mvc11.c | 28 ++++++++++++++++++++++++++++
> Â 2 files changed, 32 insertions(+)
> Â create mode 100644 gcc/testsuite/gcc.target/i386/mvc11.c
>
>
Honza approved that offline.
Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-16 14:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 13:35 [PATCH] Redirect reference in the symbol table (PR ipa/84833) Martin Liška
2018-03-16 14:50 ` Martin Liška
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).