On 1/23/20 2:52 PM, Alexander Monakov wrote:
On Thu, 23 Jan 2020, Martin Liška wrote:
So this doesn't help review including two different target changes. Making
ifunc dispatchers of public functions non-public looks like an unrelated
thing
to the bug (sorry if I mis-suggested). So I feel comfortable approving the
earlier patch which just dropped the extra mangling for non-public
dispatchers
in the x86 backend.
Works for me.
If you will be revising the patch, can you please improve the new comment?
I mean this addition:
/* Make the resolver function static.
... */
but it's not what the following code does.
Sure, there's original version of the patch with modified comment.
I'm going to install it.
Martin
Thanks.
Alexander
>From 256ba0077dd91f70117c8c65f9ffd206ea98b2c4 Mon Sep 17 00:00:00 2001
From: Martin Liska <mli...@suse.cz>
Date: Thu, 16 Jan 2020 10:38:41 +0100
Subject: [PATCH] Do not generate a unique fnname for resolver.
gcc/ChangeLog:
2020-01-17 Martin Liska <mli...@suse.cz>
PR target/93274
* config/i386/i386-features.c (make_resolver_func):
Align the code with ppc64 target implementation.
Do not generate a unique name for resolver function.
gcc/testsuite/ChangeLog:
2020-01-17 Martin Liska <mli...@suse.cz>
PR target/93274
* gcc.target/i386/pr81213.c: Adjust to not expect
a globally unique name.
---
gcc/config/i386/i386-features.c | 19 ++++---------------
gcc/testsuite/gcc.target/i386/pr81213.c | 4 ++--
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c
index e580b26b995..b49e6f8d408 100644
--- a/gcc/config/i386/i386-features.c
+++ b/gcc/config/i386/i386-features.c
@@ -2738,26 +2738,16 @@ make_resolver_func (const tree default_decl,
const tree ifunc_alias_decl,
basic_block *empty_bb)
{
- char *resolver_name;
- tree decl, type, decl_name, t;
+ tree decl, type, t;
- /* IFUNC's have to be globally visible. So, if the default_decl is
- not, then the name of the IFUNC should be made unique. */
- if (TREE_PUBLIC (default_decl) == 0)
- {
- char *ifunc_name = make_unique_name (default_decl, "ifunc", true);
- symtab->change_decl_assembler_name (ifunc_alias_decl,
- get_identifier (ifunc_name));
- XDELETEVEC (ifunc_name);
- }
-
- resolver_name = make_unique_name (default_decl, "resolver", false);
+ /* Create resolver function name based on default_decl. */
+ tree decl_name = clone_function_name (default_decl, "resolver");
+ const char *resolver_name = IDENTIFIER_POINTER (decl_name);
/* The resolver function should return a (void *). */
type = build_function_type_list (ptr_type_node, NULL_TREE);
decl = build_fn_decl (resolver_name, type);
- decl_name = get_identifier (resolver_name);
SET_DECL_ASSEMBLER_NAME (decl, decl_name);
DECL_NAME (decl) = decl_name;
@@ -2809,7 +2799,6 @@ make_resolver_func (const tree default_decl,
/* Create the alias for dispatch to resolver here. */
cgraph_node::create_same_body_alias (ifunc_alias_decl, decl);
- XDELETEVEC (resolver_name);
return decl;
}
diff --git a/gcc/testsuite/gcc.target/i386/pr81213.c b/gcc/testsuite/gcc.target/i386/pr81213.c
index 13e15d5fef0..89c47529861 100644
--- a/gcc/testsuite/gcc.target/i386/pr81213.c
+++ b/gcc/testsuite/gcc.target/i386/pr81213.c
@@ -14,6 +14,6 @@ int main()
return foo();
}
-/* { dg-final { scan-assembler "\t.globl\tfoo\\..*\\.ifunc" } } */
+/* { dg-final { scan-assembler "\t.globl\tfoo" } } */
/* { dg-final { scan-assembler "foo.resolver:" } } */
-/* { dg-final { scan-assembler "foo\\..*\\.ifunc, @gnu_indirect_function" } } */
+/* { dg-final { scan-assembler "foo\\, @gnu_indirect_function" } } */
--
2.25.0