logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 39ec6c68a17deb54c42538fbad72b9b4026ffab4
parent f0287a18d3b8048553773eda7986b2514c68e9e8
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 30 Sep 2021 22:25:09 -0700

musl: Avoid long double inline functions in math.h

Diffstat:

Mpkg/musl/base.lua5+++++
Apkg/musl/patch/0001-avoid-inline-functions-involving-long-double-in-math.patch112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dpkg/musl/patch/0001-use-_Generic-selection-for-type-generic-math-macros.patch99-------------------------------------------------------------------------------
Mpkg/musl/ver2+-
4 files changed, 118 insertions(+), 100 deletions(-)

diff --git a/pkg/musl/base.lua b/pkg/musl/base.lua @@ -322,6 +322,11 @@ return { 'src/math/__fpclassifyf.c', 'src/math/__fpclassifyl.c', 'src/math/__invtrigl.c', + 'src/math/__isgreaterequall.c', + 'src/math/__isgreaterl.c', + 'src/math/__islessequall.c', + 'src/math/__islessgreaterl.c', + 'src/math/__islessl.c', 'src/math/__math_divzero.c', 'src/math/__math_divzerof.c', 'src/math/__math_invalid.c', diff --git a/pkg/musl/patch/0001-avoid-inline-functions-involving-long-double-in-math.patch b/pkg/musl/patch/0001-avoid-inline-functions-involving-long-double-in-math.patch @@ -0,0 +1,112 @@ +From 9b972aaf435f15ce82b9f3dc006877d6cdd04592 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 30 Sep 2021 22:21:25 -0700 +Subject: [PATCH] avoid inline functions involving long double in math.h + +--- + include/math.h | 11 ++++++----- + src/math/__isgreaterequall.c | 6 ++++++ + src/math/__isgreaterl.c | 6 ++++++ + src/math/__islessequall.c | 6 ++++++ + src/math/__islessgreaterl.c | 6 ++++++ + src/math/__islessl.c | 6 ++++++ + 6 files changed, 36 insertions(+), 5 deletions(-) + create mode 100644 src/math/__isgreaterequall.c + create mode 100644 src/math/__isgreaterl.c + create mode 100644 src/math/__islessequall.c + create mode 100644 src/math/__islessgreaterl.c + create mode 100644 src/math/__islessl.c + +diff --git a/include/math.h b/include/math.h +index 14f28ec8..0286fba4 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -107,19 +107,20 @@ static __inline int __is##rel(type __x, type __y) \ + + __ISREL_DEF(lessf, <, float_t) + __ISREL_DEF(less, <, double_t) +-__ISREL_DEF(lessl, <, long double) + __ISREL_DEF(lessequalf, <=, float_t) + __ISREL_DEF(lessequal, <=, double_t) +-__ISREL_DEF(lessequall, <=, long double) + __ISREL_DEF(lessgreaterf, !=, float_t) + __ISREL_DEF(lessgreater, !=, double_t) +-__ISREL_DEF(lessgreaterl, !=, long double) + __ISREL_DEF(greaterf, >, float_t) + __ISREL_DEF(greater, >, double_t) +-__ISREL_DEF(greaterl, >, long double) + __ISREL_DEF(greaterequalf, >=, float_t) + __ISREL_DEF(greaterequal, >=, double_t) +-__ISREL_DEF(greaterequall, >=, long double) ++ ++int __islessl(long double, long double); ++int __islessequall(long double, long double); ++int __islessgreaterl(long double, long double); ++int __isgreaterl(long double, long double); ++int __isgreaterequall(long double, long double); + + #define __tg_pred_2(x, y, p) ( \ + sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \ +diff --git a/src/math/__isgreaterequall.c b/src/math/__isgreaterequall.c +new file mode 100644 +index 00000000..2d014213 +--- /dev/null ++++ b/src/math/__isgreaterequall.c +@@ -0,0 +1,6 @@ ++#include <math.h> ++ ++int __isgreaterequall(long double x, long double y) ++{ ++ return !isunordered(x, y) && x >= y; ++} +diff --git a/src/math/__isgreaterl.c b/src/math/__isgreaterl.c +new file mode 100644 +index 00000000..835fe575 +--- /dev/null ++++ b/src/math/__isgreaterl.c +@@ -0,0 +1,6 @@ ++#include <math.h> ++ ++int __isgreaterl(long double x, long double y) ++{ ++ return !isunordered(x, y) && x > y; ++} +diff --git a/src/math/__islessequall.c b/src/math/__islessequall.c +new file mode 100644 +index 00000000..3534ab5b +--- /dev/null ++++ b/src/math/__islessequall.c +@@ -0,0 +1,6 @@ ++#include <math.h> ++ ++int __islessequall(long double x, long double y) ++{ ++ return !isunordered(x, y) && x <= y; ++} +diff --git a/src/math/__islessgreaterl.c b/src/math/__islessgreaterl.c +new file mode 100644 +index 00000000..e8543384 +--- /dev/null ++++ b/src/math/__islessgreaterl.c +@@ -0,0 +1,6 @@ ++#include <math.h> ++ ++int __islessgreaterl(long double x, long double y) ++{ ++ return !isunordered(x, y) && x != y; ++} +diff --git a/src/math/__islessl.c b/src/math/__islessl.c +new file mode 100644 +index 00000000..27b48d0e +--- /dev/null ++++ b/src/math/__islessl.c +@@ -0,0 +1,6 @@ ++#include <math.h> ++ ++int __islessl(long double x, long double y) ++{ ++ return !isunordered(x, y) && x < y; ++} +-- +2.32.0 + diff --git a/pkg/musl/patch/0001-use-_Generic-selection-for-type-generic-math-macros.patch b/pkg/musl/patch/0001-use-_Generic-selection-for-type-generic-math-macros.patch @@ -1,99 +0,0 @@ -From 5db27a0021348fa0520b958d5361884046a53fa9 Mon Sep 17 00:00:00 2001 -From: Michael Forney <mforney@mforney.org> -Date: Sat, 23 Jan 2021 19:59:55 -0800 -Subject: [PATCH] use _Generic selection for type-generic math macros - ---- - include/math.h | 64 +++++++++++++++++++++++++------------------------- - 1 file changed, 32 insertions(+), 32 deletions(-) - -diff --git a/include/math.h b/include/math.h -index 14f28ec8..8f18254c 100644 ---- a/include/math.h -+++ b/include/math.h -@@ -65,39 +65,39 @@ static __inline unsigned long long __DOUBLE_BITS(double __f) - return __u.__i; - } - --#define fpclassify(x) ( \ -- sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ -- sizeof(x) == sizeof(double) ? __fpclassify(x) : \ -- __fpclassifyl(x) ) -- --#define isinf(x) ( \ -- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \ -- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \ -- __fpclassifyl(x) == FP_INFINITE) -- --#define isnan(x) ( \ -- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \ -- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \ -- __fpclassifyl(x) == FP_NAN) -- --#define isnormal(x) ( \ -- sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \ -- sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \ -- __fpclassifyl(x) == FP_NORMAL) -- --#define isfinite(x) ( \ -- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \ -- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \ -- __fpclassifyl(x) > FP_INFINITE) -+#define fpclassify(x) _Generic((x), \ -+ float: __fpclassifyf(x), \ -+ double: __fpclassify(x), \ -+ long double: __fpclassifyl(x)) -+ -+#define isinf(x) _Generic((x), \ -+ float: (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000, \ -+ double: (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52, \ -+ long double: __fpclassifyl(x) == FP_INFINITE) -+ -+#define isnan(x) _Generic((x), \ -+ float: (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000, \ -+ double: (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52, \ -+ long double: __fpclassifyl(x) == FP_NAN) -+ -+#define isnormal(x) _Generic((x), \ -+ float: ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000, \ -+ double: ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53, \ -+ long double: __fpclassifyl(x) == FP_NORMAL) -+ -+#define isfinite(x) _Generic((x), \ -+ float: (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000, \ -+ double: (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52, \ -+ long double: __fpclassifyl(x) > FP_INFINITE) - - int __signbit(double); - int __signbitf(float); - int __signbitl(long double); - --#define signbit(x) ( \ -- sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \ -- sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \ -- __signbitl(x) ) -+#define signbit(x) _Generic((x), \ -+ float: (int)(__FLOAT_BITS(x)>>31), \ -+ double: (int)(__DOUBLE_BITS(x)>>63), \ -+ long double: __signbitl(x)) - - #define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y))) - -@@ -121,10 +121,10 @@ __ISREL_DEF(greaterequalf, >=, float_t) - __ISREL_DEF(greaterequal, >=, double_t) - __ISREL_DEF(greaterequall, >=, long double) - --#define __tg_pred_2(x, y, p) ( \ -- sizeof((x)+(y)) == sizeof(float) ? p##f(x, y) : \ -- sizeof((x)+(y)) == sizeof(double) ? p(x, y) : \ -- p##l(x, y) ) -+#define __tg_pred_2(x, y, p) _Generic((x)+(y), \ -+ float: p##f(x, y), \ -+ double: p(x, y), \ -+ long double: p##l(x, y)) - - #define isless(x, y) __tg_pred_2(x, y, __isless) - #define islessequal(x, y) __tg_pred_2(x, y, __islessequal) --- -2.30.0 - diff --git a/pkg/musl/ver b/pkg/musl/ver @@ -1 +1 @@ -1.2.2 r3 +1.2.2 r4