diff options
Diffstat (limited to 'system/musl')
-rw-r--r-- | system/musl/0001-sysconf-Add-_SC_XOPEN_UUCP.patch | 39 | ||||
-rw-r--r-- | system/musl/0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch | 44 | ||||
-rw-r--r-- | system/musl/0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch | 44 | ||||
-rw-r--r-- | system/musl/0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch | 33 | ||||
-rw-r--r-- | system/musl/0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch | 38 | ||||
-rw-r--r-- | system/musl/0006-time-C11-visibility-fixes.patch | 51 | ||||
-rw-r--r-- | system/musl/0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch | 55 | ||||
-rw-r--r-- | system/musl/APKBUILD | 28 | ||||
-rw-r--r-- | system/musl/amalgamation.patch | 282 | ||||
-rw-r--r-- | system/musl/complex-math.patch | 59 | ||||
-rw-r--r-- | system/musl/complex-math2.patch | 79 |
11 files changed, 288 insertions, 464 deletions
diff --git a/system/musl/0001-sysconf-Add-_SC_XOPEN_UUCP.patch b/system/musl/0001-sysconf-Add-_SC_XOPEN_UUCP.patch deleted file mode 100644 index d792ede57..000000000 --- a/system/musl/0001-sysconf-Add-_SC_XOPEN_UUCP.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6f592a7812de3190f567174bbb4baa40790831dd Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Wed, 11 Apr 2018 23:22:33 -0500 -Subject: [PATCH 1/7] sysconf: Add _SC_XOPEN_UUCP - -We definitely don't /support/ UUCP, so return -1 for it. -But this value is required to be present in <unistd.h>. ---- - include/unistd.h | 1 + - src/conf/sysconf.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/include/unistd.h b/include/unistd.h -index 9485da7a..2b88bbb2 100644 ---- a/include/unistd.h -+++ b/include/unistd.h -@@ -417,6 +417,7 @@ int eaccess(const char *, int); - #define _SC_XOPEN_STREAMS 246 - #define _SC_THREAD_ROBUST_PRIO_INHERIT 247 - #define _SC_THREAD_ROBUST_PRIO_PROTECT 248 -+#define _SC_XOPEN_UUCP 249 - - #define _CS_PATH 0 - #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 -diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c -index 9ce330a5..58830a09 100644 ---- a/src/conf/sysconf.c -+++ b/src/conf/sysconf.c -@@ -164,6 +164,7 @@ long sysconf(int name) - [_SC_XOPEN_STREAMS] = JT_ZERO, - [_SC_THREAD_ROBUST_PRIO_INHERIT] = -1, - [_SC_THREAD_ROBUST_PRIO_PROTECT] = -1, -+ [_SC_XOPEN_UUCP] = -1, - }; - - if (name >= sizeof(values)/sizeof(values[0]) || !values[name]) { --- -2.15.0 - diff --git a/system/musl/0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch b/system/musl/0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch deleted file mode 100644 index cd253b993..000000000 --- a/system/musl/0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 94046871d24d5408adaf61941a4751c77abe06b6 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Wed, 11 Apr 2018 23:23:31 -0500 -Subject: [PATCH 2/7] confstr: Add _CS_POSIX_V7_THREADS_* - -This is used to determine what CFLAGS/LDFLAGS are needed to enable -compilation with threads on musl. We don't have any special ones, so -just return an empty string. - -This is required to be present in <unistd.h>. ---- - include/unistd.h | 2 ++ - src/conf/confstr.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/unistd.h b/include/unistd.h -index 2b88bbb2..68686dfd 100644 ---- a/include/unistd.h -+++ b/include/unistd.h -@@ -460,6 +460,8 @@ int eaccess(const char *, int); - #define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 - #define _CS_V6_ENV 1148 - #define _CS_V7_ENV 1149 -+#define _CS_POSIX_V7_THREADS_CFLAGS 1150 -+#define _CS_POSIX_V7_THREADS_LDFLAGS 1151 - - #ifdef __cplusplus - } -diff --git a/src/conf/confstr.c b/src/conf/confstr.c -index 02cb1aa2..3d417284 100644 ---- a/src/conf/confstr.c -+++ b/src/conf/confstr.c -@@ -7,7 +7,7 @@ size_t confstr(int name, char *buf, size_t len) - const char *s = ""; - if (!name) { - s = "/bin:/usr/bin"; -- } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>33U) { -+ } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>35U) { - errno = EINVAL; - return 0; - } --- -2.15.0 - diff --git a/system/musl/0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch b/system/musl/0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch deleted file mode 100644 index 21958a650..000000000 --- a/system/musl/0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 1d486ac55014c39f225f12bac80202197c2bf9c6 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Wed, 11 Apr 2018 23:43:19 -0500 -Subject: [PATCH 3/7] pathconf: add _PC_TIMESTAMP_RESOLUTION - -Right now, this is a worst-case assumption; some kernels may actually -have a value of 100000 here (100 Hz timers). This is considered the -easiest implementation. - -This is required to be present in <unistd.h>. ---- - include/unistd.h | 1 + - src/conf/fpathconf.c | 3 ++- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/include/unistd.h b/include/unistd.h -index 68686dfd..1bdd3292 100644 ---- a/include/unistd.h -+++ b/include/unistd.h -@@ -274,6 +274,7 @@ int eaccess(const char *, int); - #define _PC_ALLOC_SIZE_MIN 18 - #define _PC_SYMLINK_MAX 19 - #define _PC_2_SYMLINKS 20 -+#define _PC_TIMESTAMP_RESOLUTION 21 - - #define _SC_ARG_MAX 0 - #define _SC_CHILD_MAX 1 -diff --git a/src/conf/fpathconf.c b/src/conf/fpathconf.c -index 8eb037e6..1eefac18 100644 ---- a/src/conf/fpathconf.c -+++ b/src/conf/fpathconf.c -@@ -25,7 +25,8 @@ long fpathconf(int fd, int name) - [_PC_REC_XFER_ALIGN] = 4096, - [_PC_ALLOC_SIZE_MIN] = 4096, - [_PC_SYMLINK_MAX] = SYMLINK_MAX, -- [_PC_2_SYMLINKS] = 1 -+ [_PC_2_SYMLINKS] = 1, -+ [_PC_TIMESTAMP_RESOLUTION] = 1000000, - }; - if (name >= sizeof(values)/sizeof(values[0])) { - errno = EINVAL; --- -2.15.0 - diff --git a/system/musl/0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch b/system/musl/0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch deleted file mode 100644 index 9814ba4eb..000000000 --- a/system/musl/0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3e9758004c131236d53e5fdca4bbeea7bf7efc28 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Tue, 17 Apr 2018 20:52:39 -0500 -Subject: [PATCH 4/7] stdlib: Move mkostemp to _GNU_SOURCE/_BSD_SOURCE - -This is not a POSIX function, it should not be visible there. ---- - include/stdlib.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/stdlib.h b/include/stdlib.h -index 42ca8336..d1f99fe1 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -100,7 +100,6 @@ int posix_memalign (void **, size_t, size_t); - int setenv (const char *, const char *, int); - int unsetenv (const char *); - int mkstemp (char *); --int mkostemp (char *, int); - char *mkdtemp (char *); - int getsubopt (char **, char *const *, char **); - int rand_r (unsigned *); -@@ -138,6 +137,7 @@ void lcong48 (unsigned short [7]); - #include <alloca.h> - char *mktemp (char *); - int mkstemps (char *, int); -+int mkostemp (char *, int); - int mkostemps (char *, int, int); - void *valloc (size_t); - void *memalign(size_t, size_t); --- -2.15.0 - diff --git a/system/musl/0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch b/system/musl/0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch deleted file mode 100644 index 53235e0dd..000000000 --- a/system/musl/0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 36e0a4286937ccb25bc78392a679f496029765b0 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Tue, 17 Apr 2018 20:54:59 -0500 -Subject: [PATCH 5/7] stdlib: Ensure C11 fns are only visible in C11 - -aligned_alloc, at_quick_exit, and quick_exit are new in C11 and C++11. -Only make these symbols visible in those versions, to avoid polluting -the namespace of C99 and POSIX 2008 sources. ---- - include/stdlib.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/include/stdlib.h b/include/stdlib.h -index d1f99fe1..4bbaded0 100644 ---- a/include/stdlib.h -+++ b/include/stdlib.h -@@ -39,14 +39,18 @@ void *malloc (size_t); - void *calloc (size_t, size_t); - void *realloc (void *, size_t); - void free (void *); -+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L - void *aligned_alloc(size_t, size_t); -+#endif - - _Noreturn void abort (void); - int atexit (void (*) (void)); - _Noreturn void exit (int); - _Noreturn void _Exit (int); -+#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L - int at_quick_exit (void (*) (void)); - _Noreturn void quick_exit (int); -+#endif - - char *getenv (const char *); - --- -2.15.0 - diff --git a/system/musl/0006-time-C11-visibility-fixes.patch b/system/musl/0006-time-C11-visibility-fixes.patch deleted file mode 100644 index 5252611b5..000000000 --- a/system/musl/0006-time-C11-visibility-fixes.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0979c50b831c67e0b4f4a560435b867b35cdac67 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Tue, 17 Apr 2018 21:03:15 -0500 -Subject: [PATCH 6/7] time: C11 visibility fixes - -The timespec_get function, and TIME_* macros, are only in C11. - -Since musl is compiled with -std=c99, TIME_UTC is unavailable in the -timespec_get implementation, so we use the raw value 1. ---- - include/time.h | 7 +++++-- - src/time/timespec_get.c | 2 +- - 2 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/include/time.h b/include/time.h -index 672b3fc3..c5946dd0 100644 ---- a/include/time.h -+++ b/include/time.h -@@ -58,11 +58,14 @@ struct tm *gmtime (const time_t *); - struct tm *localtime (const time_t *); - char *asctime (const struct tm *); - char *ctime (const time_t *); --int timespec_get(struct timespec *, int); - --#define CLOCKS_PER_SEC 1000000L -+#if __STDC_VERSION__ >= 201112L -+int timespec_get(struct timespec *, int); - - #define TIME_UTC 1 -+#endif -+ -+#define CLOCKS_PER_SEC 1000000L - - #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ - || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ -diff --git a/src/time/timespec_get.c b/src/time/timespec_get.c -index 03c5a77b..c423b825 100644 ---- a/src/time/timespec_get.c -+++ b/src/time/timespec_get.c -@@ -6,7 +6,7 @@ int __clock_gettime(clockid_t, struct timespec *); - * are considered erroneous. */ - int timespec_get(struct timespec * ts, int base) - { -- if (base != TIME_UTC) return 0; -+ if (base != 1) return 0; - int ret = __clock_gettime(CLOCK_REALTIME, ts); - return ret < 0 ? 0 : base; - } --- -2.15.0 - diff --git a/system/musl/0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch b/system/musl/0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch deleted file mode 100644 index 4ab303c7d..000000000 --- a/system/musl/0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 1316aae0c862240ff58b1cf38c92cd8cefd02a91 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Tue, 17 Apr 2018 22:08:48 -0500 -Subject: [PATCH 7/7] abort: raise SIGABRT again if signal is ignored - -POSIX requires that abort() gives the SIGABRT status to waitpid(3) and -friends. If a signal handler is installed, and erroneously returns, -then the status given to waitpid(3) is SIGSEGV instead of SIGABRT. - -This change gives another opportunity for the proper SIGABRT status to -be given to any process monitoring this one's process, before we fall -back to a_crash(), which should be sufficient. ---- - src/exit/abort.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/src/exit/abort.c b/src/exit/abort.c -index ecc0f735..5e5a87c3 100644 ---- a/src/exit/abort.c -+++ b/src/exit/abort.c -@@ -1,13 +1,31 @@ - #include <stdlib.h> - #include <signal.h> -+#include <string.h> - #include "syscall.h" - #include "pthread_impl.h" - #include "atomic.h" - - _Noreturn void abort(void) - { -+ struct sigaction abrtaction; -+ sigset_t abrtset; -+ - raise(SIGABRT); - __block_all_sigs(0); -+ -+ /* Unblock just SIGABRT, and set default handler */ -+ sigemptyset(&abrtset); -+ sigaddset(&abrtset, SIGABRT); -+ sigprocmask(SIG_UNBLOCK, &abrtset, 0); -+ -+ memset(&abrtaction, 0, sizeof(struct sigaction)); -+ abrtaction.sa_handler = SIG_DFL; -+ -+ sigaction(SIGABRT, &abrtaction, NULL); -+ -+ raise(SIGABRT); -+ -+ /* Ok, give up. */ - a_crash(); - raise(SIGKILL); - _Exit(127); --- -2.15.0 - diff --git a/system/musl/APKBUILD b/system/musl/APKBUILD index 221f11f2c..0505e9ebd 100644 --- a/system/musl/APKBUILD +++ b/system/musl/APKBUILD @@ -1,8 +1,8 @@ # Contributor: William Pitcock <nenolod@dereferenced.org> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=musl -pkgver=1.1.19 -pkgrel=11 +pkgver=1.1.20 +pkgrel=0 pkgdesc="System library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -18,18 +18,9 @@ nolibc) ;; *) subpackages="$subpackages $pkgname-utils";; esac source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz - 0001-sysconf-Add-_SC_XOPEN_UUCP.patch - 0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch - 0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch - 0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch - 0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch - 0006-time-C11-visibility-fixes.patch - 0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch - + amalgamation.patch 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch 3001-make-real-lastlog-h.patch - complex-math.patch - complex-math2.patch handle-aux-at_base.patch ldconfig @@ -81,6 +72,7 @@ package() { s390*) ARCH="s390x" ;; mips64*) ARCH="mips64" ;; mips*) ARCH="mips" ;; + m68k) ARCH="m68k" ;; esac make ARCH="$ARCH" prefix=/usr DESTDIR="$pkgdir" install-headers @@ -116,18 +108,10 @@ utils() { install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin } -sha512sums="abee52d53af4b3c14c9088866c911a24d2b6ef67dc494f38a7a09dfe77250026f77528c24c52469c89cffa8ced2f0fa95badbdcf8d4460c90faba47e3927bcc5 musl-1.1.19.tar.gz -801e0d8adf1ca3bec1c35ce4fe319be7ce7776967630ec27fea39c896dd0e26f047cae34d1b2702e730815789cdc6bd4df526e9078bf68294bcef35a94c498b1 0001-sysconf-Add-_SC_XOPEN_UUCP.patch -5b648ebfdff20f56c6b82b19361a0045a59be8dfef08f8c37f44e0f780ced5e7f3c4fcee12bb25b0cee62edf8c939bc60530550b4a8fcc2c3b1f40c1744f6307 0002-confstr-Add-_CS_POSIX_V7_THREADS_.patch -4ddfdc5ca9d2f86b0ac278e70155c5fd64ba5b012423de89f8c7e07be42ad02a0a965e915c6ce4e139345c981f0103bdd0145f7d732508aba7e8bddd42541c66 0003-pathconf-add-_PC_TIMESTAMP_RESOLUTION.patch -fb7ea456de9cd7cf36be8bc9fdd4e142c999758b1cf4ee93720724985f256ae80f4f426ced3ac5f732d1d9f4048993a017469b6755807da0231f08d5e0e8a467 0004-stdlib-Move-mkostemp-to-_GNU_SOURCE-_BSD_SOURCE.patch -e99dab95932c0c03d67da0248d63b71581050efed40c5e58b28e226925f6f436b6e7ddfbf03dc83ef4cabead2c9a6bd55a30e09c7ee250ef3482ac5206eb309b 0005-stdlib-Ensure-C11-fns-are-only-visible-in-C11.patch -d0d0817a4e1d57b74cb442a3bf8d8efe39a23a387275b75cba1b2fa354d8a7dc2fd843b5b67584aac86ec97ea394d602ec013c6e8a65da309915b0a80b4a8f98 0006-time-C11-visibility-fixes.patch -6f5f9b5fb5eba638b0d98c68c280dbcc2bdae58d94d9f6966f5de55f6dd5d7f3cdddd9ca758e8861e30841b80ba616a945fb2b885a31481707d578293b187ff0 0007-abort-raise-SIGABRT-again-if-signal-is-ignored.patch +sha512sums="d3a7a30aa375ca50d7dcfbd618581d59e1aa5378417f50a0ca5510099336fd74cc9db468e05c93dda3067abd890f6bd47af226c3446bb833adf0a5054bff2e5d musl-1.1.20.tar.gz +3162b778101a46d9fb3a38927e3c4969781ccdabb9bb72de10d48ea31691215ecba605faee945ed86144a7e31fc948c31c2fee2881dc07897be3e82b6c6ff1e6 amalgamation.patch 2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch 88ae443dbb8e0a4368235bdc3a1c5c7b718495afa75e06deb8e01becc76cb1f0d6964589e2204fc749c9c1b3190b8b9ac1ae2c0099cab8e2ce3ec877103d4332 3001-make-real-lastlog-h.patch -8909dc260968770ace8f3ffdc04c6c7d20933ff115b4fa3e512fb7460860a8216c73ca7a7ad54f59cb5988ef011f02bf18aa13cc2287cc64ffdb8db84ef69d47 complex-math.patch -c34ae0c8c2b05d82bc6bd341ceb29041f6e1a1d2c7b2f4f289ab620288bfb1e1ddabc4cb2fc85220c1fbe735874c38a9b00af636644584c7cd1e895d54564a22 complex-math2.patch 6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c diff --git a/system/musl/amalgamation.patch b/system/musl/amalgamation.patch new file mode 100644 index 000000000..d4d4465dc --- /dev/null +++ b/system/musl/amalgamation.patch @@ -0,0 +1,282 @@ +diff --git a/include/stdlib.h b/include/stdlib.h +index 42ca8336..4bbaded0 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -39,14 +39,18 @@ void *malloc (size_t); + void *calloc (size_t, size_t); + void *realloc (void *, size_t); + void free (void *); ++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L + void *aligned_alloc(size_t, size_t); ++#endif + + _Noreturn void abort (void); + int atexit (void (*) (void)); + _Noreturn void exit (int); + _Noreturn void _Exit (int); ++#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L + int at_quick_exit (void (*) (void)); + _Noreturn void quick_exit (int); ++#endif + + char *getenv (const char *); + +@@ -100,7 +104,6 @@ int posix_memalign (void **, size_t, size_t); + int setenv (const char *, const char *, int); + int unsetenv (const char *); + int mkstemp (char *); +-int mkostemp (char *, int); + char *mkdtemp (char *); + int getsubopt (char **, char *const *, char **); + int rand_r (unsigned *); +@@ -138,6 +141,7 @@ void lcong48 (unsigned short [7]); + #include <alloca.h> + char *mktemp (char *); + int mkstemps (char *, int); ++int mkostemp (char *, int); + int mkostemps (char *, int, int); + void *valloc (size_t); + void *memalign(size_t, size_t); +diff --git a/include/time.h b/include/time.h +index 672b3fc3..c5946dd0 100644 +--- a/include/time.h ++++ b/include/time.h +@@ -58,11 +58,14 @@ struct tm *gmtime (const time_t *); + struct tm *localtime (const time_t *); + char *asctime (const struct tm *); + char *ctime (const time_t *); +-int timespec_get(struct timespec *, int); + +-#define CLOCKS_PER_SEC 1000000L ++#if __STDC_VERSION__ >= 201112L ++int timespec_get(struct timespec *, int); + + #define TIME_UTC 1 ++#endif ++ ++#define CLOCKS_PER_SEC 1000000L + + #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ +diff --git a/include/unistd.h b/include/unistd.h +index 9485da7a..1bdd3292 100644 +--- a/include/unistd.h ++++ b/include/unistd.h +@@ -274,6 +274,7 @@ int eaccess(const char *, int); + #define _PC_ALLOC_SIZE_MIN 18 + #define _PC_SYMLINK_MAX 19 + #define _PC_2_SYMLINKS 20 ++#define _PC_TIMESTAMP_RESOLUTION 21 + + #define _SC_ARG_MAX 0 + #define _SC_CHILD_MAX 1 +@@ -417,6 +418,7 @@ int eaccess(const char *, int); + #define _SC_XOPEN_STREAMS 246 + #define _SC_THREAD_ROBUST_PRIO_INHERIT 247 + #define _SC_THREAD_ROBUST_PRIO_PROTECT 248 ++#define _SC_XOPEN_UUCP 249 + + #define _CS_PATH 0 + #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 1 +@@ -459,6 +461,8 @@ int eaccess(const char *, int); + #define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS 1147 + #define _CS_V6_ENV 1148 + #define _CS_V7_ENV 1149 ++#define _CS_POSIX_V7_THREADS_CFLAGS 1150 ++#define _CS_POSIX_V7_THREADS_LDFLAGS 1151 + + #ifdef __cplusplus + } +diff --git a/src/conf/confstr.c b/src/conf/confstr.c +index 02cb1aa2..8f870a69 100644 +--- a/src/conf/confstr.c ++++ b/src/conf/confstr.c +@@ -6,8 +6,8 @@ size_t confstr(int name, char *buf, size_t len) + { + const char *s = ""; + if (!name) { +- s = "/bin:/usr/bin"; +- } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>33U) { ++ s = "/usr/5bin:/usr/bin:/bin"; ++ } else if ((name&~4U)!=1 && name-_CS_POSIX_V6_ILP32_OFF32_CFLAGS>35U) { + errno = EINVAL; + return 0; + } +diff --git a/src/conf/fpathconf.c b/src/conf/fpathconf.c +index e6aca5cf..b6a9d63e 100644 +--- a/src/conf/fpathconf.c ++++ b/src/conf/fpathconf.c +@@ -4,7 +4,7 @@ + + long fpathconf(int fd, int name) + { +- static const short values[] = { ++ static const long values[] = { + [_PC_LINK_MAX] = _POSIX_LINK_MAX, + [_PC_MAX_CANON] = _POSIX_MAX_CANON, + [_PC_MAX_INPUT] = _POSIX_MAX_INPUT, +@@ -25,7 +25,8 @@ long fpathconf(int fd, int name) + [_PC_REC_XFER_ALIGN] = 4096, + [_PC_ALLOC_SIZE_MIN] = 4096, + [_PC_SYMLINK_MAX] = -1, +- [_PC_2_SYMLINKS] = 1 ++ [_PC_2_SYMLINKS] = 1, ++ [_PC_TIMESTAMP_RESOLUTION] = 100000000, + }; + if (name >= sizeof(values)/sizeof(values[0])) { + errno = EINVAL; +diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c +index 45ef1c16..483e1635 100644 +--- a/src/conf/sysconf.c ++++ b/src/conf/sysconf.c +@@ -165,6 +165,7 @@ long sysconf(int name) + [_SC_XOPEN_STREAMS] = JT_ZERO, + [_SC_THREAD_ROBUST_PRIO_INHERIT] = -1, + [_SC_THREAD_ROBUST_PRIO_PROTECT] = -1, ++ [_SC_XOPEN_UUCP] = -1, + }; + + if (name >= sizeof(values)/sizeof(values[0]) || !values[name]) { +diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c +index 40bc7ece..4d51cdfe 100644 +--- a/src/locale/setlocale.c ++++ b/src/locale/setlocale.c +@@ -25,6 +25,8 @@ char *setlocale(int cat, const char *name) + + if ((unsigned)cat > LC_ALL) return 0; + ++ if (name && (!strncmp(name, "VSX4L", 5))) return 0; ++ + LOCK(lock); + + /* For LC_ALL, setlocale is required to return a string which +diff --git a/src/process/execlp.c b/src/process/execlp.c +index 5eed886e..f6da398b 100644 +--- a/src/process/execlp.c ++++ b/src/process/execlp.c +@@ -1,6 +1,9 @@ + #include <unistd.h> ++#include <errno.h> + #include <stdarg.h> + ++extern int __execsh(const char *, char *const []); ++ + int execlp(const char *file, const char *argv0, ...) + { + int argc; +@@ -17,6 +20,11 @@ int execlp(const char *file, const char *argv0, ...) + argv[i] = va_arg(ap, char *); + argv[i] = NULL; + va_end(ap); +- return execvp(file, argv); ++ execvp(file, argv); ++ if (errno == ENOEXEC) { ++ errno = 0; ++ return __execsh(file, argv); ++ } ++ return -1; + } + } +diff --git a/src/process/execsh.c b/src/process/execsh.c +new file mode 100644 +index 00000000..180bb2aa +--- /dev/null ++++ b/src/process/execsh.c +@@ -0,0 +1,18 @@ ++#include <unistd.h> ++#include <errno.h> ++#include "libc.h" ++ ++int ++__execsh(const char *file, char *const argv[]) ++{ ++ int i, argc; ++ char **p; ++ ++ for (argc=1, p=(char **)argv; *p; ++argc, ++p); ++ ++ char *nargv[argc+1]; ++ nargv[0] = (char *)file; ++ for (i=0; i<argc; ++i) ++ nargv[i+1] = argv[i]; ++ return execv("/bin/sh", nargv); ++} +diff --git a/src/process/execvp.c b/src/process/execvp.c +index 2dddeddb..fdd0ca48 100644 +--- a/src/process/execvp.c ++++ b/src/process/execvp.c +@@ -6,6 +6,7 @@ + #include "libc.h" + + extern char **__environ; ++extern int __execsh(const char *, char *const []); + + int __execvpe(const char *file, char *const argv[], char *const envp[]) + { +@@ -56,7 +57,12 @@ int __execvpe(const char *file, char *const argv[], char *const envp[]) + + int execvp(const char *file, char *const argv[]) + { +- return __execvpe(file, argv, __environ); ++ __execvpe(file, argv, __environ); ++ if (errno == ENOEXEC) { ++ errno = 0; ++ return __execsh(file, argv); ++ } ++ return -1; + } + + weak_alias(__execvpe, execvpe); +diff --git a/src/process/system.c b/src/process/system.c +index 9135b815..aa01e13b 100644 +--- a/src/process/system.c ++++ b/src/process/system.c +@@ -19,7 +19,9 @@ int system(const char *cmd) + + pthread_testcancel(); + +- if (!cmd) return 1; ++ if (!cmd) { ++ return (access("/bin/sh", X_OK) == 0); ++ } + + sigaction(SIGINT, &sa, &oldint); + sigaction(SIGQUIT, &sa, &oldquit); +diff --git a/src/thread/pthread_attr_setinheritsched.c b/src/thread/pthread_attr_setinheritsched.c +index e540e846..4115e2fe 100644 +--- a/src/thread/pthread_attr_setinheritsched.c ++++ b/src/thread/pthread_attr_setinheritsched.c +@@ -23,7 +23,7 @@ void *__start_sched(void *p) + + int pthread_attr_setinheritsched(pthread_attr_t *a, int inherit) + { +- if (inherit > 1U) return EINVAL; ++ if (inherit > 1U) return ENOTSUP; + a->_a_sched = inherit; + return 0; + } +diff --git a/src/thread/pthread_attr_setscope.c b/src/thread/pthread_attr_setscope.c +index 46b520c0..933bdb38 100644 +--- a/src/thread/pthread_attr_setscope.c ++++ b/src/thread/pthread_attr_setscope.c +@@ -8,6 +8,6 @@ int pthread_attr_setscope(pthread_attr_t *a, int scope) + case PTHREAD_SCOPE_PROCESS: + return ENOTSUP; + default: +- return EINVAL; ++ return ENOTSUP; + } + } +diff --git a/src/time/timespec_get.c b/src/time/timespec_get.c +index 03c5a77b..c423b825 100644 +--- a/src/time/timespec_get.c ++++ b/src/time/timespec_get.c +@@ -6,7 +6,7 @@ int __clock_gettime(clockid_t, struct timespec *); + * are considered erroneous. */ + int timespec_get(struct timespec * ts, int base) + { +- if (base != TIME_UTC) return 0; ++ if (base != 1) return 0; + int ret = __clock_gettime(CLOCK_REALTIME, ts); + return ret < 0 ? 0 : base; + } diff --git a/system/musl/complex-math.patch b/system/musl/complex-math.patch deleted file mode 100644 index fff4b59c1..000000000 --- a/system/musl/complex-math.patch +++ /dev/null @@ -1,59 +0,0 @@ -From ae2a01da2e388535da243b3d974aef74a3c06ae0 Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Mon, 9 Apr 2018 12:33:17 -0400 -Subject: fix wrong result in casin and many related complex functions - -the factor of -i noted in the comment at the top of casin.c was -omitted from the actual code, yielding a result rotated 90 degrees and -propagating into errors in other functions defined in terms of casin. - -implement multiplication by -i as a rotation of the real and imaginary -parts of the result, rather than by actual multiplication, since the -latter cannot be optimized without knowledge that the operand is -finite. here, the rotation is the actual intent, anyway. ---- - src/complex/casin.c | 3 ++- - src/complex/casinf.c | 3 ++- - src/complex/casinl.c | 3 ++- - 3 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/complex/casin.c b/src/complex/casin.c -index dfdda98..01ed618 100644 ---- a/src/complex/casin.c -+++ b/src/complex/casin.c -@@ -12,5 +12,6 @@ double complex casin(double complex z) - x = creal(z); - y = cimag(z); - w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y); -- return clog(CMPLX(-y, x) + csqrt(w)); -+ double complex r = clog(CMPLX(-y, x) + csqrt(w)); -+ return CMPLX(cimag(r), -creal(r)); - } -diff --git a/src/complex/casinf.c b/src/complex/casinf.c -index 93f0e33..4fcb76f 100644 ---- a/src/complex/casinf.c -+++ b/src/complex/casinf.c -@@ -10,5 +10,6 @@ float complex casinf(float complex z) - x = crealf(z); - y = cimagf(z); - w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y); -- return clogf(CMPLXF(-y, x) + csqrtf(w)); -+ float complex r = clogf(CMPLXF(-y, x) + csqrtf(w)); -+ return CMPLXF(cimagf(r), -crealf(r)); - } -diff --git a/src/complex/casinl.c b/src/complex/casinl.c -index 0916c60..3b7ceba 100644 ---- a/src/complex/casinl.c -+++ b/src/complex/casinl.c -@@ -15,6 +15,7 @@ long double complex casinl(long double complex z) - x = creall(z); - y = cimagl(z); - w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y); -- return clogl(CMPLXL(-y, x) + csqrtl(w)); -+ long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w)); -+ return CMPLXL(cimagl(r), -creall(r)); - } - #endif --- -cgit v0.11.2 - diff --git a/system/musl/complex-math2.patch b/system/musl/complex-math2.patch deleted file mode 100644 index 49f5c3acd..000000000 --- a/system/musl/complex-math2.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 10e4bd3780050e75b72aac5d85c31816419bb17d Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Wed, 11 Apr 2018 15:05:22 -0400 -Subject: [PATCH 1/2] fix incorrect results for catan with some inputs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -the catan implementation from OpenBSD includes a FIXME-annotated -"overflow" branch that produces a meaningless and incorrect -large-magnitude result. it was reachable via three paths, -corresponding to gotos removed by this commit, in order: - -1. pure imaginary argument with imaginary component greater than 1 in - magnitude. this case does not seem at all exceptional and is - handled (at least with the quality currently expected from our - complex math functions) by the existing non-exceptional code path. - -2. arguments on the unit circle, including the pure-real argument 1.0. - these are not exceptional except for ±i, which should produce - results with infinite imaginary component and which lead to - computation of atan2(±0,0) in the existing non-exceptional code - path. such calls to atan2() however are well-defined by POSIX. - -3. the specific argument +i. this route should be unreachable due to - the above (2), but subtle rounding effects might have made it - possible in rare cases. continuing on the non-exceptional code path - in this case would lead to computing the (real) log of an infinite - argument, then producing a NAN when multiplying it by I. - -for now, remove the exceptional code paths entirely. replace the -multiplication by I with construction of a complex number using the -CMPLX macro so that the NAN issue (3) prevented cannot arise. - -with these changes, catan should give reasonably correct results for -real arguments, and should no longer give completely-wrong results for -pure-imaginary arguments outside the interval (-i,+i). ---- - src/complex/catan.c | 14 +------------- - 1 file changed, 1 insertion(+), 13 deletions(-) - -diff --git a/src/complex/catan.c b/src/complex/catan.c -index 39ce6cf2..7dc2afeb 100644 ---- a/src/complex/catan.c -+++ b/src/complex/catan.c -@@ -91,29 +91,17 @@ double complex catan(double complex z) - x = creal(z); - y = cimag(z); - -- if (x == 0.0 && y > 1.0) -- goto ovrf; -- - x2 = x * x; - a = 1.0 - x2 - (y * y); -- if (a == 0.0) -- goto ovrf; - - t = 0.5 * atan2(2.0 * x, a); - w = _redupi(t); - - t = y - 1.0; - a = x2 + (t * t); -- if (a == 0.0) -- goto ovrf; - - t = y + 1.0; - a = (x2 + t * t)/a; -- w = w + (0.25 * log(a)) * I; -- return w; -- --ovrf: -- // FIXME -- w = MAXNUM + MAXNUM * I; -+ w = CMPLX(w, 0.25 * log(a)); - return w; - } --- -2.15.0 - |