Initial commit
This commit is contained in:
11
toolchain/musl/patches/100-add_glob_onlydir.patch
Normal file
11
toolchain/musl/patches/100-add_glob_onlydir.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/include/glob.h
|
||||
+++ b/include/glob.h
|
||||
@@ -34,6 +34,8 @@ void globfree(glob_t *);
|
||||
#define GLOB_TILDE 0x1000
|
||||
#define GLOB_TILDE_CHECK 0x4000
|
||||
|
||||
+#define GLOB_ONLYDIR 0x100
|
||||
+
|
||||
#define GLOB_NOSPACE 1
|
||||
#define GLOB_ABORTED 2
|
||||
#define GLOB_NOMATCH 3
|
||||
28
toolchain/musl/patches/110-read_timezone_from_fs.patch
Normal file
28
toolchain/musl/patches/110-read_timezone_from_fs.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
--- a/src/time/__tz.c
|
||||
+++ b/src/time/__tz.c
|
||||
@@ -25,6 +25,9 @@ static int r0[5], r1[5];
|
||||
static const unsigned char *zi, *trans, *index, *types, *abbrevs, *abbrevs_end;
|
||||
static size_t map_size;
|
||||
|
||||
+static const char *tzfile;
|
||||
+static size_t tzfile_size;
|
||||
+
|
||||
static char old_tz_buf[32];
|
||||
static char *old_tz = old_tz_buf;
|
||||
static size_t old_tz_size = sizeof old_tz_buf;
|
||||
@@ -125,6 +128,15 @@ static void do_tzset()
|
||||
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
|
||||
|
||||
s = getenv("TZ");
|
||||
+
|
||||
+ /* if TZ is empty try to read it from /etc/TZ */
|
||||
+ if (!s || !*s) {
|
||||
+ if (tzfile)
|
||||
+ __munmap((void*)tzfile, tzfile_size);
|
||||
+
|
||||
+ s = tzfile = (void *)__map_file("/etc/TZ", &tzfile_size);
|
||||
+ }
|
||||
+
|
||||
if (!s) s = "/etc/localtime";
|
||||
if (!*s) s = __utc;
|
||||
|
||||
53
toolchain/musl/patches/200-add_libssp_nonshared.patch
Normal file
53
toolchain/musl/patches/200-add_libssp_nonshared.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 7ec87fbbc3cac99b4173d082dd6195f47c9a32e7 Mon Sep 17 00:00:00 2001
|
||||
From: Steven Barth <steven@midlink.org>
|
||||
Date: Mon, 22 Jun 2015 11:01:56 +0200
|
||||
Subject: [PATCH] Add libssp_nonshared.a so GCC's is not needed
|
||||
|
||||
Signed-off-by: Steven Barth <steven@midlink.org>
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -66,7 +66,7 @@ CRT_LIBS = $(addprefix lib/,$(notdir $(C
|
||||
STATIC_LIBS = lib/libc.a
|
||||
SHARED_LIBS = lib/libc.so
|
||||
TOOL_LIBS = lib/musl-gcc.specs
|
||||
-ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
|
||||
+ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) lib/libssp_nonshared.a
|
||||
ALL_TOOLS = obj/musl-gcc
|
||||
|
||||
WRAPCC_GCC = gcc
|
||||
@@ -86,7 +86,7 @@ else
|
||||
|
||||
all: $(ALL_LIBS) $(ALL_TOOLS)
|
||||
|
||||
-OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include)
|
||||
+OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(GENH) $(GENH_INT))) obj/include obj/libssp_nonshared)
|
||||
|
||||
$(ALL_LIBS) $(ALL_TOOLS) $(ALL_OBJS) $(ALL_OBJS:%.o=%.lo) $(GENH) $(GENH_INT): | $(OBJ_DIRS)
|
||||
|
||||
@@ -113,6 +113,8 @@ obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.
|
||||
|
||||
obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
|
||||
|
||||
+obj/libssp_nonshared/__stack_chk_fail_local.o: CFLAGS_ALL += $(CFLAGS_NOSSP)
|
||||
+
|
||||
OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
|
||||
$(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
|
||||
|
||||
@@ -165,6 +167,11 @@ lib/libc.a: $(AOBJS)
|
||||
$(AR) rc $@ $(AOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
+lib/libssp_nonshared.a: obj/libssp_nonshared/__stack_chk_fail_local.o
|
||||
+ rm -f $@
|
||||
+ $(AR) rc $@ $<
|
||||
+ $(RANLIB) $@
|
||||
+
|
||||
$(EMPTY_LIBS):
|
||||
rm -f $@
|
||||
$(AR) rc $@
|
||||
--- /dev/null
|
||||
+++ b/libssp_nonshared/__stack_chk_fail_local.c
|
||||
@@ -0,0 +1,2 @@
|
||||
+#include "atomic.h"
|
||||
+void __attribute__((visibility ("hidden"))) __stack_chk_fail_local(void) { a_crash(); }
|
||||
11
toolchain/musl/patches/300-relative.patch
Normal file
11
toolchain/musl/patches/300-relative.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -215,7 +215,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
|
||||
$(INSTALL) -D -m 644 $< $@
|
||||
|
||||
$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
|
||||
- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
|
||||
+ $(INSTALL) -D -l libc.so $@ || true
|
||||
|
||||
install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
From e6683d001a95d7c3d4d992496f00f77e01fcd268 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Sun, 22 Nov 2015 15:04:23 +0100
|
||||
Subject: [PATCH v2] Add format attribute to some function declarations
|
||||
|
||||
GCC and Clang are able to check the format arguments given to a
|
||||
function and warn the user if there is a error in the format arguments
|
||||
or if there is a potential uncontrolled format string security problem
|
||||
in the code. GCC does this automatically for some functions like
|
||||
printf(), but it is also possible to annotate other functions in a way
|
||||
that it will check them too. This feature is used by glibc for many
|
||||
functions. This patch adds the attribute to the some functions of musl
|
||||
expect for these functions where gcc automatically adds it.
|
||||
|
||||
GCC automatically adds checks for these functions: printf, fprintf,
|
||||
sprintf, scanf, fscanf, sscanf, strftime, vprintf, vfprintf and
|
||||
vsprintf.
|
||||
|
||||
The documentation from gcc is here:
|
||||
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
|
||||
|
||||
The documentation from Clang is here:
|
||||
http://clang.llvm.org/docs/AttributeReference.html#format-gnu-format
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
---
|
||||
include/err.h | 26 +++++++++++++++++---------
|
||||
include/monetary.h | 12 ++++++++++--
|
||||
include/stdio.h | 29 ++++++++++++++++++++---------
|
||||
include/syslog.h | 12 ++++++++++--
|
||||
4 files changed, 57 insertions(+), 22 deletions(-)
|
||||
|
||||
--- a/include/err.h
|
||||
+++ b/include/err.h
|
||||
@@ -8,15 +8,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
-void warn(const char *, ...);
|
||||
-void vwarn(const char *, va_list);
|
||||
-void warnx(const char *, ...);
|
||||
-void vwarnx(const char *, va_list);
|
||||
+#if __GNUC__ >= 3
|
||||
+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
|
||||
+#else
|
||||
+#define __fp(x, y)
|
||||
+#endif
|
||||
+
|
||||
+void warn(const char *, ...) __fp(1, 2);
|
||||
+void vwarn(const char *, va_list) __fp(1, 0);
|
||||
+void warnx(const char *, ...) __fp(1, 2);
|
||||
+void vwarnx(const char *, va_list) __fp(1, 0);
|
||||
+
|
||||
+_Noreturn void err(int, const char *, ...) __fp(2, 3);
|
||||
+_Noreturn void verr(int, const char *, va_list) __fp(2, 0);
|
||||
+_Noreturn void errx(int, const char *, ...) __fp(2, 3);
|
||||
+_Noreturn void verrx(int, const char *, va_list) __fp(2, 0);
|
||||
|
||||
-_Noreturn void err(int, const char *, ...);
|
||||
-_Noreturn void verr(int, const char *, va_list);
|
||||
-_Noreturn void errx(int, const char *, ...);
|
||||
-_Noreturn void verrx(int, const char *, va_list);
|
||||
+#undef __fp
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--- a/include/monetary.h
|
||||
+++ b/include/monetary.h
|
||||
@@ -13,8 +13,16 @@ extern "C" {
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
-ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...);
|
||||
-ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...);
|
||||
+#if __GNUC__ >= 3
|
||||
+#define __fsfm(x, y) __attribute__ ((__format__ (__strfmon__, x, y)))
|
||||
+#else
|
||||
+#define __fsfm(x, y)
|
||||
+#endif
|
||||
+
|
||||
+ssize_t strfmon(char *__restrict, size_t, const char *__restrict, ...) __fsfm(3, 4);
|
||||
+ssize_t strfmon_l(char *__restrict, size_t, locale_t, const char *__restrict, ...) __fsfm(4, 5);
|
||||
+
|
||||
+#undef __fsfm
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
--- a/include/stdio.h
|
||||
+++ b/include/stdio.h
|
||||
@@ -25,6 +25,14 @@ extern "C" {
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
+#if __GNUC__ >= 3
|
||||
+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
|
||||
+#define __fs(x, y) __attribute__ ((__format__ (__scanf__, x, y)))
|
||||
+#else
|
||||
+#define __fp(x, y)
|
||||
+#define __fs(x, y)
|
||||
+#endif
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0L
|
||||
#else
|
||||
@@ -107,19 +115,19 @@ int puts(const char *);
|
||||
int printf(const char *__restrict, ...);
|
||||
int fprintf(FILE *__restrict, const char *__restrict, ...);
|
||||
int sprintf(char *__restrict, const char *__restrict, ...);
|
||||
-int snprintf(char *__restrict, size_t, const char *__restrict, ...);
|
||||
+int snprintf(char *__restrict, size_t, const char *__restrict, ...) __fp(3, 4);
|
||||
|
||||
int vprintf(const char *__restrict, __isoc_va_list);
|
||||
int vfprintf(FILE *__restrict, const char *__restrict, __isoc_va_list);
|
||||
int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
|
||||
-int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list);
|
||||
+int vsnprintf(char *__restrict, size_t, const char *__restrict, __isoc_va_list) __fp(3, 0);
|
||||
|
||||
int scanf(const char *__restrict, ...);
|
||||
int fscanf(FILE *__restrict, const char *__restrict, ...);
|
||||
int sscanf(const char *__restrict, const char *__restrict, ...);
|
||||
-int vscanf(const char *__restrict, __isoc_va_list);
|
||||
-int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list);
|
||||
-int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list);
|
||||
+int vscanf(const char *__restrict, __isoc_va_list) __fs(1, 0);
|
||||
+int vfscanf(FILE *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0);
|
||||
+int vsscanf(const char *__restrict, const char *__restrict, __isoc_va_list) __fs(2, 0);
|
||||
|
||||
void perror(const char *);
|
||||
|
||||
@@ -140,8 +148,8 @@ int pclose(FILE *);
|
||||
int fileno(FILE *);
|
||||
int fseeko(FILE *, off_t, int);
|
||||
off_t ftello(FILE *);
|
||||
-int dprintf(int, const char *__restrict, ...);
|
||||
-int vdprintf(int, const char *__restrict, __isoc_va_list);
|
||||
+int dprintf(int, const char *__restrict, ...) __fp(2, 3);
|
||||
+int vdprintf(int, const char *__restrict, __isoc_va_list) __fp(2, 0);
|
||||
void flockfile(FILE *);
|
||||
int ftrylockfile(FILE *);
|
||||
void funlockfile(FILE *);
|
||||
@@ -180,8 +188,8 @@ int fileno_unlocked(FILE *);
|
||||
int getw(FILE *);
|
||||
int putw(int, FILE *);
|
||||
char *fgetln(FILE *, size_t *);
|
||||
-int asprintf(char **, const char *, ...);
|
||||
-int vasprintf(char **, const char *, __isoc_va_list);
|
||||
+int asprintf(char **, const char *, ...) __fp(2, 3);
|
||||
+int vasprintf(char **, const char *, __isoc_va_list) __fp(2, 0);
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
@@ -203,6 +211,9 @@ typedef struct _IO_cookie_io_functions_t
|
||||
FILE *fopencookie(void *, const char *, cookie_io_functions_t);
|
||||
#endif
|
||||
|
||||
+#undef __fp
|
||||
+#undef __fs
|
||||
+
|
||||
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
||||
#define tmpfile64 tmpfile
|
||||
#define fopen64 fopen
|
||||
--- a/include/syslog.h
|
||||
+++ b/include/syslog.h
|
||||
@@ -56,16 +56,22 @@ extern "C" {
|
||||
#define LOG_NOWAIT 0x10
|
||||
#define LOG_PERROR 0x20
|
||||
|
||||
+#if __GNUC__ >= 3
|
||||
+#define __fp(x, y) __attribute__ ((__format__ (__printf__, x, y)))
|
||||
+#else
|
||||
+#define __fp(x, y)
|
||||
+#endif
|
||||
+
|
||||
void closelog (void);
|
||||
void openlog (const char *, int, int);
|
||||
int setlogmask (int);
|
||||
-void syslog (int, const char *, ...);
|
||||
+void syslog (int, const char *, ...) __fp(2, 3);
|
||||
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define _PATH_LOG "/dev/log"
|
||||
#define __NEED_va_list
|
||||
#include <bits/alltypes.h>
|
||||
-void vsyslog (int, const char *, va_list);
|
||||
+void vsyslog (int, const char *, va_list) __fp(2, 0);
|
||||
#if defined(SYSLOG_NAMES)
|
||||
#define INTERNAL_NOPRI 0x10
|
||||
#define INTERNAL_MARK (LOG_NFACILITIES<<3)
|
||||
@@ -93,6 +99,8 @@ typedef struct {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#undef __fp
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
From e01b5939b38aea5ecbe41670643199825874b26c Mon Sep 17 00:00:00 2001
|
||||
From: Rich Felker <dalias@aerifal.cx>
|
||||
Date: Thu, 21 May 2020 23:32:45 -0400
|
||||
Subject: [PATCH 2/4] don't use libc.threads_minus_1 as relaxed atomic for
|
||||
skipping locks
|
||||
|
||||
after all but the last thread exits, the next thread to observe
|
||||
libc.threads_minus_1==0 and conclude that it can skip locking fails to
|
||||
synchronize with any changes to memory that were made by the
|
||||
last-exiting thread. this can produce data races.
|
||||
|
||||
on some archs, at least x86, memory synchronization is unlikely to be
|
||||
a problem; however, with the inline locks in malloc, skipping the lock
|
||||
also eliminated the compiler barrier, and caused code that needed to
|
||||
re-check chunk in-use bits after obtaining the lock to reuse a stale
|
||||
value, possibly from before the process became single-threaded. this
|
||||
in turn produced corruption of the heap state.
|
||||
|
||||
some uses of libc.threads_minus_1 remain, especially for allocation of
|
||||
new TLS in the dynamic linker; otherwise, it could be removed
|
||||
entirely. it's made non-volatile to reflect that the remaining
|
||||
accesses are only made under lock on the thread list.
|
||||
|
||||
instead of libc.threads_minus_1, libc.threaded is now used for
|
||||
skipping locks. the difference is that libc.threaded is permanently
|
||||
true once an additional thread has been created. this will produce
|
||||
some performance regression in processes that are mostly
|
||||
single-threaded but occasionally creating threads. in the future it
|
||||
may be possible to bring back the full lock-skipping, but more care
|
||||
needs to be taken to produce a safe design.
|
||||
---
|
||||
src/internal/libc.h | 2 +-
|
||||
src/malloc/malloc.c | 2 +-
|
||||
src/thread/__lock.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/internal/libc.h
|
||||
+++ b/src/internal/libc.h
|
||||
@@ -21,7 +21,7 @@ struct __libc {
|
||||
int can_do_threads;
|
||||
int threaded;
|
||||
int secure;
|
||||
- volatile int threads_minus_1;
|
||||
+ int threads_minus_1;
|
||||
size_t *auxv;
|
||||
struct tls_module *tls_head;
|
||||
size_t tls_size, tls_align, tls_cnt;
|
||||
--- a/src/malloc/malloc.c
|
||||
+++ b/src/malloc/malloc.c
|
||||
@@ -26,7 +26,7 @@ int __malloc_replaced;
|
||||
|
||||
static inline void lock(volatile int *lk)
|
||||
{
|
||||
- if (libc.threads_minus_1)
|
||||
+ if (libc.threaded)
|
||||
while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1);
|
||||
}
|
||||
|
||||
--- a/src/thread/__lock.c
|
||||
+++ b/src/thread/__lock.c
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
void __lock(volatile int *l)
|
||||
{
|
||||
- if (!libc.threads_minus_1) return;
|
||||
+ if (!libc.threaded) return;
|
||||
/* fast path: INT_MIN for the lock, +1 for the congestion */
|
||||
int current = a_cas(l, 0, INT_MIN + 1);
|
||||
if (!current) return;
|
||||
65
toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff
Normal file
65
toolchain/musl/patches/700-wcsnrtombs-cve-2020-28928.diff
Normal file
@@ -0,0 +1,65 @@
|
||||
diff --git a/src/multibyte/wcsnrtombs.c b/src/multibyte/wcsnrtombs.c
|
||||
index 676932b5..95e25e70 100644
|
||||
--- a/src/multibyte/wcsnrtombs.c
|
||||
+++ b/src/multibyte/wcsnrtombs.c
|
||||
@@ -1,41 +1,33 @@
|
||||
#include <wchar.h>
|
||||
+#include <limits.h>
|
||||
+#include <string.h>
|
||||
|
||||
size_t wcsnrtombs(char *restrict dst, const wchar_t **restrict wcs, size_t wn, size_t n, mbstate_t *restrict st)
|
||||
{
|
||||
- size_t l, cnt=0, n2;
|
||||
- char *s, buf[256];
|
||||
const wchar_t *ws = *wcs;
|
||||
- const wchar_t *tmp_ws;
|
||||
-
|
||||
- if (!dst) s = buf, n = sizeof buf;
|
||||
- else s = dst;
|
||||
-
|
||||
- while ( ws && n && ( (n2=wn)>=n || n2>32 ) ) {
|
||||
- if (n2>=n) n2=n;
|
||||
- tmp_ws = ws;
|
||||
- l = wcsrtombs(s, &ws, n2, 0);
|
||||
- if (!(l+1)) {
|
||||
- cnt = l;
|
||||
- n = 0;
|
||||
+ size_t cnt = 0;
|
||||
+ if (!dst) n=0;
|
||||
+ while (ws && wn) {
|
||||
+ char tmp[MB_LEN_MAX];
|
||||
+ size_t l = wcrtomb(n<MB_LEN_MAX ? tmp : dst, *ws, 0);
|
||||
+ if (l==-1) {
|
||||
+ cnt = -1;
|
||||
break;
|
||||
}
|
||||
- if (s != buf) {
|
||||
- s += l;
|
||||
+ if (dst) {
|
||||
+ if (n<MB_LEN_MAX) {
|
||||
+ if (l>n) break;
|
||||
+ memcpy(dst, tmp, l);
|
||||
+ }
|
||||
+ dst += l;
|
||||
n -= l;
|
||||
}
|
||||
- wn = ws ? wn - (ws - tmp_ws) : 0;
|
||||
- cnt += l;
|
||||
- }
|
||||
- if (ws) while (n && wn) {
|
||||
- l = wcrtomb(s, *ws, 0);
|
||||
- if ((l+1)<=1) {
|
||||
- if (!l) ws = 0;
|
||||
- else cnt = l;
|
||||
+ if (!*ws) {
|
||||
+ ws = 0;
|
||||
break;
|
||||
}
|
||||
- ws++; wn--;
|
||||
- /* safe - this loop runs fewer than sizeof(buf) times */
|
||||
- s+=l; n-=l;
|
||||
+ ws++;
|
||||
+ wn--;
|
||||
cnt += l;
|
||||
}
|
||||
if (dst) *wcs = ws;
|
||||
100
toolchain/musl/patches/900-iconv_size_hack.patch
Normal file
100
toolchain/musl/patches/900-iconv_size_hack.patch
Normal file
@@ -0,0 +1,100 @@
|
||||
--- a/src/locale/iconv.c
|
||||
+++ b/src/locale/iconv.c
|
||||
@@ -48,6 +48,7 @@ static const unsigned char charmaps[] =
|
||||
"utf16\0\0\312"
|
||||
"ucs4\0utf32\0\0\313"
|
||||
"ucs2\0\0\314"
|
||||
+#ifdef FULL_ICONV
|
||||
"eucjp\0\0\320"
|
||||
"shiftjis\0sjis\0\0\321"
|
||||
"iso2022jp\0\0\322"
|
||||
@@ -56,6 +57,7 @@ static const unsigned char charmaps[] =
|
||||
"gb2312\0\0\332"
|
||||
"big5\0bigfive\0cp950\0big5hkscs\0\0\340"
|
||||
"euckr\0ksc5601\0ksx1001\0cp949\0\0\350"
|
||||
+#endif
|
||||
#include "codepages.h"
|
||||
;
|
||||
|
||||
@@ -66,6 +68,7 @@ static const unsigned short legacy_chars
|
||||
#include "legacychars.h"
|
||||
};
|
||||
|
||||
+#ifdef FULL_ICONV
|
||||
static const unsigned short jis0208[84][94] = {
|
||||
#include "jis0208.h"
|
||||
};
|
||||
@@ -85,6 +88,7 @@ static const unsigned short hkscs[] = {
|
||||
static const unsigned short ksc[93][94] = {
|
||||
#include "ksc.h"
|
||||
};
|
||||
+#endif
|
||||
|
||||
static const unsigned short rev_jis[] = {
|
||||
#include "revjis.h"
|
||||
@@ -205,6 +209,7 @@ static unsigned legacy_map(const unsigne
|
||||
return x < 256 ? x : legacy_chars[x-256];
|
||||
}
|
||||
|
||||
+#ifdef FULL_ICONV
|
||||
static unsigned uni_to_jis(unsigned c)
|
||||
{
|
||||
unsigned nel = sizeof rev_jis / sizeof *rev_jis;
|
||||
@@ -223,6 +228,7 @@ static unsigned uni_to_jis(unsigned c)
|
||||
}
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
|
||||
{
|
||||
@@ -319,6 +325,7 @@ size_t iconv(iconv_t cd, char **restrict
|
||||
}
|
||||
type = scd->state;
|
||||
continue;
|
||||
+#ifdef FULL_ICONV
|
||||
case SHIFT_JIS:
|
||||
if (c < 128) break;
|
||||
if (c-0xa1 <= 0xdf-0xa1) {
|
||||
@@ -518,6 +525,7 @@ size_t iconv(iconv_t cd, char **restrict
|
||||
c = ksc[c][d];
|
||||
if (!c) goto ilseq;
|
||||
break;
|
||||
+#endif
|
||||
default:
|
||||
if (!c) break;
|
||||
c = legacy_map(map, c);
|
||||
@@ -559,6 +567,7 @@ size_t iconv(iconv_t cd, char **restrict
|
||||
}
|
||||
}
|
||||
goto subst;
|
||||
+#ifdef FULL_ICONV
|
||||
case SHIFT_JIS:
|
||||
if (c < 128) goto revout;
|
||||
if (c == 0xa5) {
|
||||
@@ -632,6 +641,7 @@ size_t iconv(iconv_t cd, char **restrict
|
||||
*(*out)++ = 'B';
|
||||
*outb -= 8;
|
||||
break;
|
||||
+#endif
|
||||
case UCS2:
|
||||
totype = UCS2BE;
|
||||
case UCS2BE:
|
||||
--- a/src/locale/codepages.h
|
||||
+++ b/src/locale/codepages.h
|
||||
@@ -129,6 +129,7 @@
|
||||
"\340\204\43\316\100\344\34\144\316\71\350\244\243\316\72\354\264\343\316\73"
|
||||
"\21\361\44\317\74\364\30\145\17\124\146\345\243\317\76\374\134\304\327\77"
|
||||
|
||||
+#ifdef FULL_ICONV
|
||||
"cp1250\0"
|
||||
"windows1250\0"
|
||||
"\0\40"
|
||||
@@ -239,6 +240,7 @@
|
||||
"\20\105\163\330\64\324\324\145\315\65\330\144\243\315\66\334\334\145\330\67"
|
||||
"\340\204\43\316\100\344\224\143\316\71\350\244\243\316\72\205\265\343\316\73"
|
||||
"\21\305\203\330\74\364\330\145\317\75\370\344\243\317\76\374\340\65\362\77"
|
||||
+#endif
|
||||
|
||||
"koi8r\0"
|
||||
"\0\40"
|
||||
75
toolchain/musl/patches/901-crypt_size_hack.patch
Normal file
75
toolchain/musl/patches/901-crypt_size_hack.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
--- a/src/crypt/crypt_sha512.c
|
||||
+++ b/src/crypt/crypt_sha512.c
|
||||
@@ -13,6 +13,17 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#ifdef CRYPT_SIZE_HACK
|
||||
+#include <errno.h>
|
||||
+
|
||||
+char *__crypt_sha512(const char *key, const char *setting, char *output)
|
||||
+{
|
||||
+ errno = ENOSYS;
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
/* public domain sha512 implementation based on fips180-3 */
|
||||
/* >=2^64 bits messages are not supported (about 2000 peta bytes) */
|
||||
|
||||
@@ -369,3 +380,4 @@ char *__crypt_sha512(const char *key, co
|
||||
return "*";
|
||||
return p;
|
||||
}
|
||||
+#endif
|
||||
--- a/src/crypt/crypt_blowfish.c
|
||||
+++ b/src/crypt/crypt_blowfish.c
|
||||
@@ -50,6 +50,17 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#ifdef CRYPT_SIZE_HACK
|
||||
+#include <errno.h>
|
||||
+
|
||||
+char *__crypt_blowfish(const char *key, const char *setting, char *output)
|
||||
+{
|
||||
+ errno = ENOSYS;
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
typedef uint32_t BF_word;
|
||||
typedef int32_t BF_word_signed;
|
||||
|
||||
@@ -796,3 +807,4 @@ char *__crypt_blowfish(const char *key,
|
||||
|
||||
return "*";
|
||||
}
|
||||
+#endif
|
||||
--- a/src/crypt/crypt_sha256.c
|
||||
+++ b/src/crypt/crypt_sha256.c
|
||||
@@ -13,6 +13,17 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
+#ifdef CRYPT_SIZE_HACK
|
||||
+#include <errno.h>
|
||||
+
|
||||
+char *__crypt_sha256(const char *key, const char *setting, char *output)
|
||||
+{
|
||||
+ errno = ENOSYS;
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
+
|
||||
/* public domain sha256 implementation based on fips180-3 */
|
||||
|
||||
struct sha256 {
|
||||
@@ -320,3 +331,4 @@ char *__crypt_sha256(const char *key, co
|
||||
return "*";
|
||||
return p;
|
||||
}
|
||||
+#endif
|
||||
Reference in New Issue
Block a user