Add musl 1.1.24.
This commit is contained in:
parent
9d5519ad79
commit
9ddc0bcee6
|
@ -273,5 +273,12 @@ first flex 2.5.11 is compiled, with its scanner definition manually modified so
|
||||||
it can be processed by lex for the Heirloom project (the required modifications
|
it can be processed by lex for the Heirloom project (the required modifications
|
||||||
are mostly syntactical, plus a few workarounds to avoid some flex advanced features).
|
are mostly syntactical, plus a few workarounds to avoid some flex advanced features).
|
||||||
|
|
||||||
### Part 23 flex 2.5.14
|
#### Part 23 flex 2.5.14
|
||||||
Then we recompile unpatched `flex` using its own lexer.
|
Then we recompile unpatched `flex` using its own lexer.
|
||||||
|
|
||||||
|
#### Part 24 musl 1.1.24
|
||||||
|
|
||||||
|
`musl` is a C standard library that is lightweight, fast, simple, free, and strives to be correct
|
||||||
|
in the sense of standards-conformance and safety. `musl` is used by some distributions of GNU/Linux
|
||||||
|
as their C library. Our previous Mes C library was incomplete which prevented us from building many
|
||||||
|
newer or more complex programs.
|
||||||
|
|
|
@ -139,6 +139,9 @@ get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.
|
||||||
# flex 2.5.14
|
# flex 2.5.14
|
||||||
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.14.tar.gz
|
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.14.tar.gz
|
||||||
|
|
||||||
|
# musl 1.1.24
|
||||||
|
get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz
|
||||||
|
|
||||||
# General cleanup
|
# General cleanup
|
||||||
find tmp -name .git -exec rm -rf \;
|
find tmp -name .git -exec rm -rf \;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
src_prepare() {
|
||||||
|
default_src_prepare
|
||||||
|
|
||||||
|
# tcc does not support complex types
|
||||||
|
rm -rf src/complex
|
||||||
|
|
||||||
|
# Configure fails without this
|
||||||
|
mkdir -p /dev
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
CC=tcc ./configure \
|
||||||
|
--host=i386 \
|
||||||
|
--disable-shared \
|
||||||
|
--prefix=/after \
|
||||||
|
--libdir=/after/lib/musl/ \
|
||||||
|
--includedir=/after/include/musl
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
make CROSS_COMPILE= AR="tcc -ar" RANLIB=true CFLAGS="-DSYSCALL_NO_TLS"
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
tcc does not seem to support stmxcsr and ldmxcsr.
|
||||||
|
Remove those. This migt break float exception handling but we
|
||||||
|
are unlikely to need it.
|
||||||
|
diff -U3 -r src/fenv/i386/fenv.s src/fenv/i386/fenv.s
|
||||||
|
--- src/fenv/i386/fenv.s 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/fenv/i386/fenv.s 2021-02-01 00:27:04.924135707 +0000
|
||||||
|
@@ -17,7 +17,6 @@
|
||||||
|
jz 1f
|
||||||
|
fnclex
|
||||||
|
1: push %edx
|
||||||
|
- stmxcsr (%esp)
|
||||||
|
pop %edx
|
||||||
|
and $0x3f,%eax
|
||||||
|
or %eax,%edx
|
||||||
|
@@ -26,7 +25,6 @@
|
||||||
|
not %ecx
|
||||||
|
and %ecx,%edx
|
||||||
|
push %edx
|
||||||
|
- ldmxcsr (%esp)
|
||||||
|
pop %edx
|
||||||
|
1: xor %eax,%eax
|
||||||
|
ret
|
||||||
|
@@ -77,11 +75,9 @@
|
||||||
|
pop %edx
|
||||||
|
testl $0x02000000,(%edx)
|
||||||
|
jz 1f
|
||||||
|
- stmxcsr (%esp)
|
||||||
|
shl $3,%ch
|
||||||
|
andb $0x9f,1(%esp)
|
||||||
|
or %ch,1(%esp)
|
||||||
|
- ldmxcsr (%esp)
|
||||||
|
1: pop %ecx
|
||||||
|
ret
|
||||||
|
|
||||||
|
@@ -107,7 +103,6 @@
|
||||||
|
testl $0x02000000,(%edx)
|
||||||
|
jz 1f
|
||||||
|
push %eax
|
||||||
|
- stmxcsr (%esp)
|
||||||
|
pop %edx
|
||||||
|
and $0x3f,%edx
|
||||||
|
or %edx,4(%ecx)
|
||||||
|
@@ -143,7 +138,6 @@
|
||||||
|
shl $3,%ecx
|
||||||
|
or $0x1f80,%ecx
|
||||||
|
mov %ecx,4(%esp)
|
||||||
|
- ldmxcsr 4(%esp)
|
||||||
|
1: ret
|
||||||
|
|
||||||
|
.global fetestexcept
|
||||||
|
@@ -158,7 +152,6 @@
|
||||||
|
pop %edx
|
||||||
|
testl $0x02000000,(%edx)
|
||||||
|
jz 1f
|
||||||
|
- stmxcsr 4(%esp)
|
||||||
|
or 4(%esp),%eax
|
||||||
|
1: and %ecx,%eax
|
||||||
|
ret
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- Makefile 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ Makefile 2021-02-01 00:21:14.974687663 +0000
|
||||||
|
@@ -167,7 +167,7 @@
|
||||||
|
|
||||||
|
$(EMPTY_LIBS):
|
||||||
|
rm -f $@
|
||||||
|
- $(AR) rc $@
|
||||||
|
+ touch $@
|
||||||
|
|
||||||
|
lib/%.o: obj/crt/$(ARCH)/%.o
|
||||||
|
cp $< $@
|
|
@ -0,0 +1,12 @@
|
||||||
|
Replace weak symbols with strong to workaround an issue with tcc -ar
|
||||||
|
This won't be necessary once we can rebuild with ar from binutils.
|
||||||
|
--- src/include/features.h 2021-02-02 23:15:42.791932948 +0000
|
||||||
|
+++ src/include/features.h 2021-02-02 23:17:21.394647015 +0000
|
||||||
|
@@ -6,6 +6,6 @@
|
||||||
|
#define weak __attribute__((__weak__))
|
||||||
|
#define hidden __attribute__((__visibility__("hidden")))
|
||||||
|
#define weak_alias(old, new) \
|
||||||
|
- extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
|
||||||
|
+ extern __typeof(old) new __attribute__((/*__weak__, */__alias__(#old)))
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,31 @@
|
||||||
|
From 0b0640219338b80cf47026d1970b5503414ed7f3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rich Felker <dalias@aerifal.cx>
|
||||||
|
Date: Sun, 30 Aug 2020 21:37:12 -0400
|
||||||
|
Subject: fix i386 __set_thread_area fallback
|
||||||
|
|
||||||
|
this code is only needed for pre-2.6 kernels, which are not actually
|
||||||
|
supported anyway, and was never tested. the fallback path using
|
||||||
|
SYS_modify_ldt failed to clear the upper bits of %eax (all ones due to
|
||||||
|
SYS_set_thread_area's return value being an error) before modifying
|
||||||
|
%al to attempt a new syscall.
|
||||||
|
---
|
||||||
|
src/thread/i386/__set_thread_area.s | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
(limited to 'src/thread/i386/__set_thread_area.s')
|
||||||
|
|
||||||
|
diff --git src/thread/i386/__set_thread_area.s src/thread/i386/__set_thread_area.s
|
||||||
|
index c2c21dd5..aa6852be 100644
|
||||||
|
--- src/thread/i386/__set_thread_area.s
|
||||||
|
+++ src/thread/i386/__set_thread_area.s
|
||||||
|
@@ -28,6 +28,7 @@ __set_thread_area:
|
||||||
|
ret
|
||||||
|
2:
|
||||||
|
mov %ebx,%ecx
|
||||||
|
+ xor %eax,%eax
|
||||||
|
xor %ebx,%ebx
|
||||||
|
xor %edx,%edx
|
||||||
|
mov %ebx,(%esp)
|
||||||
|
--
|
||||||
|
cgit v1.2.1
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
tcc does not like jecxz instruction.
|
||||||
|
--- src/signal/i386/sigsetjmp.s 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/signal/i386/sigsetjmp.s 2021-02-01 00:19:25.671735415 +0000
|
||||||
|
@@ -5,7 +5,8 @@
|
||||||
|
sigsetjmp:
|
||||||
|
__sigsetjmp:
|
||||||
|
mov 8(%esp),%ecx
|
||||||
|
- jecxz 1f
|
||||||
|
+ cmp %ecx,0
|
||||||
|
+ je 1f
|
||||||
|
|
||||||
|
mov 4(%esp),%eax
|
||||||
|
popl 24(%eax)
|
|
@ -0,0 +1,106 @@
|
||||||
|
diff -U3 -r src/internal/syscall.h src/internal/syscall.h
|
||||||
|
--- src/internal/syscall.h 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/internal/syscall.h 2021-02-01 00:24:02.099200492 +0000
|
||||||
|
@@ -331,7 +331,7 @@
|
||||||
|
#define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__)
|
||||||
|
#define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
|
||||||
|
|
||||||
|
-hidden void __procfdname(char __buf[static 15+3*sizeof(int)], unsigned);
|
||||||
|
+hidden void __procfdname(char __buf[15+3*sizeof(int)], unsigned);
|
||||||
|
|
||||||
|
hidden void *__vdsosym(const char *, const char *);
|
||||||
|
|
||||||
|
diff -U3 -r src/network/lookup.h src/network/lookup.h
|
||||||
|
--- src/network/lookup.h 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/network/lookup.h 2021-02-01 00:27:42.695155110 +0000
|
||||||
|
@@ -43,9 +43,9 @@
|
||||||
|
#define MAXADDRS 48
|
||||||
|
#define MAXSERVS 2
|
||||||
|
|
||||||
|
-hidden int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int socktype, int flags);
|
||||||
|
-hidden int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, int flags);
|
||||||
|
-hidden int __lookup_ipliteral(struct address buf[static 1], const char *name, int family);
|
||||||
|
+hidden int __lookup_serv(struct service buf[MAXSERVS], const char *name, int proto, int socktype, int flags);
|
||||||
|
+hidden int __lookup_name(struct address buf[MAXADDRS], char canon[256], const char *name, int family, int flags);
|
||||||
|
+hidden int __lookup_ipliteral(struct address buf[1], const char *name, int family);
|
||||||
|
|
||||||
|
hidden int __get_resolv_conf(struct resolvconf *, char *, size_t);
|
||||||
|
hidden int __res_msend_rc(int, const unsigned char *const *, const int *, unsigned char *const *, int *, int, const struct resolvconf *);
|
||||||
|
diff -U3 -r src/network/lookup_ipliteral.c src/network/lookup_ipliteral.c
|
||||||
|
--- src/network/lookup_ipliteral.c 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/network/lookup_ipliteral.c 2021-02-01 00:27:59.955620933 +0000
|
||||||
|
@@ -9,7 +9,7 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "lookup.h"
|
||||||
|
|
||||||
|
-int __lookup_ipliteral(struct address buf[static 1], const char *name, int family)
|
||||||
|
+int __lookup_ipliteral(struct address buf[1], const char *name, int family)
|
||||||
|
{
|
||||||
|
struct in_addr a4;
|
||||||
|
struct in6_addr a6;
|
||||||
|
diff -U3 -r src/network/lookup_name.c src/network/lookup_name.c
|
||||||
|
--- src/network/lookup_name.c 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/network/lookup_name.c 2021-02-01 00:28:56.117136509 +0000
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
return !*s;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int name_from_null(struct address buf[static 2], const char *name, int family, int flags)
|
||||||
|
+static int name_from_null(struct address buf[2], const char *name, int family, int flags)
|
||||||
|
{
|
||||||
|
int cnt = 0;
|
||||||
|
if (name) return 0;
|
||||||
|
@@ -41,12 +41,12 @@
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int name_from_numeric(struct address buf[static 1], const char *name, int family)
|
||||||
|
+static int name_from_numeric(struct address buf[1], const char *name, int family)
|
||||||
|
{
|
||||||
|
return __lookup_ipliteral(buf, name, family);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int name_from_hosts(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family)
|
||||||
|
+static int name_from_hosts(struct address buf[MAXADDRS], char canon[256], const char *name, int family)
|
||||||
|
{
|
||||||
|
char line[512];
|
||||||
|
size_t l = strlen(name);
|
||||||
|
@@ -130,7 +130,7 @@
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int name_from_dns(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, const struct resolvconf *conf)
|
||||||
|
+static int name_from_dns(struct address buf[MAXADDRS], char canon[256], const char *name, int family, const struct resolvconf *conf)
|
||||||
|
{
|
||||||
|
unsigned char qbuf[2][280], abuf[2][512];
|
||||||
|
const unsigned char *qp[2] = { qbuf[0], qbuf[1] };
|
||||||
|
@@ -166,7 +166,7 @@
|
||||||
|
return EAI_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int name_from_dns_search(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family)
|
||||||
|
+static int name_from_dns_search(struct address buf[MAXADDRS], char canon[256], const char *name, int family)
|
||||||
|
{
|
||||||
|
char search[256];
|
||||||
|
struct resolvconf conf;
|
||||||
|
@@ -284,7 +284,7 @@
|
||||||
|
return b->sortkey - a->sortkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int __lookup_name(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, int flags)
|
||||||
|
+int __lookup_name(struct address buf[MAXADDRS], char canon[256], const char *name, int family, int flags)
|
||||||
|
{
|
||||||
|
int cnt = 0, i, j;
|
||||||
|
|
||||||
|
diff -U3 -r src/network/lookup_serv.c src/network/lookup_serv.c
|
||||||
|
--- src/network/lookup_serv.c 2019-10-13 22:58:27.000000000 +0100
|
||||||
|
+++ src/network/lookup_serv.c 2021-02-01 00:29:10.357520778 +0000
|
||||||
|
@@ -9,7 +9,7 @@
|
||||||
|
#include "lookup.h"
|
||||||
|
#include "stdio_impl.h"
|
||||||
|
|
||||||
|
-int __lookup_serv(struct service buf[static MAXSERVS], const char *name, int proto, int socktype, int flags)
|
||||||
|
+int __lookup_serv(struct service buf[MAXSERVS], const char *name, int proto, int socktype, int flags)
|
||||||
|
{
|
||||||
|
char line[128];
|
||||||
|
int cnt = 0;
|
|
@ -0,0 +1,37 @@
|
||||||
|
From 1642f5982009e110615a29745f9cafd51a5c1597 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Giovanni Mascellani <gio@debian.org>
|
||||||
|
Date: Tue, 11 Jun 2019 11:20:07 +0200
|
||||||
|
Subject: [PATCH] stdarg.h: add support for tcc.
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/i386/bits/alltypes.h.in | 14 +++++++++++++-
|
||||||
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in
|
||||||
|
index 1a8432d3..44cb5987 100644
|
||||||
|
--- arch/i386/bits/alltypes.h.in
|
||||||
|
+++ arch/i386/bits/alltypes.h.in
|
||||||
|
@@ -2,7 +2,19 @@
|
||||||
|
#define _Int64 long long
|
||||||
|
#define _Reg int
|
||||||
|
|
||||||
|
-#if __GNUC__ >= 3
|
||||||
|
+#ifdef __TINYC__
|
||||||
|
+typedef char *__builtin_va_list;
|
||||||
|
+#define __builtin_va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
|
||||||
|
+#define __builtin_va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
|
||||||
|
+#define __builtin_va_copy(dest, src) (dest) = (src)
|
||||||
|
+#define __builtin_va_end(ap)
|
||||||
|
+#ifndef __TINYC_redefine_va_list
|
||||||
|
+#define __TINYC_redefine_va_list
|
||||||
|
+#undef __DEFINED_va_list
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#if __GNUC__ >= 3 || defined(__TINYC__)
|
||||||
|
TYPEDEF __builtin_va_list va_list;
|
||||||
|
TYPEDEF __builtin_va_list __isoc_va_list;
|
||||||
|
#else
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
|
@ -18,4 +18,7 @@ build flex-2.5.11
|
||||||
# Part 23
|
# Part 23
|
||||||
build flex-2.5.14
|
build flex-2.5.14
|
||||||
|
|
||||||
|
# Part 24
|
||||||
|
build musl-1.1.24
|
||||||
|
|
||||||
echo "Bootstrapping completed."
|
echo "Bootstrapping completed."
|
||||||
|
|
Loading…
Reference in New Issue