[gtk/cherry-pick-3c9c7a0e] build: Make sure ifuncs exist when using fp16




commit 2a4b90a81c207576f5dacf0bc19385d3e1a80a39
Author: Benjamin Otte <otte redhat com>
Date:   Fri Oct 22 16:31:40 2021 +0200

    build: Make sure ifuncs exist when using fp16
    
    Fixes msys compiles on Windows (and everywhere else hopefully).
    
    Fixes #4285
    
    
    (cherry picked from commit 3c9c7a0e727eb6380bee29120736dba6da2232a3)

 meson.build | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/meson.build b/meson.build
index a136768caf..2646a97d2e 100644
--- a/meson.build
+++ b/meson.build
@@ -693,12 +693,24 @@ if get_option('f16c').enabled()
 # if !defined(__amd64__) && !defined(__x86_64__)
 #   error "F16C intrinsics are only available on x86_64"
 # endif
+#if !defined __has_attribute
+# error "No __has_attribute() support"
+#endif
+#if !__has_attribute(ifunc)
+# error "ifunc not supported"
+#endif
+static int resolved_ifunc (void) { return 0; }
+static void *resolve_ifunc (void) { return resolved_ifunc; }
+int ifunc_test (void) __attribute__((ifunc ("resolve_ifunc")));
+#else
+int ifunc_test (void) { return 0; }
 #endif
 #if defined(__SSE__) || defined(_MSC_VER)
 # include <immintrin.h>
 #else
 # error "No F16C intrinsics available"
 #endif
+
 int main () {
   float f[4] = { 0, };
   unsigned short h[4] = { 0, };
@@ -711,7 +723,7 @@ int main () {
   __builtin_cpu_supports ("f16c");
 #endif
 
-    return 0;
+    return ifunc_test ();
 }'''
   if cc.get_id() != 'msvc'
     test_f16c_cflags = [ '-mf16c' ]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]