public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3213] Darwin: Fixes for darwin_libc_has_function.
@ 2021-08-29 19:58 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2021-08-29 19:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c3c669ac811429033c0151f910b38fc009e21ca8

commit r12-3213-gc3c669ac811429033c0151f910b38fc009e21ca8
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Aug 27 19:49:05 2021 +0100

    Darwin: Fixes for darwin_libc_has_function.
    
    Firstly, the checks for availability need not be run for any
    currently supported Darwin version (or for any version of
    Darwin on x86).  In fact, the only test that is needed that
    differs from the default is for the availbaility of sincos.
    Test that and then fall back to the default implementation.
    
    Secondly, the funtion appears to be called from the Jit library
    before the value of darwin_macosx_version_min has been set up -
    at present we work around this by guarding the checks on having
    a non-null pointer for darwin_macosx_version_min.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    gcc/ChangeLog:
    
            * config/darwin.c (darwin_libc_has_function): Do not run
            the checks for x86 or modern Darwin.  Make sure that there
            is a value set for darwin_macosx_version_min before testing.

Diff:
---
 gcc/config/darwin.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 667fda79a60..781742fe46f 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "explow.h"
 #include "expr.h"
 #include "langhooks.h"
+#include "targhooks.h"
 #include "toplev.h"
 #include "lto-section-names.h"
 #include "intl.h"
@@ -3661,19 +3662,22 @@ darwin_rename_builtins (void)
     }
 }
 
+/* Implementation for the TARGET_LIBC_HAS_FUNCTION hook.  */
+
 bool
 darwin_libc_has_function (enum function_class fn_class,
 			  tree type ATTRIBUTE_UNUSED)
 {
-  if (fn_class == function_sincos)
+  if (fn_class == function_sincos && darwin_macosx_version_min)
     return (strverscmp (darwin_macosx_version_min, "10.9") >= 0);
-
+#if DARWIN_PPC && SUPPORT_DARWIN_LEGACY
   if (fn_class == function_c99_math_complex
       || fn_class == function_c99_misc)
     return (TARGET_64BIT
-	    || strverscmp (darwin_macosx_version_min, "10.3") >= 0);
-
-  return true;
+	    || (darwin_macosx_version_min &&
+		strverscmp (darwin_macosx_version_min, "10.3") >= 0));
+#endif
+  return default_libc_has_function (fn_class, type);
 }
 
 hashval_t


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-29 19:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29 19:58 [gcc r12-3213] Darwin: Fixes for darwin_libc_has_function Iain D Sandoe

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).