[committed] hppa: Use targetm.binds_local_p to check local binding in pa_function_ok_for_sibcall

Message ID 5A64E86E.7080104@bell.net
State New
Headers show
Series
  • [committed] hppa: Use targetm.binds_local_p to check local binding in pa_function_ok_for_sibcall
Related show

Commit Message

John David Anglin Jan. 21, 2018, 7:22 p.m.
The attached change fixes the failure of 
gcc.dg/plugin/must-tail-call-1.c on hppa-linux.  Using
targetm.binds_local_p is less restrictive than TREE_PUBLIC in 
determining what binds local.

Tested on hppa-unknown-linux-gnu.  Committed to trunk.

Dave

-- 
John David Anglin  dave.anglin@bell.net
2018-01-21  John David Anglin  <danglin@gcc.gnu.org>

	PR gcc/77734
	* config/pa/pa.c (pa_function_ok_for_sibcall): Use
	targetm.binds_local_p instead of TREE_PUBLIC to check local binding.
	Move TARGET_PORTABLE_RUNTIME check after TARGET_64BIT check.

Patch

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 256932)
+++ config/pa/pa.c	(working copy)
@@ -8655,9 +8655,6 @@ 
 static bool
 pa_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
 {
-  if (TARGET_PORTABLE_RUNTIME)
-    return false;
-
   /* Sibcalls are not ok because the arg pointer register is not a fixed
      register.  This prevents the sibcall optimization from occurring.  In
      addition, there are problems with stub placement using GNU ld.  This
@@ -8667,8 +8664,11 @@ 
   if (TARGET_64BIT)
     return false;
 
+  if (TARGET_PORTABLE_RUNTIME)
+    return false;
+
   /* Sibcalls are only ok within a translation unit.  */
-  return (decl && !TREE_PUBLIC (decl));
+  return decl && targetm.binds_local_p (decl);
 }
 
 /* ??? Addition is not commutative on the PA due to the weird implicit