|
| 1 | +diff --git a/include/locale.h b/include/locale.h |
| 2 | +index ce384381..d0c26c9f 100644 |
| 3 | +--- a/include/locale.h |
| 4 | ++++ b/include/locale.h |
| 5 | +@@ -7,11 +7,13 @@ extern "C" { |
| 6 | + |
| 7 | + #include <features.h> |
| 8 | + |
| 9 | ++#ifndef NULL |
| 10 | + #ifdef __cplusplus |
| 11 | + #define NULL 0L |
| 12 | + #else |
| 13 | + #define NULL ((void*)0) |
| 14 | + #endif |
| 15 | ++#endif |
| 16 | + |
| 17 | + #define LC_CTYPE 0 |
| 18 | + #define LC_NUMERIC 1 |
| 19 | +diff --git a/include/math.h b/include/math.h |
| 20 | +index 14f28ec8..bcb19851 100644 |
| 21 | +--- a/include/math.h |
| 22 | ++++ b/include/math.h |
| 23 | +@@ -65,39 +65,18 @@ static __inline unsigned long long __DOUBLE_BITS(double __f) |
| 24 | + return __u.__i; |
| 25 | + } |
| 26 | + |
| 27 | +-#define fpclassify(x) ( \ |
| 28 | +- sizeof(x) == sizeof(float) ? __fpclassifyf(x) : \ |
| 29 | +- sizeof(x) == sizeof(double) ? __fpclassify(x) : \ |
| 30 | +- __fpclassifyl(x) ) |
| 31 | +- |
| 32 | +-#define isinf(x) ( \ |
| 33 | +- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000 : \ |
| 34 | +- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52 : \ |
| 35 | +- __fpclassifyl(x) == FP_INFINITE) |
| 36 | +- |
| 37 | +-#define isnan(x) ( \ |
| 38 | +- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000 : \ |
| 39 | +- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52 : \ |
| 40 | +- __fpclassifyl(x) == FP_NAN) |
| 41 | +- |
| 42 | +-#define isnormal(x) ( \ |
| 43 | +- sizeof(x) == sizeof(float) ? ((__FLOAT_BITS(x)+0x00800000) & 0x7fffffff) >= 0x01000000 : \ |
| 44 | +- sizeof(x) == sizeof(double) ? ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53 : \ |
| 45 | +- __fpclassifyl(x) == FP_NORMAL) |
| 46 | +- |
| 47 | +-#define isfinite(x) ( \ |
| 48 | +- sizeof(x) == sizeof(float) ? (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000 : \ |
| 49 | +- sizeof(x) == sizeof(double) ? (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52 : \ |
| 50 | +- __fpclassifyl(x) > FP_INFINITE) |
| 51 | ++int fpclassify(double); |
| 52 | ++ |
| 53 | ++int isfinite(double x); |
| 54 | ++int isinf(double x); |
| 55 | ++int isnan(double x); |
| 56 | ++int isnormal(double x); |
| 57 | + |
| 58 | + int __signbit(double); |
| 59 | + int __signbitf(float); |
| 60 | + int __signbitl(long double); |
| 61 | + |
| 62 | +-#define signbit(x) ( \ |
| 63 | +- sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x)>>31) : \ |
| 64 | +- sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x)>>63) : \ |
| 65 | +- __signbitl(x) ) |
| 66 | ++int signbit(double); |
| 67 | + |
| 68 | + #define isunordered(x,y) (isnan((x)) ? ((void)(y),1) : isnan((y))) |
| 69 | + |
| 70 | +@@ -200,6 +179,7 @@ double expm1(double); |
| 71 | + float expm1f(float); |
| 72 | + long double expm1l(long double); |
| 73 | + |
| 74 | ++int abs(int); |
| 75 | + double fabs(double); |
| 76 | + float fabsf(float); |
| 77 | + long double fabsl(long double); |
| 78 | +diff --git a/include/stddef.h b/include/stddef.h |
| 79 | +index bd753853..9f20990a 100644 |
| 80 | +--- a/include/stddef.h |
| 81 | ++++ b/include/stddef.h |
| 82 | +@@ -1,11 +1,13 @@ |
| 83 | + #ifndef _STDDEF_H |
| 84 | + #define _STDDEF_H |
| 85 | + |
| 86 | ++#ifndef NULL |
| 87 | + #ifdef __cplusplus |
| 88 | + #define NULL 0L |
| 89 | + #else |
| 90 | + #define NULL ((void*)0) |
| 91 | + #endif |
| 92 | ++#endif |
| 93 | + |
| 94 | + #define __NEED_ptrdiff_t |
| 95 | + #define __NEED_size_t |
| 96 | +@@ -16,10 +18,12 @@ |
| 97 | + |
| 98 | + #include <bits/alltypes.h> |
| 99 | + |
| 100 | ++#ifndef offsetof |
| 101 | + #if __GNUC__ > 3 |
| 102 | + #define offsetof(type, member) __builtin_offsetof(type, member) |
| 103 | + #else |
| 104 | + #define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 )) |
| 105 | + #endif |
| 106 | ++#endif |
| 107 | + |
| 108 | + #endif |
| 109 | +diff --git a/include/stdio.h b/include/stdio.h |
| 110 | +index 3604198c..ba195062 100644 |
| 111 | +--- a/include/stdio.h |
| 112 | ++++ b/include/stdio.h |
| 113 | +@@ -25,11 +25,13 @@ extern "C" { |
| 114 | + |
| 115 | + #include <bits/alltypes.h> |
| 116 | + |
| 117 | ++#ifndef NULL |
| 118 | + #ifdef __cplusplus |
| 119 | + #define NULL 0L |
| 120 | + #else |
| 121 | + #define NULL ((void*)0) |
| 122 | + #endif |
| 123 | ++#endif |
| 124 | + |
| 125 | + #undef EOF |
| 126 | + #define EOF (-1) |
| 127 | +diff --git a/include/stdlib.h b/include/stdlib.h |
| 128 | +index b54a051f..efb3b0a1 100644 |
| 129 | +--- a/include/stdlib.h |
| 130 | ++++ b/include/stdlib.h |
| 131 | +@@ -7,11 +7,13 @@ extern "C" { |
| 132 | + |
| 133 | + #include <features.h> |
| 134 | + |
| 135 | ++#ifndef NULL |
| 136 | + #ifdef __cplusplus |
| 137 | + #define NULL 0L |
| 138 | + #else |
| 139 | + #define NULL ((void*)0) |
| 140 | + #endif |
| 141 | ++#endif |
| 142 | + |
| 143 | + #define __NEED_size_t |
| 144 | + #define __NEED_wchar_t |
| 145 | +diff --git a/include/string.h b/include/string.h |
| 146 | +index 795a2abc..df0b98b9 100644 |
| 147 | +--- a/include/string.h |
| 148 | ++++ b/include/string.h |
| 149 | +@@ -7,11 +7,13 @@ extern "C" { |
| 150 | + |
| 151 | + #include <features.h> |
| 152 | + |
| 153 | ++#ifndef NULL |
| 154 | + #ifdef __cplusplus |
| 155 | + #define NULL 0L |
| 156 | + #else |
| 157 | + #define NULL ((void*)0) |
| 158 | + #endif |
| 159 | ++#endif |
| 160 | + |
| 161 | + #define __NEED_size_t |
| 162 | + #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 163 | +diff --git a/include/time.h b/include/time.h |
| 164 | +index 5494df18..1b180245 100644 |
| 165 | +--- a/include/time.h |
| 166 | ++++ b/include/time.h |
| 167 | +@@ -7,11 +7,13 @@ extern "C" { |
| 168 | + |
| 169 | + #include <features.h> |
| 170 | + |
| 171 | ++#ifndef NULL |
| 172 | + #ifdef __cplusplus |
| 173 | + #define NULL 0L |
| 174 | + #else |
| 175 | + #define NULL ((void*)0) |
| 176 | + #endif |
| 177 | ++#endif |
| 178 | + |
| 179 | + |
| 180 | + #define __NEED_size_t |
| 181 | +diff --git a/include/wchar.h b/include/wchar.h |
| 182 | +index 88eb55b1..9d03ca25 100644 |
| 183 | +--- a/include/wchar.h |
| 184 | ++++ b/include/wchar.h |
| 185 | +@@ -38,11 +38,13 @@ extern "C" { |
| 186 | + #define WCHAR_MIN (-1-0x7fffffff+L'\0') |
| 187 | + #endif |
| 188 | + |
| 189 | ++#ifndef NULL |
| 190 | + #ifdef __cplusplus |
| 191 | + #define NULL 0L |
| 192 | + #else |
| 193 | + #define NULL ((void*)0) |
| 194 | + #endif |
| 195 | ++#endif |
| 196 | + |
| 197 | + #undef WEOF |
| 198 | + #define WEOF 0xffffffffU |
| 199 | +diff --git a/src/errno/__errno_location.c b/src/errno/__errno_location.c |
| 200 | +index 7f9d6027..17d13563 100644 |
| 201 | +--- a/src/errno/__errno_location.c |
| 202 | ++++ b/src/errno/__errno_location.c |
| 203 | +@@ -6,4 +6,6 @@ int *__errno_location(void) |
| 204 | + return &__pthread_self()->errno_val; |
| 205 | + } |
| 206 | + |
| 207 | +-weak_alias(__errno_location, ___errno_location); |
| 208 | ++int *___errno_location(void) { |
| 209 | ++ return &__pthread_self()->errno_val; |
| 210 | ++} |
| 211 | +diff --git a/src/errno/strerror.c b/src/errno/strerror.c |
| 212 | +index 7f926432..4b081389 100644 |
| 213 | +--- a/src/errno/strerror.c |
| 214 | ++++ b/src/errno/strerror.c |
| 215 | +@@ -39,8 +39,7 @@ char *__strerror_l(int e, locale_t loc) |
| 216 | + return (char *)LCTRANS(s, LC_MESSAGES, loc); |
| 217 | + } |
| 218 | + |
| 219 | +-char *strerror(int e) |
| 220 | +-{ |
| 221 | ++char *strerror(int e) { |
| 222 | + return __strerror_l(e, CURRENT_LOCALE); |
| 223 | + } |
| 224 | + |
| 225 | +diff --git a/src/math/__fpclassify.c b/src/math/__fpclassify.c |
| 226 | +index f7c0e2df..a672f2db 100644 |
| 227 | +--- a/src/math/__fpclassify.c |
| 228 | ++++ b/src/math/__fpclassify.c |
| 229 | +@@ -9,3 +9,27 @@ int __fpclassify(double x) |
| 230 | + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; |
| 231 | + return FP_NORMAL; |
| 232 | + } |
| 233 | ++ |
| 234 | ++int fpclassify(double x) { |
| 235 | ++ return __fpclassify(x); |
| 236 | ++} |
| 237 | ++ |
| 238 | ++int signbit(double x) { |
| 239 | ++ return __signbit(x); |
| 240 | ++} |
| 241 | ++ |
| 242 | ++int isfinite(double x) { |
| 243 | ++ return (__DOUBLE_BITS(x) & -1ULL>>1) < 0x7ffULL<<52; |
| 244 | ++} |
| 245 | ++ |
| 246 | ++int isinf(double x) { |
| 247 | ++ return (__DOUBLE_BITS(x) & -1ULL>>1) == 0x7ffULL<<52; |
| 248 | ++} |
| 249 | ++ |
| 250 | ++int isnan(double x) { |
| 251 | ++ return (__DOUBLE_BITS(x) & -1ULL>>1) > 0x7ffULL<<52; |
| 252 | ++} |
| 253 | ++ |
| 254 | ++int isnormal(double x) { |
| 255 | ++ return ((__DOUBLE_BITS(x)+(1ULL<<52)) & -1ULL>>1) >= 1ULL<<53; |
| 256 | ++} |
| 257 | +diff --git a/src/stdio/printf.c b/src/stdio/printf.c |
| 258 | +index cebfe404..e69de29b 100644 |
| 259 | +--- a/src/stdio/printf.c |
| 260 | ++++ b/src/stdio/printf.c |
| 261 | +@@ -1,12 +0,0 @@ |
| 262 | +-#include <stdio.h> |
| 263 | +-#include <stdarg.h> |
| 264 | +- |
| 265 | +-int printf(const char *restrict fmt, ...) |
| 266 | +-{ |
| 267 | +- int ret; |
| 268 | +- va_list ap; |
| 269 | +- va_start(ap, fmt); |
| 270 | +- ret = vfprintf(stdout, fmt, ap); |
| 271 | +- va_end(ap); |
| 272 | +- return ret; |
| 273 | +-} |
| 274 | +diff --git a/src/string/x86_64/memcpy.s b/src/string/x86_64/memcpy.s |
| 275 | +index 3d960efa..aa495768 100644 |
| 276 | +--- a/src/string/x86_64/memcpy.s |
| 277 | ++++ b/src/string/x86_64/memcpy.s |
| 278 | +@@ -1,3 +1,4 @@ |
| 279 | ++//* |
| 280 | + .global memcpy |
| 281 | + .global __memcpy_fwd |
| 282 | + .hidden __memcpy_fwd |
| 283 | +@@ -23,3 +24,4 @@ __memcpy_fwd: |
| 284 | + dec %edx |
| 285 | + jnz 2b |
| 286 | + 1: ret |
| 287 | ++//*/ |
0 commit comments