diff --git a/recipes-core/musl/musl/0001-Remove-ARMSUBARCH-relic-from-configure.patch b/recipes-core/musl/musl/0001-Remove-ARMSUBARCH-relic-from-configure.patch deleted file mode 100644 index 8d4281e..0000000 --- a/recipes-core/musl/musl/0001-Remove-ARMSUBARCH-relic-from-configure.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5ed61f2b51eea1bca9b549582f08d55ae40e7425 Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:17:45 -0400 -Subject: [PATCH 01/16] Remove ARMSUBARCH relic from configure - ---- - configure | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/configure b/configure -index 9abbbd66..acbfa8f2 100755 ---- a/configure -+++ b/configure -@@ -727,11 +727,6 @@ fi - test "$SUBARCH" \ - && printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH" - --case "$ARCH$SUBARCH" in --arm) ASMSUBARCH=el ;; --*) ASMSUBARCH=$SUBARCH ;; --esac -- - # - # Some archs (powerpc) have different possible long double formats - # that the compiler can be configured for. The logic for whether this --- -2.29.2 - diff --git a/recipes-core/musl/musl/0002-time64-Don-t-make-aliases-to-nonexistent-syscalls.patch b/recipes-core/musl/musl/0002-time64-Don-t-make-aliases-to-nonexistent-syscalls.patch deleted file mode 100644 index 46e548d..0000000 --- a/recipes-core/musl/musl/0002-time64-Don-t-make-aliases-to-nonexistent-syscalls.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 9fcf025503dfe3478c77cd07a3e29bd2598b42dd Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:27:03 -0400 -Subject: [PATCH 02/16] time64: Don't make aliases to nonexistent syscalls - -riscv32 and future architectures lack the _time32 variants entirely, so -don't try to use their numbers. ---- - src/internal/syscall.h | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/src/internal/syscall.h b/src/internal/syscall.h -index d5f294d4..4f41e1dc 100644 ---- a/src/internal/syscall.h -+++ b/src/internal/syscall.h -@@ -201,43 +201,43 @@ static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, l - #define SYS_sendfile SYS_sendfile64 - #endif - --#ifndef SYS_timer_settime -+#ifdef SYS_timer_settime32 - #define SYS_timer_settime SYS_timer_settime32 - #endif - --#ifndef SYS_timer_gettime -+#ifdef SYS_timer_gettime32 - #define SYS_timer_gettime SYS_timer_gettime32 - #endif - --#ifndef SYS_timerfd_settime -+#ifdef SYS_timerfd_settime32 - #define SYS_timerfd_settime SYS_timerfd_settime32 - #endif - --#ifndef SYS_timerfd_gettime -+#ifdef SYS_timerfd_gettime32 - #define SYS_timerfd_gettime SYS_timerfd_gettime32 - #endif - --#ifndef SYS_clock_settime -+#ifdef SYS_clock_settime32 - #define SYS_clock_settime SYS_clock_settime32 - #endif - --#ifndef SYS_clock_gettime -+#ifdef SYS_clock_gettime32 - #define SYS_clock_gettime SYS_clock_gettime32 - #endif - --#ifndef SYS_clock_getres -+#ifdef SYS_clock_getres_time32 - #define SYS_clock_getres SYS_clock_getres_time32 - #endif - --#ifndef SYS_clock_nanosleep -+#ifdef SYS_clock_nanosleep_time32 - #define SYS_clock_nanosleep SYS_clock_nanosleep_time32 - #endif - --#ifndef SYS_gettimeofday -+#ifdef SYS_gettimeofday_time32 - #define SYS_gettimeofday SYS_gettimeofday_time32 - #endif - --#ifndef SYS_settimeofday -+#ifdef SYS_settimeofday_time32 - #define SYS_settimeofday SYS_settimeofday_time32 - #endif - --- -2.29.2 - diff --git a/recipes-core/musl/musl/0003-time64-Only-getrlimit-setrlimit-if-they-exist.patch b/recipes-core/musl/musl/0003-time64-Only-getrlimit-setrlimit-if-they-exist.patch deleted file mode 100644 index 1e443b8..0000000 --- a/recipes-core/musl/musl/0003-time64-Only-getrlimit-setrlimit-if-they-exist.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 73f38d909e6a8573b33f7c0e0827a5b14e416533 Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:31:05 -0400 -Subject: [PATCH 03/16] time64: Only getrlimit/setrlimit if they exist - -riscv32 and future architectures only provide prlimit64. ---- - src/misc/getrlimit.c | 6 +++++- - src/misc/setrlimit.c | 2 ++ - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/misc/getrlimit.c b/src/misc/getrlimit.c -index 2ab2f0f4..bf676307 100644 ---- a/src/misc/getrlimit.c -+++ b/src/misc/getrlimit.c -@@ -6,12 +6,13 @@ - - int getrlimit(int resource, struct rlimit *rlim) - { -- unsigned long k_rlim[2]; - int ret = syscall(SYS_prlimit64, 0, resource, 0, rlim); - if (!ret) { - FIX(rlim->rlim_cur); - FIX(rlim->rlim_max); - } -+#ifdef SYS_getrlimit -+ unsigned long k_rlim[2]; - if (!ret || errno != ENOSYS) - return ret; - if (syscall(SYS_getrlimit, resource, k_rlim) < 0) -@@ -21,6 +22,9 @@ int getrlimit(int resource, struct rlimit *rlim) - FIX(rlim->rlim_cur); - FIX(rlim->rlim_max); - return 0; -+#else -+ return ret; -+#endif - } - - weak_alias(getrlimit, getrlimit64); -diff --git a/src/misc/setrlimit.c b/src/misc/setrlimit.c -index 8340aee0..4cf2c607 100644 ---- a/src/misc/setrlimit.c -+++ b/src/misc/setrlimit.c -@@ -16,7 +16,9 @@ static void do_setrlimit(void *p) - { - struct ctx *c = p; - if (c->err>0) return; -+#ifdef SYS_setrlimit - c->err = -__syscall(SYS_setrlimit, c->res, c->lim); -+#endif - } - - int setrlimit(int resource, const struct rlimit *rlim) --- -2.29.2 - diff --git a/recipes-core/musl/musl/0004-time64-Only-gettimeofday-settimeofday-if-exist.patch b/recipes-core/musl/musl/0004-time64-Only-gettimeofday-settimeofday-if-exist.patch deleted file mode 100644 index 2d48928..0000000 --- a/recipes-core/musl/musl/0004-time64-Only-gettimeofday-settimeofday-if-exist.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 8519be9a302dae238d137775d13142716af04581 Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:33:10 -0400 -Subject: [PATCH 04/16] time64: Only gettimeofday/settimeofday if exist - -riscv64 and future architectures only provide the clock_ functions. ---- - src/time/clock_gettime.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c -index 3e1d0975..c7e66a51 100644 ---- a/src/time/clock_gettime.c -+++ b/src/time/clock_gettime.c -@@ -80,10 +80,12 @@ int __clock_gettime(clockid_t clk, struct timespec *ts) - return __syscall_ret(r); - long ts32[2]; - r = __syscall(SYS_clock_gettime, clk, ts32); -+#ifdef SYS_gettimeofday - if (r==-ENOSYS && clk==CLOCK_REALTIME) { - r = __syscall(SYS_gettimeofday, ts32, 0); - ts32[1] *= 1000; - } -+#endif - if (!r) { - ts->tv_sec = ts32[0]; - ts->tv_nsec = ts32[1]; -@@ -92,6 +94,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts) - return __syscall_ret(r); - #else - r = __syscall(SYS_clock_gettime, clk, ts); -+#ifdef SYS_gettimeofday - if (r == -ENOSYS) { - if (clk == CLOCK_REALTIME) { - __syscall(SYS_gettimeofday, ts, 0); -@@ -100,6 +103,7 @@ int __clock_gettime(clockid_t clk, struct timespec *ts) - } - r = -EINVAL; - } -+#endif - return __syscall_ret(r); - #endif - } --- -2.29.2 - diff --git a/recipes-core/musl/musl/0005-Add-src-internal-statx.h.patch b/recipes-core/musl/musl/0005-Add-src-internal-statx.h.patch deleted file mode 100644 index d8e1feb..0000000 --- a/recipes-core/musl/musl/0005-Add-src-internal-statx.h.patch +++ /dev/null @@ -1,94 +0,0 @@ -From eca94dccba29fb2862884472ae8d30672480f8f4 Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:45:08 -0400 -Subject: [PATCH 05/16] Add src/internal/statx.h - -We need to make internal syscalls to SYS_statx when SYS_fstatat is not -available without changing the musl API. ---- - src/internal/statx.h | 28 ++++++++++++++++++++++++++++ - src/stat/fstatat.c | 28 ++-------------------------- - 2 files changed, 30 insertions(+), 26 deletions(-) - create mode 100644 src/internal/statx.h - -diff --git a/src/internal/statx.h b/src/internal/statx.h -new file mode 100644 -index 00000000..46b16f62 ---- /dev/null -+++ b/src/internal/statx.h -@@ -0,0 +1,28 @@ -+struct statx { -+ uint32_t stx_mask; -+ uint32_t stx_blksize; -+ uint64_t stx_attributes; -+ uint32_t stx_nlink; -+ uint32_t stx_uid; -+ uint32_t stx_gid; -+ uint16_t stx_mode; -+ uint16_t pad1; -+ uint64_t stx_ino; -+ uint64_t stx_size; -+ uint64_t stx_blocks; -+ uint64_t stx_attributes_mask; -+ struct { -+ int64_t tv_sec; -+ uint32_t tv_nsec; -+ int32_t pad; -+ } stx_atime, stx_btime, stx_ctime, stx_mtime; -+ uint32_t stx_rdev_major; -+ uint32_t stx_rdev_minor; -+ uint32_t stx_dev_major; -+ uint32_t stx_dev_minor; -+ uint64_t spare[14]; -+}; -+ -+#define STATX_TYPE 0x001U -+#define STATX_SIZE 0x200U -+#define STATX_BASIC_STATS 0x7ffU -diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c -index de165b5c..230a83fc 100644 ---- a/src/stat/fstatat.c -+++ b/src/stat/fstatat.c -@@ -7,37 +7,13 @@ - #include - #include "syscall.h" - #include "kstat.h" -- --struct statx { -- uint32_t stx_mask; -- uint32_t stx_blksize; -- uint64_t stx_attributes; -- uint32_t stx_nlink; -- uint32_t stx_uid; -- uint32_t stx_gid; -- uint16_t stx_mode; -- uint16_t pad1; -- uint64_t stx_ino; -- uint64_t stx_size; -- uint64_t stx_blocks; -- uint64_t stx_attributes_mask; -- struct { -- int64_t tv_sec; -- uint32_t tv_nsec; -- int32_t pad; -- } stx_atime, stx_btime, stx_ctime, stx_mtime; -- uint32_t stx_rdev_major; -- uint32_t stx_rdev_minor; -- uint32_t stx_dev_major; -- uint32_t stx_dev_minor; -- uint64_t spare[14]; --}; -+#include "statx.h" - - static int fstatat_statx(int fd, const char *restrict path, struct stat *restrict st, int flag) - { - struct statx stx; - -- int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx); -+ int ret = __syscall(SYS_statx, fd, path, flag, STATX_BASIC_STATS, &stx); - if (ret) return ret; - - *st = (struct stat){ --- -2.29.2 - diff --git a/recipes-core/musl/musl/0006-Only-call-fstatat-if-defined.patch b/recipes-core/musl/musl/0006-Only-call-fstatat-if-defined.patch deleted file mode 100644 index e4ffa0f..0000000 --- a/recipes-core/musl/musl/0006-Only-call-fstatat-if-defined.patch +++ /dev/null @@ -1,209 +0,0 @@ -From e7711de591aed7e3a182880c3c8f5b527c0c67e8 Mon Sep 17 00:00:00 2001 -From: Stefan O'Rear -Date: Thu, 3 Sep 2020 03:59:59 -0400 -Subject: [PATCH 06/16] Only call fstatat if defined - -riscv32 and future architectures lack it. ---- - src/stat/fchmodat.c | 23 ++++++++++++++++++++--- - src/stat/fstatat.c | 6 ++++++ - src/stdio/tempnam.c | 9 +++++++-- - src/stdio/tmpnam.c | 9 +++++++-- - src/time/__map_file.c | 19 +++++++++++++++---- - 5 files changed, 55 insertions(+), 11 deletions(-) - -diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c -index 4ee00b0a..857e84e5 100644 ---- a/src/stat/fchmodat.c -+++ b/src/stat/fchmodat.c -@@ -1,8 +1,10 @@ - #include - #include - #include -+#include - #include "syscall.h" - #include "kstat.h" -+#include "statx.h" - - int fchmodat(int fd, const char *path, mode_t mode, int flag) - { -@@ -11,13 +13,22 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) - if (flag != AT_SYMLINK_NOFOLLOW) - return __syscall_ret(-EINVAL); - -- struct kstat st; - int ret, fd2; - char proc[15+3*sizeof(int)]; - -+#ifdef SYS_fstatat -+ struct kstat st; - if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag))) - return __syscall_ret(ret); -- if (S_ISLNK(st.st_mode)) -+ mode_t get_mode = st.st_mode; -+#else -+ struct statx st; -+ if ((ret = __syscall(SYS_statx, fd, path, flag, STATX_TYPE, &st))) -+ return __syscall_ret(ret); -+ mode_t get_mode = st.stx_mode; -+#endif -+ -+ if (S_ISLNK(get_mode)) - return __syscall_ret(-EOPNOTSUPP); - - if ((fd2 = __syscall(SYS_openat, fd, path, O_RDONLY|O_PATH|O_NOFOLLOW|O_NOCTTY|O_CLOEXEC)) < 0) { -@@ -27,9 +38,15 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) - } - - __procfdname(proc, fd2); -+#ifdef SYS_fstatat - ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0); -+ get_mode = st.st_mode; -+#else -+ ret = __syscall(SYS_statx, AT_FDCWD, proc, 0, STATX_TYPE, &st); -+ get_mode = st.stx_mode; -+#endif - if (!ret) { -- if (S_ISLNK(st.st_mode)) ret = -EOPNOTSUPP; -+ if (S_ISLNK(get_mode)) ret = -EOPNOTSUPP; - else ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode); - } - -diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c -index 230a83fc..0486f21a 100644 ---- a/src/stat/fstatat.c -+++ b/src/stat/fstatat.c -@@ -45,6 +45,7 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric - return 0; - } - -+#ifdef SYS_fstatat - static int fstatat_kstat(int fd, const char *restrict path, struct stat *restrict st, int flag) - { - int ret; -@@ -106,15 +107,20 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric - - return 0; - } -+#endif - - int fstatat(int fd, const char *restrict path, struct stat *restrict st, int flag) - { - int ret; -+#ifdef SYS_fstatat - if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) { - ret = fstatat_statx(fd, path, st, flag); - if (ret!=-ENOSYS) return __syscall_ret(ret); - } - ret = fstatat_kstat(fd, path, st, flag); -+#else -+ ret = fstatat_statx(fd, path, st, flag); -+#endif - return __syscall_ret(ret); - } - -diff --git a/src/stdio/tempnam.c b/src/stdio/tempnam.c -index 565df6b6..9469923b 100644 ---- a/src/stdio/tempnam.c -+++ b/src/stdio/tempnam.c -@@ -5,8 +5,10 @@ - #include - #include - #include -+#include - #include "syscall.h" - #include "kstat.h" -+#include "statx.h" - - #define MAXTRIES 100 - -@@ -37,11 +39,14 @@ char *tempnam(const char *dir, const char *pfx) - - for (try=0; try - #include - #include -+#include - #include "syscall.h" - #include "kstat.h" -+#include "statx.h" - - #define MAXTRIES 100 - -@@ -17,11 +19,14 @@ char *tmpnam(char *buf) - int r; - for (try=0; try - #include - #include -+#include - #include "syscall.h" - #include "kstat.h" -+#include "statx.h" - - const char unsigned *__map_file(const char *pathname, size_t *size) - { -- struct kstat st; - const unsigned char *map = MAP_FAILED; - int fd = sys_open(pathname, O_RDONLY|O_CLOEXEC|O_NONBLOCK); - if (fd < 0) return 0; -- if (!syscall(SYS_fstat, fd, &st)) { -- map = __mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); -- *size = st.st_size; -+#ifdef SYS_fstat -+ struct kstat st; -+ int r = syscall(SYS_fstat, fd, &st); -+ size_t fsize = st.st_size; -+#else -+ struct statx st; -+ int r = syscall(SYS_statx, fd, "", AT_EMPTY_PATH, STATX_SIZE, &st); -+ size_t fsize = st.stx_size; -+#endif -+ if (!r) { -+ map = __mmap(0, fsize, PROT_READ, MAP_SHARED, fd, 0); -+ *size = fsize; - } - __syscall(SYS_close, fd); - return map == MAP_FAILED ? 0 : map; --- -2.29.2 - diff --git a/recipes-core/musl/musl_%.bbappend b/recipes-core/musl/musl_%.bbappend index 5dc7daf..5222810 100644 --- a/recipes-core/musl/musl_%.bbappend +++ b/recipes-core/musl/musl_%.bbappend @@ -1,12 +1,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI:append:riscv32 = "\ - file://0001-Remove-ARMSUBARCH-relic-from-configure.patch \ - file://0002-time64-Don-t-make-aliases-to-nonexistent-syscalls.patch \ - file://0003-time64-Only-getrlimit-setrlimit-if-they-exist.patch \ - file://0004-time64-Only-gettimeofday-settimeofday-if-exist.patch \ - file://0005-Add-src-internal-statx.h.patch \ - file://0006-Only-call-fstatat-if-defined.patch \ file://0007-Emulate-wait4-using-waitid.patch \ file://0008-riscv-Fall-back-to-syscall-__riscv_flush_icache.patch \ file://0009-riscv32-Target-and-subtarget-detection.patch \