Fix fp16 with asan
authorMatthias Clasen <mclasen@redhat.com>
Tue, 27 Jun 2023 19:16:12 +0000 (15:16 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 27 Jun 2023 19:17:56 +0000 (15:17 -0400)
The IFUNC resolvers that we are using here get
run early, before asan had a chance to set up its
plumbing, and therefore things go badly if they
are compiled with asan. Turning it off makes things
work again.

The gcc bug tracking this problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110442

Thanks to Jakub Jelinek and Florian Weimer for
analyzing this and recommending the workaround.

gsk/gl/fp16.c

index 29e83527f342a1e03ab3db2a5e6eb1357bf41d23..0f767e93349b930b4ce76a46c05c2192e839f376 100644 (file)
@@ -165,7 +165,7 @@ void half_to_float4 (const guint16 h[4], float f[4]) __attribute__((ifunc ("reso
 void float_to_half (const float *f, guint16 *h, int n) __attribute__((ifunc ("resolve_float_to_half")));
 void half_to_float (const guint16 *h, float *f, int n) __attribute__((ifunc ("resolve_half_to_float")));
 
-static void *
+static void * __attribute__ ((no_sanitize_address))
 resolve_float_to_half4 (void)
 {
   __builtin_cpu_init ();
@@ -175,7 +175,7 @@ resolve_float_to_half4 (void)
     return float_to_half4_c;
 }
 
-static void *
+static void * __attribute__ ((no_sanitize_address))
 resolve_half_to_float4 (void)
 {
   __builtin_cpu_init ();
@@ -185,7 +185,7 @@ resolve_half_to_float4 (void)
     return half_to_float4_c;
 }
 
-static void *
+static void * __attribute__ ((no_sanitize_address))
 resolve_float_to_half (void)
 {
   __builtin_cpu_init ();
@@ -195,7 +195,7 @@ resolve_float_to_half (void)
     return float_to_half_c;
 }
 
-static void *
+static void * __attribute__ ((no_sanitize_address))
 resolve_half_to_float (void)
 {
   __builtin_cpu_init ();