Unfortunately, we cannot remove these 4 headers as they are included relative to the source files in libc/internal (like floatscan.c) which cannot be replaced with the musl copies for now for all kinds of reasons.
So for now, we are replacing these files with the symlinks to musl/src/internal copies which will save us time when upgrading musl. Hopefully, once we upgrade musl we might be able to get away from having many of the *.c files in libc/internal and delete the symlinks altogether as well. Signed-off-by: Waldemar Kozaczuk <[email protected]> --- libc/internal/floatscan.h | 9 +-- libc/internal/intscan.h | 9 +-- libc/internal/longdbl.h | 138 +------------------------------------- libc/stdio/shgetc.h | 10 +-- 4 files changed, 4 insertions(+), 162 deletions(-) mode change 100644 => 120000 libc/internal/floatscan.h mode change 100644 => 120000 libc/internal/intscan.h mode change 100644 => 120000 libc/internal/longdbl.h mode change 100644 => 120000 libc/stdio/shgetc.h diff --git a/libc/internal/floatscan.h b/libc/internal/floatscan.h deleted file mode 100644 index e027fa08..00000000 --- a/libc/internal/floatscan.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FLOATSCAN_H -#define FLOATSCAN_H - -#include <stdio.h> - -long double __floatscan(FILE *, int, int); - -#endif diff --git a/libc/internal/floatscan.h b/libc/internal/floatscan.h new file mode 120000 index 00000000..4483b11d --- /dev/null +++ b/libc/internal/floatscan.h @@ -0,0 +1 @@ +../../musl/src/internal/floatscan.h \ No newline at end of file diff --git a/libc/internal/intscan.h b/libc/internal/intscan.h deleted file mode 100644 index 994c5e7d..00000000 --- a/libc/internal/intscan.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef INTSCAN_H -#define INTSCAN_H - -#include <stdio.h> - -unsigned long long __intscan(FILE *, unsigned, int, unsigned long long); - -#endif diff --git a/libc/internal/intscan.h b/libc/internal/intscan.h new file mode 120000 index 00000000..a7c2fd43 --- /dev/null +++ b/libc/internal/intscan.h @@ -0,0 +1 @@ +../../musl/src/internal/intscan.h \ No newline at end of file diff --git a/libc/internal/longdbl.h b/libc/internal/longdbl.h deleted file mode 100644 index 25ec8021..00000000 --- a/libc/internal/longdbl.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef _LDHACK_H -#define _LDHACK_H - -#include <float.h> -#include <stdint.h> - -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -union ldshape { - long double value; - struct { - uint64_t m; - uint16_t exp:15; - uint16_t sign:1; - uint16_t pad; - } bits; -}; -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -union ldshape { - long double value; - struct { - uint64_t mlo; - uint64_t mhi:48; - uint16_t exp:15; - uint16_t sign:1; - } bits; -}; -#else -#error Unsupported long double representation -#endif - - -// FIXME: hacks to make freebsd+openbsd long double code happy - -// union and macros for freebsd - -#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 - -union IEEEl2bits { - long double e; - struct { - uint32_t manl:32; - uint32_t manh:32; - uint32_t exp:15; - uint32_t sign:1; - uint32_t pad:16; - } bits; - struct { - uint64_t man:64; - uint32_t expsign:16; - uint32_t pad:16; - } xbits; -}; - -#define LDBL_MANL_SIZE 32 -#define LDBL_MANH_SIZE 32 -#define LDBL_NBIT (1ull << LDBL_MANH_SIZE-1) -#undef LDBL_IMPLICIT_NBIT -#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT) - -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -/* -// ld128 float.h -//#define LDBL_MAX 1.189731495357231765085759326628007016E+4932L -#define LDBL_MAX 0x1.ffffffffffffffffffffffffffffp+16383 -#define LDBL_MAX_EXP 16384 -#define LDBL_HAS_INFINITY 1 -//#define LDBL_MIN 3.362103143112093506262677817321752603E-4932L -#define LDBL_MIN 0x1p-16382 -#define LDBL_HAS_QUIET_NAN 1 -#define LDBL_HAS_DENORM 1 -//#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L -#define LDBL_EPSILON 0x1p-112 -#define LDBL_MANT_DIG 113 -#define LDBL_MIN_EXP (-16381) -#define LDBL_MAX_10_EXP 4932 -#define LDBL_DENORM_MIN 0x0.0000000000000000000000000001p-16381 -#define LDBL_MIN_10_EXP (-4931) -#define LDBL_DIG 33 -*/ - -union IEEEl2bits { - long double e; - struct { - uint64_t manl:64; - uint64_t manh:48; - uint32_t exp:15; - uint32_t sign:1; - } bits; - struct { - uint64_t unused0:64; - uint64_t unused1:48; - uint32_t expsign:16; - } xbits; -}; - -#define LDBL_MANL_SIZE 64 -#define LDBL_MANH_SIZE 48 -#define LDBL_NBIT (1ull << LDBL_MANH_SIZE) -#define LDBL_IMPLICIT_NBIT 1 -#define mask_nbit_l(u) - -#endif - - -// macros for openbsd - -#define GET_LDOUBLE_WORDS(se,mh,ml, f) do{ \ - union IEEEl2bits u; \ - u.e = (f); \ - (se) = u.xbits.expsign; \ - (mh) = u.bits.manh; \ - (ml) = u.bits.manl; \ -}while(0) - -#define SET_LDOUBLE_WORDS(f, se,mh,ml) do{ \ - union IEEEl2bits u; \ - u.xbits.expsign = (se); \ - u.bits.manh = (mh); \ - u.bits.manl = (ml); \ - (f) = u.e; \ -}while(0) - -#define GET_LDOUBLE_EXP(se, f) do{ \ - union IEEEl2bits u; \ - u.e = (f); \ - (se) = u.xbits.expsign; \ -}while(0) - -#define SET_LDOUBLE_EXP(f, se) do{ \ - union IEEEl2bits u; \ - u.e = (f); \ - u.xbits.expsign = (se); \ - (f) = u.e; \ -}while(0) - -#endif diff --git a/libc/internal/longdbl.h b/libc/internal/longdbl.h new file mode 120000 index 00000000..e0b13912 --- /dev/null +++ b/libc/internal/longdbl.h @@ -0,0 +1 @@ +../../musl/src/internal/longdbl.h \ No newline at end of file diff --git a/libc/stdio/shgetc.h b/libc/stdio/shgetc.h deleted file mode 100644 index 7beb8ce6..00000000 --- a/libc/stdio/shgetc.h +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdio_impl.h" - -void __shlim(FILE *, off_t); -int __shgetc(FILE *); - -#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->rend)) -#define shlim(f, lim) __shlim((f), (lim)) -#define shgetc(f) (((f)->rpos < (f)->shend) ? *(f)->rpos++ : __shgetc(f)) -#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0) diff --git a/libc/stdio/shgetc.h b/libc/stdio/shgetc.h new file mode 120000 index 00000000..8be871a4 --- /dev/null +++ b/libc/stdio/shgetc.h @@ -0,0 +1 @@ +../../musl/src/internal/shgetc.h \ No newline at end of file -- 2.26.2 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/20200815041911.50765-1-jwkozaczuk%40gmail.com.
