public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make target_clones resolver fn static.
@ 2020-01-17 11:09 Martin Liška
  2020-01-20 10:34 ` Richard Biener
  0 siblings, 1 reply; 23+ messages in thread
From: Martin Liška @ 2020-01-17 11:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: Alexander Monakov

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

Hi.

The patch removes need to have a gnu_indirect_function global
symbol. That aligns the code with what ppc64 target does.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2020-01-17  Martin Liska  <mliska@suse.cz>

	PR target/93274
	* config/i386/i386-features.c (make_resolver_func):
	Align the code with ppc64 target implementaion.
	We do not need to have gnu_indirect_function
	as a global function.

gcc/testsuite/ChangeLog:

2020-01-17  Martin Liska  <mliska@suse.cz>

	PR target/93274
	* gcc.target/i386/pr81213.c: Adjust to not expect
	a global unique name.
---
  gcc/config/i386/i386-features.c         | 20 +++++---------------
  gcc/testsuite/gcc.target/i386/pr81213.c |  4 ++--
  2 files changed, 7 insertions(+), 17 deletions(-)



[-- Attachment #2: 0001-Make-target_clones-resolver-fn-static.patch --]
[-- Type: text/x-patch, Size: 2254 bytes --]

diff --git a/gcc/config/i386/i386-features.c b/gcc/config/i386/i386-features.c
index e580b26b995..2517123b581 100644
--- a/gcc/config/i386/i386-features.c
+++ b/gcc/config/i386/i386-features.c
@@ -2738,26 +2738,17 @@ 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);
+  /* Make the resolver function static.  The resolver function returns
+     void *.  */
+  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 +2800,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" } } */


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-03-26  9:49 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 11:09 [PATCH] Make target_clones resolver fn static Martin Liška
2020-01-20 10:34 ` Richard Biener
2020-01-20 13:40   ` H.J. Lu
2020-01-20 13:48     ` Alexander Monakov
2020-01-20 13:49       ` H.J. Lu
2020-01-20 14:23         ` Alexander Monakov
2020-01-20 14:31           ` H.J. Lu
2020-01-20 14:54             ` Alexander Monakov
2020-01-20 14:55               ` H.J. Lu
2020-01-20 14:59                 ` Richard Biener
2020-01-21 13:29                   ` Martin Liška
2020-01-23 13:43                     ` Richard Biener
2020-01-23 13:53                       ` Martin Liška
2020-01-23 14:02                         ` Alexander Monakov
2020-01-27 10:59                           ` Martin Liška
2020-03-17 16:40                       ` [stage1] [PATCH] Make target_clones resolver fn static if possible Martin Liška
2020-03-23 15:09                         ` Martin Liška
2020-03-24 17:21                           ` Jeff Law
2020-03-26  9:23                           ` Jakub Jelinek
2020-03-26  9:46                             ` Martin Liška
2020-03-26  9:48                               ` Jakub Jelinek
2020-01-26 21:18                     ` [PATCH] Make target_clones resolver fn static Jeff Law
2020-01-27 11:05                       ` 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).