openwrt/toolchain/musl/patches/900-iconv_size_hack.patch
Hannu Nyman 87d7fa8885 toolchain/musl: Update to 1.2.5
Update musl C library to 1.2.5

This release adds extension functions statx and preadv2/pwritev2,
with fallback implementations for older kernels, and adds two new
ports: loongarch64 and riscv32. Minor changes to the printf family
of functions have been made for conformance to new standards
interpretations/requirements. TLSDESC support for riscv64 has also
been added.

Bugs fixed include some DNS issues related to new TCP fallback
functionality, several rare race conditions, potentially incorrect
return value when glob aborts, and several signifiant arch-specific
bugs affecting TLSDESC on arm, riscv64 icache flushing, and
sh sigsetjmp and dlsym RTLD_NEXT.

1.2.5 release notes:

new features:
- statx function (linux extension; via syscall and fallback using fstatat)
- clone function is now usable and gives _Fork-like consistency in child
- statvfs now provides f_type result
- preadv2 and pwritev2 (linux extension) syscall wrappers
- riscv64 TLSDESC support

new ports:
- loongarch64
- riscv32

compatibility:
- DNS resolver can now handle answers with long CNAME chains
- string.h no longer provides (C23-incompat) non-prototype decl of basename
- fstatat statx backend now matches stat syscall non-automounting behavior
- mntent interfaces now handle escaped whitespace in paths/options

standards updates:
- printf %lc of nul wchar now produces output
- snprintf and swprintf no longer fail on n > INT_MAX
- ppoll is now exposed in default feature profile

bugs fixed:
- some long DNS answers were wrongly rejected despite new TCP support
- glob could wrongly return GLOB_NOMATCH if aborted before any matches
- multithreaded set*id could malfunction from thread sequencing logic bug
- certain use of threads after fork could deadlock thread-list lock
- posix_spawn child could deadlock in race with async parent death
- mbrtowc return value was wrong if argument n exceeded UINT_MAX
- 80-bit extended acoshl and powl got some corner cases wrong
- syslog incorrectly generated localized timestamps

arch-specific bugs fixed:
- arm (32-bit) TLSDESC malfunctioned due to addends being processed wrong
- riscv64 icache flush operation was non-functional
- sh sigsetjmp failed to properly restore call-saved register r8 on return
- sh dlsym RTLD_NEXT did not identify calling module correctly

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
[Removed patch adding basename hack again]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-04-14 17:38:09 +02:00

101 lines
2.5 KiB
Diff

--- 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\0cp932\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"