Blender V4.3
libc_compat.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5/* On Linux, precompiled libraries may be made with an glibc version that is
6 * incompatible with the system libraries that Blender is built on. To solve
7 * this we add a few -ffast-math symbols that can be missing. */
8
13#ifdef __linux__
14# include <features.h>
15# include <math.h>
16# include <stdlib.h>
17
18# if defined(__GLIBC_PREREQ)
19# if __GLIBC_PREREQ(2, 31)
20
21double __exp_finite(double x);
22double __exp2_finite(double x);
23double __acos_finite(double x);
24double __asin_finite(double x);
25double __log2_finite(double x);
26double __log10_finite(double x);
27double __log_finite(double x);
28double __pow_finite(double x, double y);
29double __atan2_finite(double x, double y);
30float __expf_finite(float x);
31float __exp2f_finite(float x);
32float __acosf_finite(float x);
33float __asinf_finite(float x);
34float __log2f_finite(float x);
35float __log10f_finite(float x);
36float __logf_finite(float x);
37float __powf_finite(float x, float y);
38float __atan2f_finite(float x, float y);
39
40double __exp_finite(double x)
41{
42 return exp(x);
43}
44
45double __exp2_finite(double x)
46{
47 return exp2(x);
48}
49
50double __acos_finite(double x)
51{
52 return acos(x);
53}
54
55double __asin_finite(double x)
56{
57 return asin(x);
58}
59
60double __log2_finite(double x)
61{
62 return log2(x);
63}
64
65double __log10_finite(double x)
66{
67 return log10(x);
68}
69
70double __log_finite(double x)
71{
72 return log(x);
73}
74
75double __pow_finite(double x, double y)
76{
77 return pow(x, y);
78}
79
80double __atan2_finite(double x, double y)
81{
82 return atan2(x, y);
83}
84
85float __expf_finite(float x)
86{
87 return expf(x);
88}
89
90float __exp2f_finite(float x)
91{
92 return exp2f(x);
93}
94
95float __acosf_finite(float x)
96{
97 return acosf(x);
98}
99
100float __asinf_finite(float x)
101{
102 return asinf(x);
103}
104
105float __log2f_finite(float x)
106{
107 return log2f(x);
108}
109
110float __log10f_finite(float x)
111{
112 return log10f(x);
113}
114
115float __logf_finite(float x)
116{
117 return logf(x);
118}
119
120float __powf_finite(float x, float y)
121{
122 return powf(x, y);
123}
124
125float __atan2f_finite(float x, float y)
126{
127 return atan2f(x, y);
128}
129
130# endif /* __GLIBC_PREREQ(2, 31) */
131
132# if __GLIBC_PREREQ(2, 34) && defined(WITH_LIBC_MALLOC_HOOK_WORKAROUND)
133
134extern void *(*__malloc_hook)(size_t __size, const void *);
135extern void *(*__realloc_hook)(void *__ptr, size_t __size, const void *);
136extern void *(*__memalign_hook)(size_t __alignment, size_t __size, const void *);
137extern void (*__free_hook)(void *__ptr, const void *);
138
139void *(*__malloc_hook)(size_t __size, const void *) = NULL;
140void *(*__realloc_hook)(void *__ptr, size_t __size, const void *) = NULL;
141void *(*__memalign_hook)(size_t __alignment, size_t __size, const void *) = NULL;
142void (*__free_hook)(void *__ptr, const void *) = NULL;
143
144# endif /* __GLIBC_PREREQ(2, 34) */
145
146# endif /* __GLIBC_PREREQ */
147#endif /* __linux__ */
pow(value.r - subtrahend, 2.0)") .do_static_compilation(true)
#define logf(x)
#define expf(x)
#define powf(x, y)
#define atan2f(x, y)
#define NULL
#define asinf(x)
#define acosf(x)
ccl_device_inline float3 exp(float3 v)
ccl_device_inline float3 log(float3 v)
T acos(const T &a)
T atan2(const T &y, const T &x)
T asin(const T &a)