summaryrefslogtreecommitdiff
path: root/repo/system/musl
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
committerdavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
commit48ca75555522716f0f686dcae3dd6cf3d8ad714d (patch)
tree00c0f58550ba4661e87376f2f02c8001c69bae44 /repo/system/musl
parent871b2b573f01c1b3176a0f65458b3d281b41c437 (diff)
removed idea of repos
Diffstat (limited to 'repo/system/musl')
-rw-r--r--repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch24
-rw-r--r--repo/system/musl/change-scheduler-functions-Linux-compatib.patch52
-rw-r--r--repo/system/musl/fix-utmp-wtmp-paths.patch29
-rw-r--r--repo/system/musl/handle-aux-at_base.patch46
-rw-r--r--repo/system/musl/musl.xibuild54
-rw-r--r--repo/system/musl/qsort_r.patch213
-rw-r--r--repo/system/musl/syscall-cp-epoll.patch16
-rw-r--r--repo/system/musl/toolchain-musl.xibuild27
8 files changed, 0 insertions, 461 deletions
diff --git a/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch b/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch
deleted file mode 100644
index b2f0a0f..0000000
--- a/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From e5d2823631bbfebacf48e1a34ed28f28d7cb2570 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 11 Jan 2021 09:40:33 -0800
-Subject: [PATCH] riscv64: define ELF_NFPREG
-
-ELF_NFPREG is used by some userspace applications like gdb
----
- arch/riscv64/bits/user.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
-index 2da743ea..0d37de0b 100644
---- a/arch/riscv64/bits/user.h
-+++ b/arch/riscv64/bits/user.h
-@@ -1,5 +1,6 @@
- #include <signal.h>
-
- #define ELF_NGREG 32
-+#define ELF_NFPREG 33
- typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
- typedef union __riscv_mc_fp_state elf_fpregset_t;
---
-2.30.1
-
diff --git a/repo/system/musl/change-scheduler-functions-Linux-compatib.patch b/repo/system/musl/change-scheduler-functions-Linux-compatib.patch
deleted file mode 100644
index fb63dfd..0000000
--- a/repo/system/musl/change-scheduler-functions-Linux-compatib.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff -uNr musl-1.2.2.orig/src/sched/sched_getparam.c musl-1.2.2/src/sched/sched_getparam.c
---- musl-1.2.2.orig/src/sched/sched_getparam.c 2021-01-15 02:26:00.000000000 +0000
-+++ musl-1.2.2/src/sched/sched_getparam.c 2021-12-23 00:31:16.590518270 +0000
-@@ -1,8 +1,7 @@
- #include <sched.h>
--#include <errno.h>
- #include "syscall.h"
-
- int sched_getparam(pid_t pid, struct sched_param *param)
- {
-- return __syscall_ret(-ENOSYS);
-+ return syscall(SYS_sched_getparam, pid, param);
- }
-diff -uNr musl-1.2.2.orig/src/sched/sched_getscheduler.c musl-1.2.2/src/sched/sched_getscheduler.c
---- musl-1.2.2.orig/src/sched/sched_getscheduler.c 2021-01-15 02:26:00.000000000 +0000
-+++ musl-1.2.2/src/sched/sched_getscheduler.c 2021-12-23 00:33:32.949520644 +0000
-@@ -1,8 +1,7 @@
- #include <sched.h>
--#include <errno.h>
- #include "syscall.h"
-
- int sched_getscheduler(pid_t pid)
- {
-- return __syscall_ret(-ENOSYS);
-+ return syscall(SYS_sched_getscheduler, pid);
- }
-diff -uNr musl-1.2.2.orig/src/sched/sched_setparam.c musl-1.2.2/src/sched/sched_setparam.c
---- musl-1.2.2.orig/src/sched/sched_setparam.c 2021-01-15 02:26:00.000000000 +0000
-+++ musl-1.2.2/src/sched/sched_setparam.c 2021-12-23 00:35:12.277522374 +0000
-@@ -1,8 +1,7 @@
- #include <sched.h>
--#include <errno.h>
- #include "syscall.h"
-
- int sched_setparam(pid_t pid, const struct sched_param *param)
- {
-- return __syscall_ret(-ENOSYS);
-+ return syscall(SYS_sched_setparam, pid, param);
- }
-diff -uNr musl-1.2.2.orig/src/sched/sched_setscheduler.c musl-1.2.2/src/sched/sched_setscheduler.c
---- musl-1.2.2.orig/src/sched/sched_setscheduler.c 2021-01-15 02:26:00.000000000 +0000
-+++ musl-1.2.2/src/sched/sched_setscheduler.c 2021-12-23 00:36:37.548523859 +0000
-@@ -1,8 +1,7 @@
- #include <sched.h>
--#include <errno.h>
- #include "syscall.h"
-
- int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
- {
-- return __syscall_ret(-ENOSYS);
-+ return syscall(SYS_sched_setscheduler, pid, sched, param);
- }
diff --git a/repo/system/musl/fix-utmp-wtmp-paths.patch b/repo/system/musl/fix-utmp-wtmp-paths.patch
deleted file mode 100644
index 900abc7..0000000
--- a/repo/system/musl/fix-utmp-wtmp-paths.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -uNr musl-1.2.2.orig/include/paths.h musl-1.2.2/include/paths.h
---- musl-1.2.2.orig/include/paths.h 2021-01-14 20:26:00.000000000 -0600
-+++ musl-1.2.2/include/paths.h 2021-08-26 16:39:31.355618388 -0500
-@@ -18,9 +18,9 @@
- #define _PATH_SHADOW "/etc/shadow"
- #define _PATH_SHELLS "/etc/shells"
- #define _PATH_TTY "/dev/tty"
--#define _PATH_UTMP "/dev/null/utmp"
-+#define _PATH_UTMP "/run/utmps/utmp"
- #define _PATH_VI "/usr/bin/vi"
--#define _PATH_WTMP "/dev/null/wtmp"
-+#define _PATH_WTMP "/var/log/wtmp"
-
- #define _PATH_DEV "/dev/"
- #define _PATH_TMP "/tmp/"
-diff -uNr musl-1.2.2.orig/include/utmp.h musl-1.2.2/include/utmp.h
---- musl-1.2.2.orig/include/utmp.h 2021-01-14 20:26:00.000000000 -0600
-+++ musl-1.2.2/include/utmp.h 2021-08-26 16:37:11.567365982 -0500
-@@ -37,8 +37,8 @@
-
- int login_tty(int);
-
--#define _PATH_UTMP "/dev/null/utmp"
--#define _PATH_WTMP "/dev/null/wtmp"
-+#define _PATH_UTMP "/run/utmps/utmp"
-+#define _PATH_WTMP "/var/log/wtmp"
-
- #define UTMP_FILE _PATH_UTMP
- #define WTMP_FILE _PATH_WTMP
diff --git a/repo/system/musl/handle-aux-at_base.patch b/repo/system/musl/handle-aux-at_base.patch
deleted file mode 100644
index 7c9f2dc..0000000
--- a/repo/system/musl/handle-aux-at_base.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-This is required to make the gcompat ELF interpreter stub work with some
-packed binaries.
-
-diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
-index b125eb1..616c6a6 100644
---- a/src/env/__init_tls.c
-+++ b/src/env/__init_tls.c
-@@ -66,8 +66,10 @@ void *__copy_tls(unsigned char *mem)
- }
-
- #if ULONG_MAX == 0xffffffff
-+typedef Elf32_Ehdr Ehdr;
- typedef Elf32_Phdr Phdr;
- #else
-+typedef Elf64_Ehdr Ehdr;
- typedef Elf64_Phdr Phdr;
- #endif
-
-@@ -77,15 +79,23 @@ extern const size_t _DYNAMIC[];
- static void static_init_tls(size_t *aux)
- {
- unsigned char *p;
-- size_t n;
-+ size_t n, e;
- Phdr *phdr, *tls_phdr=0;
- size_t base = 0;
- void *mem;
-
-- for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
-+ if (aux[AT_BASE]) {
-+ Ehdr *ehdr = (void *)aux[AT_BASE];
-+ p = (unsigned char *)aux[AT_BASE] + ehdr->e_phoff;
-+ n = ehdr->e_phnum;
-+ e = ehdr->e_phentsize;
-+ } else {
-+ p = (void *)aux[AT_PHDR];
-+ n = aux[AT_PHNUM];
-+ e = aux[AT_PHENT];
-+ }
-+ for (; n; n--, p+=e) {
- phdr = (void *)p;
-- if (phdr->p_type == PT_PHDR)
-- base = aux[AT_PHDR] - phdr->p_vaddr;
- if (phdr->p_type == PT_DYNAMIC && _DYNAMIC)
- base = (size_t)_DYNAMIC - phdr->p_vaddr;
- if (phdr->p_type == PT_TLS)
diff --git a/repo/system/musl/musl.xibuild b/repo/system/musl/musl.xibuild
deleted file mode 100644
index 6f15382..0000000
--- a/repo/system/musl/musl.xibuild
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-
-MAKEDEPS=""
-DEPS=""
-
-PKG_VER=1.2.3
-SOURCE=https://musl.libc.org/releases/musl-$PKG_VER.tar.gz
-
-ADDITIONAL="
-0001-riscv64-define-ELF_NFPREG.patch
-change-scheduler-functions-Linux-compatib.patch
-fix-utmp-wtmp-paths.patch
-handle-aux-at_base.patch
-qsort_r.patch
-syscall-cp-epoll.patch
-"
-
-DESC="Implementation of the C standard library built on top of the Linux system call API"
-
-prepare () {
- for p in *.patch; do
- patch -Np1 -i $p || true
- done
-}
-
-build () {
- CARCH=x86_64
- LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \
-./configure --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --disable-gcc-wrapper
- make
-}
-
-package () {
- make DESTDIR=$PKG_DEST install &&
-
- install -d $PKG_DEST/etc
- install -d $PKG_DEST/bin
- install -d $PKG_DEST/lib
-
- ln -s /lib/ld-musl-x86_64.so.1 $PKG_DEST/bin/ldd
- ln -s libc.so $PKG_DEST/usr/lib/libc.musl-x86_64.so.1
-
- cat > $PKG_DEST/etc/ld-musl-x86_64.path << "EOF"
-/lib
-/usr/local/lib
-/usr/lib
-EOF
-
- rm $PKG_DEST/usr/include/utmpx.h
-}
-
diff --git a/repo/system/musl/qsort_r.patch b/repo/system/musl/qsort_r.patch
deleted file mode 100644
index 4ea6366..0000000
--- a/repo/system/musl/qsort_r.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-Date: Tue, 9 Mar 2021 18:02:13 -0300
-From: Érico Nogueira <ericonr@...root.org>
-To: musl@...ts.openwall.com
-Cc: Érico Nogueira <ericonr@...root.org>
-Subject: [PATCH v3] add qsort_r and make qsort a wrapper around it
-
-we make qsort a wrapper by providing a wrapper_cmp function that uses
-the extra argument as a function pointer. should be optimized to a tail
-call on most architectures, as long as it's built with
--fomit-frame-pointer, so the performance impact should be minimal.
-
-to keep the git history clean, for now qsort_r is implemented in qsort.c
-and qsort is implemented in qsort_nr.c. qsort.c also received a few
-trivial cleanups, including replacing (*cmp)() calls with cmp().
-qsort_nr.c contains only wrapper_cmp and qsort as a qsort_r wrapper
-itself.
----
-
-Following suggestions from IRC, as few changes as possible to the files,
-a final clean up commit after this one would involve some git mv's (I
-won't make a patch for it). Added weak_alias to force qsort to use
-libc's qsort_r.
-
-If this can't be accepted due to the overhead on some archs (ppc, mips,
-arm in some situations?), maybe we could revisit v2 of the patch?
-
- include/stdlib.h | 1 +
- src/include/stdlib.h | 1 +
- src/stdlib/qsort.c | 37 ++++++++++++++++++++-----------------
- src/stdlib/qsort_nr.c | 14 ++++++++++++++
- 4 files changed, 36 insertions(+), 17 deletions(-)
- create mode 100644 src/stdlib/qsort_nr.c
-
-diff --git a/include/stdlib.h b/include/stdlib.h
-index b54a051f..0c0ced5f 100644
---- a/include/stdlib.h
-+++ b/include/stdlib.h
-@@ -158,6 +158,7 @@ struct __locale_struct;
- float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
- double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
- long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
-+void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
- #endif
-
- #if defined(_LARGEFILE64_SOURCE) || defined(_BSD_SOURCE)
-diff --git a/src/include/stdlib.h b/src/include/stdlib.h
-index e9da2015..812b04de 100644
---- a/src/include/stdlib.h
-+++ b/src/include/stdlib.h
-@@ -8,6 +8,7 @@ hidden void __env_rm_add(char *, char *);
- hidden int __mkostemps(char *, int, int);
- hidden int __ptsname_r(int, char *, size_t);
- hidden char *__randname(char *);
-+hidden void __qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
-
- hidden void *__libc_malloc(size_t);
- hidden void *__libc_malloc_impl(size_t);
-diff --git a/src/stdlib/qsort.c b/src/stdlib/qsort.c
-index da58fd31..20e40dda 100644
---- a/src/stdlib/qsort.c
-+++ b/src/stdlib/qsort.c
-@@ -24,6 +24,7 @@
- /* Smoothsort, an adaptive variant of Heapsort. Memory usage: O(1).
- Run time: Worst case O(n log n), close to O(n) in the mostly-sorted case. */
-
-+#define _BSD_SOURCE
- #include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -31,7 +32,7 @@
- #include "atomic.h"
- #define ntz(x) a_ctz_l((x))
-
--typedef int (*cmpfun)(const void *, const void *);
-+typedef int (*cmpfun)(const void *, const void *, void *);
-
- static inline int pntz(size_t p[2]) {
- int r = ntz(p[0] - 1);
-@@ -88,7 +89,7 @@ static inline void shr(size_t p[2], int n)
- p[1] >>= n;
- }
-
--static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size_t lp[])
-+static void sift(unsigned char *head, size_t width, cmpfun cmp, void *arg, int pshift, size_t lp[])
- {
- unsigned char *rt, *lf;
- unsigned char *ar[14 * sizeof(size_t) + 1];
-@@ -99,10 +100,10 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size
- rt = head - width;
- lf = head - width - lp[pshift - 2];
-
-- if((*cmp)(ar[0], lf) >= 0 && (*cmp)(ar[0], rt) >= 0) {
-+ if(cmp(ar[0], lf, arg) >= 0 && cmp(ar[0], rt, arg) >= 0) {
- break;
- }
-- if((*cmp)(lf, rt) >= 0) {
-+ if(cmp(lf, rt, arg) >= 0) {
- ar[i++] = lf;
- head = lf;
- pshift -= 1;
-@@ -115,7 +116,7 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size
- cycle(width, ar, i);
- }
-
--static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], int pshift, int trusty, size_t lp[])
-+static void trinkle(unsigned char *head, size_t width, cmpfun cmp, void *arg, size_t pp[2], int pshift, int trusty, size_t lp[])
- {
- unsigned char *stepson,
- *rt, *lf;
-@@ -130,13 +131,13 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2],
- ar[0] = head;
- while(p[0] != 1 || p[1] != 0) {
- stepson = head - lp[pshift];
-- if((*cmp)(stepson, ar[0]) <= 0) {
-+ if(cmp(stepson, ar[0], arg) <= 0) {
- break;
- }
- if(!trusty && pshift > 1) {
- rt = head - width;
- lf = head - width - lp[pshift - 2];
-- if((*cmp)(rt, stepson) >= 0 || (*cmp)(lf, stepson) >= 0) {
-+ if(cmp(rt, stepson, arg) >= 0 || cmp(lf, stepson, arg) >= 0) {
- break;
- }
- }
-@@ -150,11 +151,11 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2],
- }
- if(!trusty) {
- cycle(width, ar, i);
-- sift(head, width, cmp, pshift, lp);
-+ sift(head, width, cmp, arg, pshift, lp);
- }
- }
-
--void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
-+void __qsort_r(void *base, size_t nel, size_t width, cmpfun cmp, void *arg)
- {
- size_t lp[12*sizeof(size_t)];
- size_t i, size = width * nel;
-@@ -173,16 +174,16 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
-
- while(head < high) {
- if((p[0] & 3) == 3) {
-- sift(head, width, cmp, pshift, lp);
-+ sift(head, width, cmp, arg, pshift, lp);
- shr(p, 2);
- pshift += 2;
- } else {
- if(lp[pshift - 1] >= high - head) {
-- trinkle(head, width, cmp, p, pshift, 0, lp);
-+ trinkle(head, width, cmp, arg, p, pshift, 0, lp);
- } else {
-- sift(head, width, cmp, pshift, lp);
-+ sift(head, width, cmp, arg, pshift, lp);
- }
--
-+
- if(pshift == 1) {
- shl(p, 1);
- pshift = 0;
-@@ -191,12 +192,12 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
- pshift = 1;
- }
- }
--
-+
- p[0] |= 1;
- head += width;
- }
-
-- trinkle(head, width, cmp, p, pshift, 0, lp);
-+ trinkle(head, width, cmp, arg, p, pshift, 0, lp);
-
- while(pshift != 1 || p[0] != 1 || p[1] != 0) {
- if(pshift <= 1) {
-@@ -208,11 +209,13 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
- pshift -= 2;
- p[0] ^= 7;
- shr(p, 1);
-- trinkle(head - lp[pshift] - width, width, cmp, p, pshift + 1, 1, lp);
-+ trinkle(head - lp[pshift] - width, width, cmp, arg, p, pshift + 1, 1, lp);
- shl(p, 1);
- p[0] |= 1;
-- trinkle(head - width, width, cmp, p, pshift, 1, lp);
-+ trinkle(head - width, width, cmp, arg, p, pshift, 1, lp);
- }
- head -= width;
- }
- }
-+
-+weak_alias(__qsort_r, qsort_r);
-diff --git a/src/stdlib/qsort_nr.c b/src/stdlib/qsort_nr.c
-new file mode 100644
-index 00000000..fe408fb1
---- /dev/null
-+++ b/src/stdlib/qsort_nr.c
-@@ -0,0 +1,14 @@
-+#define _BSD_SOURCE
-+#include <stdlib.h>
-+
-+typedef int (*cmpfun)(const void *, const void *);
-+
-+static int wrapper_cmp(const void *v1, const void *v2, void *cmp)
-+{
-+ return ((cmpfun)cmp)(v1, v2);
-+}
-+
-+void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
-+{
-+ __qsort_r(base, nel, width, wrapper_cmp, cmp);
-+}
---
-2.30.2
diff --git a/repo/system/musl/syscall-cp-epoll.patch b/repo/system/musl/syscall-cp-epoll.patch
deleted file mode 100644
index 338620a..0000000
--- a/repo/system/musl/syscall-cp-epoll.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/src/linux/epoll.c b/src/linux/epoll.c
-index deff5b10..93baa814 100644
---- a/src/linux/epoll.c
-+++ b/src/linux/epoll.c
-@@ -24,9 +24,9 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev)
-
- int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs)
- {
-- int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
-+ int r = __syscall_cp(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
- #ifdef SYS_epoll_wait
-- if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to);
-+ if (r==-ENOSYS && !sigs) r = __syscall_cp(SYS_epoll_wait, fd, ev, cnt, to);
- #endif
- return __syscall_ret(r);
- }
diff --git a/repo/system/musl/toolchain-musl.xibuild b/repo/system/musl/toolchain-musl.xibuild
deleted file mode 100644
index 4f73171..0000000
--- a/repo/system/musl/toolchain-musl.xibuild
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-DESC="$DESC - for xibuild toolchain"
-
-build () {
- export CXX=clang++
- export CC=clang
-
- CC=$CC CXX=$CXX ./configure --prefix=/
- make
-}
-
-package () {
- make install DESTDIR=$PKG_DEST
-
- rm -v $PKG_DEST/lib/ld-musl-x86_64.so.1
- ln -sv libc.so $PKG_DEST/lib/ld-musl-x86_64.so.1
-
- mkdir $PKG_DEST/bin
- mkdir $PKG_DEST/etc
- ln -sv ../lib/libc.so $PKG_DEST/bin/ldd
-
- cat > $PKG_DEST/etc/ld-musl-x86_64.path << "EOF"
-$PKG_DEST/lib
-EOF
-
-}