toolchains: branch master updated. 926e9e0fd74c2ce6c65faacab530e1492160654f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/926e9e0fd74c2ce6c6...
...commit http://git.netsurf-browser.org/toolchains.git/commit/926e9e0fd74c2ce6c65f...
...tree http://git.netsurf-browser.org/toolchains.git/tree/926e9e0fd74c2ce6c65faa...
The branch, master has been updated
via 926e9e0fd74c2ce6c65faacab530e1492160654f (commit)
from 22154acc24e6ca34f953c4e7b63b4e5527805086 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=926e9e0fd74c2ce6...
commit 926e9e0fd74c2ce6c65faacab530e1492160654f
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
Extend POSIX locale patch to cover most APIs
The only missing one that's defined by POSIX is strftime_l.
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
index f378a7e..f5726b8 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -2,12 +2,17 @@ Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
-@@ -587,7 +587,7 @@
+@@ -583,11 +583,11 @@
+ else
+ locale_src = \
+ locale/localeconv.c \
++ locale/newlocale.c \
+ locale/nl_langinfo.c \
locale/setlocale.c \
locale/strcoll.c \
- locale/strxfrm.c \
+- locale/strxfrm.c \
- locale/territory.c
-+ locale/newlocale.c
++ locale/strxfrm.c
endif
locale_src += \
locale/iconv.c
@@ -461,8 +466,8 @@ Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
__END_DECLS
Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
===================================================================
---- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
-+++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) 2022 UnixLib Developers
@@ -561,6 +566,32 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
# endif
#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/langinfo.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (working copy)
+@@ -580,18 +580,12 @@
+ extern char *nl_langinfo (nl_item __item) __THROW;
+
+
+-#if 0
+-#ifdef __USE_GNU
+-/* This interface is for the extended locale model. See <locale.h> for
+- more information. */
++#ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
+-/* Get locale datatype definition. */
+-# include <xlocale.h>
+-
+ /* Just like nl_langinfo but get the information from the locale object L. */
+-extern char *nl_langinfo_l (nl_item __item, __locale_t l);
++extern char *nl_langinfo_l (nl_item __item, locale_t __l);
+ #endif
+-#endif
+
+ __END_DECLS
+
Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
@@ -601,11 +632,14 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
extern locale_t uselocale(locale_t newloc);
extern void freelocale(locale_t locobj);
-@@ -127,7 +130,8 @@
+@@ -127,7 +130,11 @@
extern locale_t newlocale(int category_mask, const char *locale,
locale_t base);
-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++
++extern locale_t duplocale(locale_t locobj);
++
+# define LC_GLOBAL_LOCALE ((locale_t) -1L)
+# endif
#endif
@@ -615,7 +649,24 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
-@@ -281,6 +281,17 @@
+@@ -93,6 +93,16 @@
+ const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((2));
+
++#ifdef __USE_XOPEN2K8
++#include <bits/locale_t.h>
++
++extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
++ locale_t __l) __THROW __nonnull ((2, 4));
++#endif
++
+ /* Find the first occurrence of c in s. */
+ extern char *strchr (const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1)) __wur;
+@@ -281,6 +291,17 @@
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
@@ -633,6 +684,18 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
#endif /* Use BSD. */
#if defined __USE_XOPEN2K || defined __USE_MISC
+@@ -289,6 +310,11 @@
+ __THROW __nonnull ((2));
+ #endif
+
++#ifdef __USE_XOPEN2K8
++/* Translate error number to string according to the locale L. */
++extern char *strerror_l (int __errnum, locale_t __l) __THROW;
++#endif
++
+ #ifndef __TARGET_SCL__
+ # ifndef basename
+ /* Return the file name within directory of FILENAME. We don't
Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
@@ -655,6 +718,207 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
/* Return the position of the first bit set in I, or 0 if none are set.
The least-significant bit is position 1, the most-significant 32. */
extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/include/wchar.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/wchar.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/wchar.h (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ * File taken from glibc 2.11.
+ * Following changes were made:
+- * - Disabled non-standard reentrant locale prototypes.
++ * - None
+ */
+
+ /* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc.
+@@ -172,7 +172,6 @@
+ __END_NAMESPACE_STD
+ #endif
+
+-#if 0
+ #ifdef __USE_XOPEN2K8
+ /* Compare S1 and S2, ignoring case. */
+ extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
+@@ -183,15 +182,14 @@
+
+ /* Similar to the two functions above but take the information from
+ the provided locale and not the global locale. */
+-# include <xlocale.h>
++# include <bits/locale_t.h>
+
+ extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- __locale_t __loc) __THROW;
++ locale_t __loc) __THROW;
+
+ extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- size_t __n, __locale_t __loc) __THROW;
++ size_t __n, locale_t __loc) __THROW;
+ #endif
+-#endif
+
+ __BEGIN_NAMESPACE_STD
+ /* Compare S1 and S2, both interpreted as appropriate to the
+@@ -205,7 +203,6 @@
+ __END_NAMESPACE_STD
+
+ #ifdef __USE_XOPEN2K8
+-#if 0
+ /* Similar to the two functions above but take the information from
+ the provided locale and not the global locale. */
+
+@@ -212,14 +209,13 @@
+ /* Compare S1 and S2, both interpreted as appropriate to the
+ LC_COLLATE category of the given locale. */
+ extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- __locale_t __loc) __THROW;
++ locale_t __loc) __THROW;
+
+ /* Transform S2 into array pointed to by S1 such that if wcscmp is
+ applied to two transformed strings the result is the as applying
+ `wcscoll' to the original strings. */
+ extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
+- size_t __n, __locale_t __loc) __THROW;
+-#endif
++ size_t __n, locale_t __loc) __THROW;
+
+ #ifndef __TARGET_SCL__
+ /* Duplicate S, returning an identical malloc'd string. */
+Index: gcc4/recipe/files/gcc/libunixlib/include/wctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/wctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/wctype.h (working copy)
+@@ -3,7 +3,6 @@
+ * Following changes were made:
+ * - Replaced "#include <bits/types.h>" into "#include <unixlib/types.h>"
+ * - Add wint_t typedef when it hasn't been defined in stddef.h.
+- * - Disabled non-standard reentrant locale prototypes.
+ */
+
+ /* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc.
+@@ -191,7 +190,6 @@
+ /* Determine whether the wide-character WC has the property described by
+ DESC. */
+ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
+-#define iswctype_l(c, d, l) iswctype(c, d)
+
+ __END_NAMESPACE_C99
+
+@@ -241,73 +239,71 @@
+ extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
+ __END_NAMESPACE_C99
+
+-#if 0
+ # ifdef __USE_XOPEN2K8
+-/* Declare the interface to extended locale model. */
+-# include <xlocale.h>
++# include <bits/locale_t.h>
+
+ /* Test for any wide character for which `iswalpha' or `iswdigit' is
+ true. */
+-extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character for which `iswupper' or 'iswlower' is
+ true, or any wide character that is one of a locale-specific set of
+ wide-characters for which none of `iswcntrl', `iswdigit',
+ `iswpunct', or `iswspace' is true. */
+-extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any control wide character. */
+-extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a decimal-digit
+ character. */
+-extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character for which `iswprint' is true and
+ `iswspace' is false. */
+-extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a lowercase letter
+ or is one of a locale-specific set of wide characters for which
+ none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
+-extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any printing wide character. */
+-extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any printing wide character that is one of a
+ locale-specific et of wide characters for which neither `iswspace'
+ nor `iswalnum' is true. */
+-extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a locale-specific
+ set of wide characters for which none of `iswalnum', `iswgraph', or
+ `iswpunct' is true. */
+-extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to an uppercase letter
+ or is one of a locale-specific set of wide character for which none
+ of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
+-extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a hexadecimal-digit
+ character equivalent to that performed be the functions described
+ in the previous subclause. */
+-extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a standard blank
+ wide character or a locale-specific set of wide characters for
+ which `iswalnum' is false. */
+-extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Construct value that describes a class of wide characters identified
+ by the string argument PROPERTY. */
+-extern wctype_t wctype_l (__const char *__property, __locale_t __locale)
++extern wctype_t wctype_l (__const char *__property, locale_t __locale)
+ __THROW;
+
+ /* Determine whether the wide-character WC has the property described by
+ DESC. */
+-extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
++extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
+ __THROW;
+
+
+@@ -316,22 +312,21 @@
+ */
+
+ /* Converts an uppercase letter to the corresponding lowercase letter. */
+-extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
++extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Converts an lowercase letter to the corresponding uppercase letter. */
+-extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
++extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Construct value that describes a mapping between wide characters
+ identified by the string argument PROPERTY. */
+-extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale)
++extern wctrans_t wctrans_l (__const char *__property, locale_t __locale)
+ __THROW;
+
+ /* Map the wide character WC using the mapping described by DESC. */
+ extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
+- __locale_t __locale) __THROW;
++ locale_t __locale) __THROW;
+
+ # endif /* Use POSIX 2008. */
+-#endif
+
+ __END_DECLS
+
Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
@@ -865,27 +1129,31 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
-@@ -1,15 +1,15 @@
+@@ -1,17 +1,17 @@
/* Copyright (c) 2019 UnixLib Developers
*/
+#include <ctype.h>
++#include <errno.h>
++#include <locale.h>
#include <stdlib.h>
- #include <locale.h>
+-#include <locale.h>
#include <stdio.h>
+-#include <errno.h>
+#include <string.h>
- #include <errno.h>
-+
-+#include <internal/unix.h>
-struct _locale {
- struct lconv lc;
-};
--
++#include <internal/unix.h>
+
/* This is supposed to be per-thread. */
- static locale_t current_locale;
+-static locale_t current_locale;
++static locale_t current_locale = LC_GLOBAL_LOCALE;
-@@ -27,20 +27,71 @@
+ locale_t uselocale(locale_t newloc)
+ {
+@@ -27,20 +27,94 @@
void freelocale(locale_t locobj)
{
@@ -901,20 +1169,17 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
{
- locale_t loc = (locale_t)malloc(sizeof(*loc));
- if (!loc) {
-- __set_errno (ENOMEM);
+ struct _locale tmp;
+
+ PTHREAD_UNSAFE
+
+ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
+ __set_errno (EINVAL);
- return 0;
- }
-
-- loc->lc = *localeconv();
++ return 0;
++ }
++
+ /* The locale provided will be verified by __setlocale_l() */
-
-- return loc;
++
+ /* Prepare the temporary locale we will modify */
+ if (base != 0 && base != LC_GLOBAL_LOCALE) {
+ memcpy(&tmp, base, sizeof(tmp));
@@ -962,7 +1227,46 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+ base->lc_needs_refresh = 1;
+
+ return base;
++}
++
++locale_t duplocale(locale_t locobj)
++{
++ locale_t loc;
++
++ loc = (locale_t) malloc(sizeof(*loc));
++ if (loc == NULL) {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ if (locobj == LC_GLOBAL_LOCALE) {
++ memcpy(loc, &__locale_global, sizeof(*loc));
++ } else {
++ memcpy(loc, locobj, sizeof(*loc));
++ }
+
++ /* Invalidate lconv in the copy */
++ __localeconv_lconv_init(&loc->lc);
++ loc->lc_needs_refresh = 1;
++
+ return loc;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (working copy)
+@@ -24,3 +24,10 @@
+
+ return (char *)value;
}
++
++char *
++nl_langinfo_l (nl_item item, locale_t l)
++{
++ (void) l;
++ return nl_langinfo(item);
++}
Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
@@ -1106,25 +1410,46 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
-@@ -13,7 +13,7 @@
+@@ -11,9 +11,15 @@
+ int
+ strcoll (const char *s1, const char *s2)
{
++ return strcoll_l (s1, s2, &__locale_global);
++}
++
++int
++strcoll_l (const char *s1, const char *s2, locale_t l)
++{
int regs[10];
- regs[0] = __locale_territory[LC_COLLATE];
-+ regs[0] = __locale_global.locale_territory[LC_COLLATE];
++ regs[0] = l->locale_territory[LC_COLLATE];
regs[1] = (int)s1;
regs[2] = (int)s2;
regs[3] = 0;
+@@ -21,3 +27,4 @@
+ __os_swi (Territory_Collate, regs);
+ return regs[0];
+ }
++
Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
-@@ -13,7 +13,7 @@
+@@ -11,9 +11,15 @@
+ size_t
+ strxfrm (char *to, const char *from, size_t size)
{
++ return strxfrm_l (to, from, size, &__locale_global);
++}
++
++size_t
++strxfrm_l (char *to, const char *from, size_t size, locale_t l)
++{
int regs[10];
- regs[0] = __locale_territory[LC_COLLATE];
-+ regs[0] = __locale_global.locale_territory[LC_COLLATE];
++ regs[0] = l->locale_territory[LC_COLLATE];
regs[1] = (int)to;
regs[2] = (int)from;
regs[3] = size;
@@ -1174,7 +1499,7 @@ Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+ {
+ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
+ if (*p1++ == '\0')
-+ break;
++ break;
+ p2 ++;
+ }
+
@@ -1215,6 +1540,21 @@ Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+ return i - j;
+}
+
+Index: gcc4/recipe/files/gcc/libunixlib/sys/errlist.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (working copy)
+@@ -211,3 +211,10 @@
+
+ return 0;
+ }
++
++char *
++strerror_l (int errnum, locale_t l)
++{
++ (void) l;
++ return strerror (errnum);
++}
Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
@@ -1350,3 +1690,231 @@ Index: gcc4/recipe/files/gcc/libunixlib/vscript
__sdirinit;
__sfixinit;
__sfixfind;
+Index: gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (working copy)
+@@ -4,6 +4,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+ #include <wctype.h>
+
+ int
+@@ -71,3 +72,69 @@
+ {
+ return isxdigit (wc);
+ }
++
++int
++iswalnum_l (wint_t wc, locale_t locale)
++{
++ return isalnum_l (wc, locale);
++}
++
++int
++iswalpha_l (wint_t wc, locale_t locale)
++{
++ return isalpha_l (wc, locale);
++}
++
++int
++iswcntrl_l (wint_t wc, locale_t locale)
++{
++ return iscntrl_l (wc, locale);
++}
++
++int
++iswdigit_l (wint_t wc, locale_t locale)
++{
++ return isdigit_l (wc, locale);
++}
++
++int
++iswgraph_l (wint_t wc, locale_t locale)
++{
++ return isgraph_l (wc, locale);
++}
++
++int
++iswprint_l (wint_t wc, locale_t locale)
++{
++ return isprint_l (wc, locale);
++}
++
++int
++iswpunct_l (wint_t wc, locale_t locale)
++{
++ return ispunct_l (wc, locale);
++}
++
++int
++iswspace_l (wint_t wc, locale_t locale)
++{
++ return isspace_l (wc, locale);
++}
++
++int
++iswxdigit_l (wint_t wc, locale_t locale)
++{
++ return isxdigit_l (wc, locale);
++}
++
++wint_t
++towlower_l (wint_t wc, locale_t locale)
++{
++ return tolower_l (wc, locale);
++}
++
++wint_t
++towupper_l (wint_t wc, locale_t locale)
++{
++ return toupper_l (wc, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (working copy)
+@@ -1,7 +1,7 @@
++#include <locale.h>
++#include <stdio.h>
+ #include <stdlib.h>
+ #include <wctype.h>
+-#include <wctype.h>
+-#include <stdio.h>
+
+ int iswupper (wint_t __wc)
+ {
+@@ -9,13 +9,26 @@
+ abort();
+ }
+
+-unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
+- wchar_t **__restrict __endptr, int __base)
++int
++iswupper_l (wint_t wc, locale_t locale)
+ {
+ printf("%s: Not implemented\n", __func__);
+ abort();
+ }
+
++int iswlower (wint_t __wc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int
++iswlower_l (wint_t wc, locale_t locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2)
+ {
+ printf("%s: Not implemented\n", __func__);
+@@ -22,12 +35,47 @@
+ abort();
+ }
+
+-int iswlower (wint_t __wc)
++int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ locale_t loc)
+ {
+ printf("%s: Not implemented\n", __func__);
+ abort();
+ }
+
++int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n, locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
++ wchar_t **__restrict __endptr, int __base)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ long long int wcstoll (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr, int __base)
+ {
+@@ -63,6 +111,13 @@
+ abort();
+ }
+
++size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n, locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ float wcstof (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr)
+ {
+@@ -83,6 +138,13 @@
+ abort();
+ }
+
++int
++iswblank_l (wint_t __wc, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ int iswctype (wint_t __wc, wctype_t __desc)
+ {
+ printf("%s: Not implemented\n", __func__);
+@@ -89,6 +151,12 @@
+ abort();
+ }
+
++int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr,
+ int __base)
+@@ -116,6 +184,12 @@
+ abort();
+ }
+
++wctype_t wctype_l (__const char *__property, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ wint_t ungetwc(wint_t wc, FILE *stream)
+ {
+ printf("%s: Not implemented\n", __func__);
-----------------------------------------------------------------------
Summary of changes:
.../recipes/patches/gcc4/posix-extended-locale.p | 622 +++++++++++++++++++-
1 file changed, 595 insertions(+), 27 deletions(-)
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
index f378a7e..f5726b8 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -2,12 +2,17 @@ Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
-@@ -587,7 +587,7 @@
+@@ -583,11 +583,11 @@
+ else
+ locale_src = \
+ locale/localeconv.c \
++ locale/newlocale.c \
+ locale/nl_langinfo.c \
locale/setlocale.c \
locale/strcoll.c \
- locale/strxfrm.c \
+- locale/strxfrm.c \
- locale/territory.c
-+ locale/newlocale.c
++ locale/strxfrm.c
endif
locale_src += \
locale/iconv.c
@@ -461,8 +466,8 @@ Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
__END_DECLS
Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
===================================================================
---- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
-+++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
@@ -0,0 +1,10 @@
+/*
+ * Copyright (c) 2022 UnixLib Developers
@@ -561,6 +566,32 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
# endif
#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/langinfo.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/langinfo.h (working copy)
+@@ -580,18 +580,12 @@
+ extern char *nl_langinfo (nl_item __item) __THROW;
+
+
+-#if 0
+-#ifdef __USE_GNU
+-/* This interface is for the extended locale model. See <locale.h> for
+- more information. */
++#ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
+-/* Get locale datatype definition. */
+-# include <xlocale.h>
+-
+ /* Just like nl_langinfo but get the information from the locale object L. */
+-extern char *nl_langinfo_l (nl_item __item, __locale_t l);
++extern char *nl_langinfo_l (nl_item __item, locale_t __l);
+ #endif
+-#endif
+
+ __END_DECLS
+
Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
@@ -601,11 +632,14 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
extern locale_t uselocale(locale_t newloc);
extern void freelocale(locale_t locobj);
-@@ -127,7 +130,8 @@
+@@ -127,7 +130,11 @@
extern locale_t newlocale(int category_mask, const char *locale,
locale_t base);
-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++
++extern locale_t duplocale(locale_t locobj);
++
+# define LC_GLOBAL_LOCALE ((locale_t) -1L)
+# endif
#endif
@@ -615,7 +649,24 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
-@@ -281,6 +281,17 @@
+@@ -93,6 +93,16 @@
+ const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((2));
+
++#ifdef __USE_XOPEN2K8
++#include <bits/locale_t.h>
++
++extern int strcoll_l (const char *__s1, const char *__s2, locale_t __l)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
++ locale_t __l) __THROW __nonnull ((2, 4));
++#endif
++
+ /* Find the first occurrence of c in s. */
+ extern char *strchr (const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1)) __wur;
+@@ -281,6 +291,17 @@
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
@@ -633,6 +684,18 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
#endif /* Use BSD. */
#if defined __USE_XOPEN2K || defined __USE_MISC
+@@ -289,6 +310,11 @@
+ __THROW __nonnull ((2));
+ #endif
+
++#ifdef __USE_XOPEN2K8
++/* Translate error number to string according to the locale L. */
++extern char *strerror_l (int __errnum, locale_t __l) __THROW;
++#endif
++
+ #ifndef __TARGET_SCL__
+ # ifndef basename
+ /* Return the file name within directory of FILENAME. We don't
Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
@@ -655,6 +718,207 @@ Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
/* Return the position of the first bit set in I, or 0 if none are set.
The least-significant bit is position 1, the most-significant 32. */
extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/include/wchar.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/wchar.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/wchar.h (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ * File taken from glibc 2.11.
+ * Following changes were made:
+- * - Disabled non-standard reentrant locale prototypes.
++ * - None
+ */
+
+ /* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc.
+@@ -172,7 +172,6 @@
+ __END_NAMESPACE_STD
+ #endif
+
+-#if 0
+ #ifdef __USE_XOPEN2K8
+ /* Compare S1 and S2, ignoring case. */
+ extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
+@@ -183,15 +182,14 @@
+
+ /* Similar to the two functions above but take the information from
+ the provided locale and not the global locale. */
+-# include <xlocale.h>
++# include <bits/locale_t.h>
+
+ extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- __locale_t __loc) __THROW;
++ locale_t __loc) __THROW;
+
+ extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- size_t __n, __locale_t __loc) __THROW;
++ size_t __n, locale_t __loc) __THROW;
+ #endif
+-#endif
+
+ __BEGIN_NAMESPACE_STD
+ /* Compare S1 and S2, both interpreted as appropriate to the
+@@ -205,7 +203,6 @@
+ __END_NAMESPACE_STD
+
+ #ifdef __USE_XOPEN2K8
+-#if 0
+ /* Similar to the two functions above but take the information from
+ the provided locale and not the global locale. */
+
+@@ -212,14 +209,13 @@
+ /* Compare S1 and S2, both interpreted as appropriate to the
+ LC_COLLATE category of the given locale. */
+ extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
+- __locale_t __loc) __THROW;
++ locale_t __loc) __THROW;
+
+ /* Transform S2 into array pointed to by S1 such that if wcscmp is
+ applied to two transformed strings the result is the as applying
+ `wcscoll' to the original strings. */
+ extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
+- size_t __n, __locale_t __loc) __THROW;
+-#endif
++ size_t __n, locale_t __loc) __THROW;
+
+ #ifndef __TARGET_SCL__
+ /* Duplicate S, returning an identical malloc'd string. */
+Index: gcc4/recipe/files/gcc/libunixlib/include/wctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/wctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/wctype.h (working copy)
+@@ -3,7 +3,6 @@
+ * Following changes were made:
+ * - Replaced "#include <bits/types.h>" into "#include <unixlib/types.h>"
+ * - Add wint_t typedef when it hasn't been defined in stddef.h.
+- * - Disabled non-standard reentrant locale prototypes.
+ */
+
+ /* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc.
+@@ -191,7 +190,6 @@
+ /* Determine whether the wide-character WC has the property described by
+ DESC. */
+ extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
+-#define iswctype_l(c, d, l) iswctype(c, d)
+
+ __END_NAMESPACE_C99
+
+@@ -241,73 +239,71 @@
+ extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
+ __END_NAMESPACE_C99
+
+-#if 0
+ # ifdef __USE_XOPEN2K8
+-/* Declare the interface to extended locale model. */
+-# include <xlocale.h>
++# include <bits/locale_t.h>
+
+ /* Test for any wide character for which `iswalpha' or `iswdigit' is
+ true. */
+-extern int iswalnum_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character for which `iswupper' or 'iswlower' is
+ true, or any wide character that is one of a locale-specific set of
+ wide-characters for which none of `iswcntrl', `iswdigit',
+ `iswpunct', or `iswspace' is true. */
+-extern int iswalpha_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any control wide character. */
+-extern int iswcntrl_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a decimal-digit
+ character. */
+-extern int iswdigit_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character for which `iswprint' is true and
+ `iswspace' is false. */
+-extern int iswgraph_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a lowercase letter
+ or is one of a locale-specific set of wide characters for which
+ none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
+-extern int iswlower_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any printing wide character. */
+-extern int iswprint_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any printing wide character that is one of a
+ locale-specific et of wide characters for which neither `iswspace'
+ nor `iswalnum' is true. */
+-extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a locale-specific
+ set of wide characters for which none of `iswalnum', `iswgraph', or
+ `iswpunct' is true. */
+-extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to an uppercase letter
+ or is one of a locale-specific set of wide character for which none
+ of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
+-extern int iswupper_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a hexadecimal-digit
+ character equivalent to that performed be the functions described
+ in the previous subclause. */
+-extern int iswxdigit_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Test for any wide character that corresponds to a standard blank
+ wide character or a locale-specific set of wide characters for
+ which `iswalnum' is false. */
+-extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
++extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Construct value that describes a class of wide characters identified
+ by the string argument PROPERTY. */
+-extern wctype_t wctype_l (__const char *__property, __locale_t __locale)
++extern wctype_t wctype_l (__const char *__property, locale_t __locale)
+ __THROW;
+
+ /* Determine whether the wide-character WC has the property described by
+ DESC. */
+-extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
++extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
+ __THROW;
+
+
+@@ -316,22 +312,21 @@
+ */
+
+ /* Converts an uppercase letter to the corresponding lowercase letter. */
+-extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
++extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Converts an lowercase letter to the corresponding uppercase letter. */
+-extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
++extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW;
+
+ /* Construct value that describes a mapping between wide characters
+ identified by the string argument PROPERTY. */
+-extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale)
++extern wctrans_t wctrans_l (__const char *__property, locale_t __locale)
+ __THROW;
+
+ /* Map the wide character WC using the mapping described by DESC. */
+ extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
+- __locale_t __locale) __THROW;
++ locale_t __locale) __THROW;
+
+ # endif /* Use POSIX 2008. */
+-#endif
+
+ __END_DECLS
+
Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
@@ -865,27 +1129,31 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
-@@ -1,15 +1,15 @@
+@@ -1,17 +1,17 @@
/* Copyright (c) 2019 UnixLib Developers
*/
+#include <ctype.h>
++#include <errno.h>
++#include <locale.h>
#include <stdlib.h>
- #include <locale.h>
+-#include <locale.h>
#include <stdio.h>
+-#include <errno.h>
+#include <string.h>
- #include <errno.h>
-+
-+#include <internal/unix.h>
-struct _locale {
- struct lconv lc;
-};
--
++#include <internal/unix.h>
+
/* This is supposed to be per-thread. */
- static locale_t current_locale;
+-static locale_t current_locale;
++static locale_t current_locale = LC_GLOBAL_LOCALE;
-@@ -27,20 +27,71 @@
+ locale_t uselocale(locale_t newloc)
+ {
+@@ -27,20 +27,94 @@
void freelocale(locale_t locobj)
{
@@ -901,20 +1169,17 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
{
- locale_t loc = (locale_t)malloc(sizeof(*loc));
- if (!loc) {
-- __set_errno (ENOMEM);
+ struct _locale tmp;
+
+ PTHREAD_UNSAFE
+
+ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
+ __set_errno (EINVAL);
- return 0;
- }
-
-- loc->lc = *localeconv();
++ return 0;
++ }
++
+ /* The locale provided will be verified by __setlocale_l() */
-
-- return loc;
++
+ /* Prepare the temporary locale we will modify */
+ if (base != 0 && base != LC_GLOBAL_LOCALE) {
+ memcpy(&tmp, base, sizeof(tmp));
@@ -962,7 +1227,46 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+ base->lc_needs_refresh = 1;
+
+ return base;
++}
++
++locale_t duplocale(locale_t locobj)
++{
++ locale_t loc;
++
++ loc = (locale_t) malloc(sizeof(*loc));
++ if (loc == NULL) {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ if (locobj == LC_GLOBAL_LOCALE) {
++ memcpy(loc, &__locale_global, sizeof(*loc));
++ } else {
++ memcpy(loc, locobj, sizeof(*loc));
++ }
+
++ /* Invalidate lconv in the copy */
++ __localeconv_lconv_init(&loc->lc);
++ loc->lc_needs_refresh = 1;
++
+ return loc;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/nl_langinfo.c (working copy)
+@@ -24,3 +24,10 @@
+
+ return (char *)value;
}
++
++char *
++nl_langinfo_l (nl_item item, locale_t l)
++{
++ (void) l;
++ return nl_langinfo(item);
++}
Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
@@ -1106,25 +1410,46 @@ Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
-@@ -13,7 +13,7 @@
+@@ -11,9 +11,15 @@
+ int
+ strcoll (const char *s1, const char *s2)
{
++ return strcoll_l (s1, s2, &__locale_global);
++}
++
++int
++strcoll_l (const char *s1, const char *s2, locale_t l)
++{
int regs[10];
- regs[0] = __locale_territory[LC_COLLATE];
-+ regs[0] = __locale_global.locale_territory[LC_COLLATE];
++ regs[0] = l->locale_territory[LC_COLLATE];
regs[1] = (int)s1;
regs[2] = (int)s2;
regs[3] = 0;
+@@ -21,3 +27,4 @@
+ __os_swi (Territory_Collate, regs);
+ return regs[0];
+ }
++
Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
-@@ -13,7 +13,7 @@
+@@ -11,9 +11,15 @@
+ size_t
+ strxfrm (char *to, const char *from, size_t size)
{
++ return strxfrm_l (to, from, size, &__locale_global);
++}
++
++size_t
++strxfrm_l (char *to, const char *from, size_t size, locale_t l)
++{
int regs[10];
- regs[0] = __locale_territory[LC_COLLATE];
-+ regs[0] = __locale_global.locale_territory[LC_COLLATE];
++ regs[0] = l->locale_territory[LC_COLLATE];
regs[1] = (int)to;
regs[2] = (int)from;
regs[3] = size;
@@ -1174,7 +1499,7 @@ Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+ {
+ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
+ if (*p1++ == '\0')
-+ break;
++ break;
+ p2 ++;
+ }
+
@@ -1215,6 +1540,21 @@ Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+ return i - j;
+}
+
+Index: gcc4/recipe/files/gcc/libunixlib/sys/errlist.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/sys/errlist.c (working copy)
+@@ -211,3 +211,10 @@
+
+ return 0;
+ }
++
++char *
++strerror_l (int errnum, locale_t l)
++{
++ (void) l;
++ return strerror (errnum);
++}
Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
@@ -1350,3 +1690,231 @@ Index: gcc4/recipe/files/gcc/libunixlib/vscript
__sdirinit;
__sfixinit;
__sfixfind;
+Index: gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/wchar/wctype.c (working copy)
+@@ -4,6 +4,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+ #include <wctype.h>
+
+ int
+@@ -71,3 +72,69 @@
+ {
+ return isxdigit (wc);
+ }
++
++int
++iswalnum_l (wint_t wc, locale_t locale)
++{
++ return isalnum_l (wc, locale);
++}
++
++int
++iswalpha_l (wint_t wc, locale_t locale)
++{
++ return isalpha_l (wc, locale);
++}
++
++int
++iswcntrl_l (wint_t wc, locale_t locale)
++{
++ return iscntrl_l (wc, locale);
++}
++
++int
++iswdigit_l (wint_t wc, locale_t locale)
++{
++ return isdigit_l (wc, locale);
++}
++
++int
++iswgraph_l (wint_t wc, locale_t locale)
++{
++ return isgraph_l (wc, locale);
++}
++
++int
++iswprint_l (wint_t wc, locale_t locale)
++{
++ return isprint_l (wc, locale);
++}
++
++int
++iswpunct_l (wint_t wc, locale_t locale)
++{
++ return ispunct_l (wc, locale);
++}
++
++int
++iswspace_l (wint_t wc, locale_t locale)
++{
++ return isspace_l (wc, locale);
++}
++
++int
++iswxdigit_l (wint_t wc, locale_t locale)
++{
++ return isxdigit_l (wc, locale);
++}
++
++wint_t
++towlower_l (wint_t wc, locale_t locale)
++{
++ return tolower_l (wc, locale);
++}
++
++wint_t
++towupper_l (wint_t wc, locale_t locale)
++{
++ return toupper_l (wc, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/wchar/wmissing.c (working copy)
+@@ -1,7 +1,7 @@
++#include <locale.h>
++#include <stdio.h>
+ #include <stdlib.h>
+ #include <wctype.h>
+-#include <wctype.h>
+-#include <stdio.h>
+
+ int iswupper (wint_t __wc)
+ {
+@@ -9,13 +9,26 @@
+ abort();
+ }
+
+-unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
+- wchar_t **__restrict __endptr, int __base)
++int
++iswupper_l (wint_t wc, locale_t locale)
+ {
+ printf("%s: Not implemented\n", __func__);
+ abort();
+ }
+
++int iswlower (wint_t __wc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int
++iswlower_l (wint_t wc, locale_t locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2)
+ {
+ printf("%s: Not implemented\n", __func__);
+@@ -22,12 +35,47 @@
+ abort();
+ }
+
+-int iswlower (wint_t __wc)
++int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ locale_t loc)
+ {
+ printf("%s: Not implemented\n", __func__);
+ abort();
+ }
+
++int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n, locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
++unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
++ wchar_t **__restrict __endptr, int __base)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ long long int wcstoll (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr, int __base)
+ {
+@@ -63,6 +111,13 @@
+ abort();
+ }
+
++size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
++ size_t __n, locale_t __loc)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ float wcstof (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr)
+ {
+@@ -83,6 +138,13 @@
+ abort();
+ }
+
++int
++iswblank_l (wint_t __wc, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ int iswctype (wint_t __wc, wctype_t __desc)
+ {
+ printf("%s: Not implemented\n", __func__);
+@@ -89,6 +151,12 @@
+ abort();
+ }
+
++int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
+ wchar_t **__restrict __endptr,
+ int __base)
+@@ -116,6 +184,12 @@
+ abort();
+ }
+
++wctype_t wctype_l (__const char *__property, locale_t __locale)
++{
++ printf("%s: Not implemented\n", __func__);
++ abort();
++}
++
+ wint_t ungetwc(wint_t wc, FILE *stream)
+ {
+ printf("%s: Not implemented\n", __func__);
--
Cross-compilation toolchains and environments
1 year, 3 months
toolchains: branch master updated. 22154acc24e6ca34f953c4e7b63b4e5527805086
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/22154acc24e6ca34f9...
...commit http://git.netsurf-browser.org/toolchains.git/commit/22154acc24e6ca34f953...
...tree http://git.netsurf-browser.org/toolchains.git/tree/22154acc24e6ca34f953c4...
The branch, master has been updated
via 22154acc24e6ca34f953c4e7b63b4e5527805086 (commit)
via d1cf1d78f301da6dc6ffd5b79867556ea5f15dd6 (commit)
via c3bff19a559b50cc88b4d27146222193bc11a2b1 (commit)
via 72cb8bef5540cc97e369c0e5754af35add9e776d (commit)
via 0498d005a489508a2dbd181d4cf145b2224a61de (commit)
from 2c28cd73e55b80b358ec008d07ff0cae310e96d6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
arm-unknown-riscos/Makefile | 4 +-
arm-unknown-riscos/fetchsrc | 2 +-
.../recipes/patches/gcc4/binutils-download.p | 4 +-
.../recipes/patches/gcc4/cloog-ppl-download.p | 2 +-
.../recipes/patches/gcc4/gmp-download.p | 4 +-
arm-unknown-riscos/recipes/patches/gcc4/no-scm.p | 11 +
.../recipes/patches/gcc4/posix-extended-locale.p | 1352 ++++++++++++++++++++
.../recipes/patches/gcc4/ppl-download.p | 4 +-
.../recipes/patches/gcc4/ppl-version.p | 175 ---
.../recipes/patches/gcc4/unixlib-ldrex-strex.p | 304 -----
m5475-atari-mint/fetchsrc | 2 +-
m68k-atari-mint/fetchsrc | 2 +-
sdk/recipes/patches/openssl/crypto.ctype.c.p | 11 -
13 files changed, 1375 insertions(+), 502 deletions(-)
create mode 100644 arm-unknown-riscos/recipes/patches/gcc4/no-scm.p
create mode 100644 arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
delete mode 100644 arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p
delete mode 100644 arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
delete mode 100644 sdk/recipes/patches/openssl/crypto.ctype.c.p
diff --git a/arm-unknown-riscos/Makefile b/arm-unknown-riscos/Makefile
index 64516de..017dcd9 100644
--- a/arm-unknown-riscos/Makefile
+++ b/arm-unknown-riscos/Makefile
@@ -1,5 +1,5 @@
# Use a tested trunk version of GCCSDK
-UPSTREAM_GCCSDK_VERSION := release_4_7_4_v2
+UPSTREAM_GCCSDK_VERSION := release_4_7_4_v6
UPSTREAM_GCCSDK_TARBALL := gcc4$(UPSTREAM_GCCSDK_VERSION).tar.gz
UPSTREAM_GCCSDK_URI := svn://svn.riscos.info/gccsdk/tags/$(UPSTREAM_GCCSDK_VERSION)
@@ -26,7 +26,7 @@ UPSTREAM_SQUEEZE_URI := git://git.netsurf-browser.org/squeeze.git
# Infozip
UPSTREAM_INFOZIP_VERSION := 30
UPSTREAM_INFOZIP_TARBALL := zip$(UPSTREAM_INFOZIP_VERSION).tar.gz
-UPSTREAM_INFOZIP_URI := http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29...
+UPSTREAM_INFOZIP_URI := https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%2...
TOP := $(CURDIR)
RECIPES := $(TOP)/recipes
diff --git a/arm-unknown-riscos/fetchsrc b/arm-unknown-riscos/fetchsrc
index e71d85f..92ae5bf 100755
--- a/arm-unknown-riscos/fetchsrc
+++ b/arm-unknown-riscos/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
index 54720f5..3f2f110 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
@@ -4,9 +4,9 @@
# Download binutils source:
$(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
+- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BIN...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BI...
ifeq "$(GCC_USE_SCM)" "yes"
# Checkout gcc source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
index 194ef7f..6f91911 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
@@ -6,7 +6,7 @@
-mkdir -p $(SRCORIGDIR)
- cd $(SRCORIGDIR) && wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-$(CLOOG_VERSION).tar.gz
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(CL...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(C...
# Download newlib source:
$(SRCORIGDIR)/newlib-$(NEWLIB_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
index 0bfd4ec..4f99d57 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
@@ -4,8 +4,8 @@
# Download mpc source:
$(SRCORIGDIR)/mpc-$(MPC_VERSION).tar.gz:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://www.multiprecision.org/mpc/download/mpc-$(MPC_VERSION).tar.gz
-+ cd $(SRCORIGDIR) && wget -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VERS...
+- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/mpc/mpc-$(MPC_VERSION).tar.gz
++ cd $(SRCORIGDIR) && wget -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VER...
touch $@
# Download mpfr source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p
new file mode 100644
index 0000000..5e12120
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p
@@ -0,0 +1,11 @@
+--- gcc4/Makefile (old)
++++ gcc4/Makefile (new)
+@@ -36,7 +36,7 @@
+ AUTOMAKE_FOR_GCC_VERSION=1.11.1
+ LIBTOOL_FOR_GCC_VERSION=2.4.2
+ GCC_VERSION=$(GCCSDK_SUPPORTED_GCC_RELEASE)
+-GCC_USE_SCM=yes
++GCC_USE_SCM=no
+ GCC_SCM_PATH=branches/gcc-4_7-branch
+ NEWLIB_VERSION=1.19.0
+ NEWLIB_USE_SCM=no
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
new file mode 100644
index 0000000..f378a7e
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -0,0 +1,1352 @@
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
+@@ -587,7 +587,7 @@
+ locale/setlocale.c \
+ locale/strcoll.c \
+ locale/strxfrm.c \
+- locale/territory.c
++ locale/newlocale.c
+ endif
+ locale_src += \
+ locale/iconv.c
+@@ -1312,6 +1312,7 @@
+ bits/in.h \
+ bits/libc-lock.h \
+ bits/locale.h \
++ bits/locale_t.h \
+ bits/mathcalls.h \
+ bits/mathdef.h \
+ bits/mathinline.h \
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
+@@ -10,36 +10,35 @@
+ #include <internal/os.h>
+ #include <internal/unix.h>
+
+-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must
+- support EOF. */
+-static unsigned char ctype[257];
+-const unsigned char * const __ctype = &ctype[1];
++/* Global containing current locale settings. */
++struct _locale __locale_global;
++/* Offset 1 as the first entry is reserved for EOF. */
++const unsigned char * const __ctype = &__locale_global.ctype[1];
++const short * const __ctype_upper = &__locale_global.ctype_upper[1];
++const short * const __ctype_lower = &__locale_global.ctype_lower[1];
+
+-static short ctype_upper[257];
+-const short * const __ctype_upper = &ctype_upper[1];
+-
+-static short ctype_lower[257];
+-const short * const __ctype_lower = &ctype_lower[1];
+-
+ void
+-__build_ctype_tables (int territory)
++__build_ctype_tables (locale_t locobj, int territory)
+ {
+ PTHREAD_UNSAFE
+
+ if (territory == -2)
+ {
+- /* Initialise the array. This is only done by __unixinit(). */
++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */
+ territory = -1;
+- for (int x = 0; x <= LC_ALL; x++)
+- __locale_territory[x] = -1;
++ for (int x = 0; x < LC_ALL; x++)
++ locobj->locale_territory[x] = -1;
++ __localeconv_lconv_init(&locobj->lc);
++ locobj->lc_needs_refresh = 1;
+ }
+
+ /* Initialise ctype_upper/ctype_lower tables. */
+ for (int x = 0; x < 257; x++)
+ {
+- /* In the C/POSIX locate, tolower(top bit set char)
++ /* In the C/POSIX locale, tolower(top bit set char)
+ should return the character unchanged. */
+- ctype_lower[x] = ctype_upper[x] = x - 1;
++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
++ locobj->ctype[x] = 0;
+ }
+
+ int regs[10];
+@@ -61,7 +60,7 @@
+ for (int offset = 1; bits; bits = bits >> 1, offset += 1)
+ {
+ if (bits & 1)
+- ctype[pos + offset] |= 1 << code;
++ locobj->ctype[pos + offset] |= 1 << code;
+ }
+ pos += 32;
+ }
+@@ -80,7 +79,7 @@
+ int y = (territory == -1) ? 128 : 256;
+ for (int x = 1; x <= y; x++)
+ {
+- ctype_lower[x] = (short)*p++;
+- ctype_upper[x] = (short)*q++;
++ locobj->ctype_lower[x] = (short)*p++;
++ locobj->ctype_upper[x] = (short)*q++;
+ }
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalnum) (int c)
+@@ -10,3 +11,8 @@
+ return isalnum (c);
+ }
+
++int
++isalnum_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalpha) (int c)
+@@ -10,3 +11,8 @@
+ return isalpha (c);
+ }
+
++int
++isalpha_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_alpha);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return isascii (c);
+ }
+
++int
++isascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy)
+@@ -9,3 +9,10 @@
+ {
+ return isblank (c);
+ }
++
++int
++isblank_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isblank (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (iscntrl) (int c)
+@@ -10,3 +11,8 @@
+ return iscntrl (c);
+ }
+
++int
++iscntrl_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isdigit (c);
+ }
+
++int
++isdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_digit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isgraph) (int c)
+@@ -10,3 +11,8 @@
+ return isgraph (c);
+ }
+
++int
++isgraph_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (islower) (int c)
+@@ -10,3 +11,8 @@
+ return islower (c);
+ }
+
++int
++islower_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_lower);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isprint) (int c)
+@@ -10,3 +11,10 @@
+ return isprint (c);
+ }
+
++int
++isprint_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] &
++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc |
++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (ispunct) (int c)
+@@ -10,3 +11,8 @@
+ return ispunct (c);
+ }
+
++int
++ispunct_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_punc);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isspace) (int c)
+@@ -10,3 +11,8 @@
+ return isspace (c);
+ }
+
++int
++isspace_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_white);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isupper) (int c)
+@@ -10,3 +11,8 @@
+ return isupper (c);
+ }
+
++int
++isupper_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_upper);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isxdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isxdigit (c);
+ }
+
++int
++isxdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return toascii (c);
+ }
+
++int
++toascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return toascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (tolower) (int c)
+@@ -10,3 +11,8 @@
+ return tolower (c);
+ }
+
++int
++tolower_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_lower[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (toupper) (int c)
+@@ -10,3 +11,8 @@
+ return toupper (c);
+ }
+
++int
++toupper_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_upper[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy)
+@@ -13,15 +13,36 @@
+
+ #ifndef __TARGET_SCL__
+
+-/* Territory number for each locale. C locale is -1. */
+-extern int __locale_territory[LC_ALL + 1];
++struct _locale {
++ /* Map from locale category to territory number. C locale is -1. */
++ int locale_territory[LC_ALL];
+
+-/* Set to 1 is setlocale has been called since the last call to
+- localeconv. localeconv uses this flag to cache the lconv structure. */
+-extern int __setlocale_called;
++ /* Character type LUTs: EOF + one entry per character
++ *
++ * EOF is defined as -1, so character entries start at offset 1.
++ */
++ short ctype_upper[257];
++ short ctype_lower[257];
++ unsigned char ctype[257];
+
+-extern void __build_ctype_tables (int __territory) __THROW;
++ /* Set to 1 if the locale information has changed since the last time
++ * the lconv structure was updated. */
++ int lc_needs_refresh;
++ /* Numeric formatting information for locale */
++ struct lconv lc;
++};
+
++extern struct _locale __locale_global;
++
++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW;
++
++extern char *__setlocale_l (locale_t locobj, int __category,
++ const char *__locale) __THROW;
++
++void __localeconv_lconv_init (struct lconv *lc);
++void __localeconv_lconv_fini (struct lconv *lc);
++void __localeconv_l (locale_t locobj);
++
+ #endif
+
+ __END_DECLS
+Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+@@ -0,0 +1,10 @@
++/*
++ * Copyright (c) 2022 UnixLib Developers
++ */
++
++#ifndef _BITS_LOCALE_T_H_
++#define _BITS_LOCALE_T_H_
++
++typedef struct _locale *locale_t;
++
++#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy)
+@@ -51,6 +51,48 @@
+ extern int isblank (int __c) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++/* c is alphabetic or numeric. */
++extern int isalnum_l (int __c, locale_t locobj) __THROW;
++
++/* c is alphabetic. */
++extern int isalpha_l (int __c, locale_t locobj) __THROW;
++
++/* c is a control character. */
++extern int iscntrl_l (int __c, locale_t locobj) __THROW;
++
++/* c is a decimal digit. */
++extern int isdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is any printable character other than a space. */
++extern int isgraph_l (int __c, locale_t locobj) __THROW;
++
++/* c is a lower-case letter. */
++extern int islower_l (int __c, locale_t locobj) __THROW;
++
++/* c is an upper-case letter. */
++extern int isupper_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character. */
++extern int isprint_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character other than a space or a
++ alphanumeric character. */
++extern int ispunct_l (int __c, locale_t locobj) __THROW;
++
++/* c is a white space character e.g. space, newline, tab, linefeed,
++ return, vertical tab. */
++extern int isspace_l (int __c, locale_t locobj) __THROW;
++
++/* c is a hex digit. */
++extern int isxdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is tab or space. */
++extern int isblank_l (int __c, locale_t locobj) __THROW;
++# endif
++
+ /* Characteristics. */
+ extern const unsigned char * const __ctype;
+ /* Lower case table. */
+@@ -108,6 +150,10 @@
+ extern int toupper (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define toupper(c) ((int) __ctype_upper[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int toupper_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ /* Convert c to lower case. */
+@@ -114,6 +160,10 @@
+ extern int tolower (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define tolower(c) ((int) __ctype_lower[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int tolower_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ #ifndef __TARGET_SCL__
+@@ -135,6 +185,11 @@
+ /* Is c an ASCII character. */
+ extern int isascii (int __c) __THROW;
+ # define isascii(c) ((unsigned)(c) <= 0x7f)
++
++# ifdef __USE_XOPEN2K8
++extern int toascii_l (int __c, locale_t locobj) __THROW;
++extern int isascii_l (int __c, locale_t locobj) __THROW;
++# endif
+ # endif
+ #endif
+
+Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy)
+@@ -33,16 +33,16 @@
+ /* Entire locale. */
+ # define LC_ALL 6
+
+-#define LC_COLLATE_MASK (1L << 1)
+-#define LC_CTYPE_MASK (1L << 2)
+-#define LC_MESSAGES_MASK (1L << 3)
+-#define LC_MONETARY_MASK (1L << 4)
+-#define LC_NUMERIC_MASK (1L << 5)
+-#define LC_TIME_MASK (1L << 6)
+-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# ifdef __USE_XOPEN2K8
++# define LC_COLLATE_MASK (1L << 0)
++# define LC_CTYPE_MASK (1L << 1)
++# define LC_MESSAGES_MASK (1L << 2)
++# define LC_MONETARY_MASK (1L << 3)
++# define LC_NUMERIC_MASK (1L << 4)
++# define LC_TIME_MASK (1L << 5)
++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# endif
+
+-typedef struct _locale *locale_t;
+-
+ #else
+ /* String collation (functions 'strcoll' and 'strxfrm'). */
+ # define LC_COLLATE 1
+@@ -121,6 +121,9 @@
+ extern struct lconv *localeconv (void) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
+ extern locale_t uselocale(locale_t newloc);
+
+ extern void freelocale(locale_t locobj);
+@@ -127,7 +130,8 @@
+
+ extern locale_t newlocale(int category_mask, const char *locale,
+ locale_t base);
+-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# endif
+ #endif
+
+ __END_NAMESPACE_STD
+Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
+@@ -281,6 +281,17 @@
+ /* Compare no more than N chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
++
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
+ #endif /* Use BSD. */
+
+ #if defined __USE_XOPEN2K || defined __USE_MISC
+Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy)
+@@ -37,7 +37,17 @@
+ /* Compare n chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
++
+ /* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+ extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy)
+@@ -14,8 +14,6 @@
+
+ /* #define DEBUG */
+
+-int __setlocale_called = 1;
+-
+ static int
+ read_symbol (int reason_code, int territory)
+ {
+@@ -71,26 +69,44 @@
+ *grouping = new_grouping;
+ }
+
+-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL,
+- NULL, NULL, NULL, NULL, NULL,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX };
++void
++__localeconv_lconv_init (struct lconv *lc)
++{
++ memset(lc, 0, sizeof(*lc));
++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes =
++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space =
++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX;
++}
+
+-/* Defined by POSIX as not threadsafe */
+-struct lconv *
+-localeconv (void)
++void
++__localeconv_lconv_fini (struct lconv *lc)
+ {
++ free(lc->decimal_point);
++ free(lc->thousands_sep);
++ free(lc->grouping);
++ free(lc->int_curr_symbol);
++ free(lc->currency_symbol);
++ free(lc->mon_decimal_point);
++ free(lc->mon_thousands_sep);
++ free(lc->mon_grouping);
++ free(lc->positive_sign);
++ free(lc->negative_sign);
++}
++
++void
++__localeconv_l (locale_t locobj)
++{
+ int numeric, monetary;
+
+ /* If setlocale has not been called since the last call to
+ localeconv, then the lconv structure will be the same. */
+- if (!__setlocale_called)
+- return &lc;
++ if (!locobj->lc_needs_refresh)
++ return;
+
+- __setlocale_called = 0;
++ locobj->lc_needs_refresh = 0;
+
+- numeric = __locale_territory[LC_NUMERIC];
+- monetary = __locale_territory[LC_MONETARY];
++ numeric = locobj->locale_territory[LC_NUMERIC];
++ monetary = locobj->locale_territory[LC_MONETARY];
+
+ /* See the PRMs regarding SWI Territory_ReadSymbols for the
+ meanings of the following numbers. */
+@@ -97,71 +113,80 @@
+ if (numeric == -1)
+ {
+ /* We're using the 'C' locale. */
+- free (lc.decimal_point);
+- lc.decimal_point = strdup (".");
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ("");
+- free (lc.grouping);
+- lc.grouping = strdup ("");
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup (".");
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ("");
++ free (locobj->lc.grouping);
++ locobj->lc.grouping = strdup ("");
+ }
+ else
+ {
+- free (lc.decimal_point);
+- lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
+- read_byte_list (2, &lc.grouping, numeric);
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
++ read_byte_list (2, &locobj->lc.grouping, numeric);
+ }
+ if (monetary == -1)
+ {
+ /* We using the 'C' locale. Empty strings and CHAR_MAX means
+ that these fields are unspecified. */
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ("");
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ("");
+- free (lc.mon_grouping);
+- lc.mon_grouping = strdup ("");
+- lc.int_frac_digits = CHAR_MAX;
+- lc.frac_digits = CHAR_MAX;
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ("");
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ("");
+- lc.p_cs_precedes = CHAR_MAX;
+- lc.n_cs_precedes = CHAR_MAX;
+- lc.p_sep_by_space = CHAR_MAX;
+- lc.n_sep_by_space = CHAR_MAX;
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ("");
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ("");
+- lc.p_sign_posn = CHAR_MAX;
+- lc.n_sign_posn = CHAR_MAX;
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ("");
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ("");
++ free (locobj->lc.mon_grouping);
++ locobj->lc.mon_grouping = strdup ("");
++ locobj->lc.int_frac_digits = CHAR_MAX;
++ locobj->lc.frac_digits = CHAR_MAX;
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ("");
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ("");
++ locobj->lc.p_cs_precedes = CHAR_MAX;
++ locobj->lc.n_cs_precedes = CHAR_MAX;
++ locobj->lc.p_sep_by_space = CHAR_MAX;
++ locobj->lc.n_sep_by_space = CHAR_MAX;
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ("");
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ("");
++ locobj->lc.p_sign_posn = CHAR_MAX;
++ locobj->lc.n_sign_posn = CHAR_MAX;
+ }
+ else
+ {
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
+- read_byte_list (7, &lc.mon_grouping, monetary);
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
+- lc.int_frac_digits = (char)read_symbol (10, monetary);
+- lc.frac_digits = (char)read_symbol (11, monetary);
+- lc.p_cs_precedes = (char)read_symbol (12, monetary);
+- lc.p_sep_by_space = (char)read_symbol (13, monetary);
+- lc.n_cs_precedes = (char)read_symbol (14, monetary);
+- lc.n_sep_by_space = (char)read_symbol (15, monetary);
+- lc.p_sign_posn = (char)read_symbol (16, monetary);
+- lc.n_sign_posn = (char)read_symbol (17, monetary);
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
++ read_byte_list (7, &locobj->lc.mon_grouping, monetary);
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary);
++ locobj->lc.frac_digits = (char)read_symbol (11, monetary);
++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary);
++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary);
++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary);
++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary);
++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary);
++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary);
+ }
+- return &lc;
++ return;
+ }
++
++/* Defined by POSIX as not threadsafe */
++struct lconv *
++localeconv (void)
++{
++ __localeconv_l (&__locale_global);
++
++ return &__locale_global.lc;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
+@@ -1,15 +1,15 @@
+ /* Copyright (c) 2019 UnixLib Developers
+ */
+
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
++
++#include <internal/unix.h>
+
+-struct _locale {
+- struct lconv lc;
+-};
+-
+ /* This is supposed to be per-thread. */
+ static locale_t current_locale;
+
+@@ -27,20 +27,71 @@
+
+ void freelocale(locale_t locobj)
+ {
+- if (locobj)
++ if (locobj) {
++ __localeconv_lconv_fini(&locobj->lc);
+ free(locobj);
++ }
+ }
+
+ locale_t newlocale(int category_mask, const char *locale,
+ locale_t base)
+ {
+- locale_t loc = (locale_t)malloc(sizeof(*loc));
+- if (!loc) {
+- __set_errno (ENOMEM);
++ struct _locale tmp;
++
++ PTHREAD_UNSAFE
++
++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
++ __set_errno (EINVAL);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ /* The locale provided will be verified by __setlocale_l() */
+
+- return loc;
++ /* Prepare the temporary locale we will modify */
++ if (base != 0 && base != LC_GLOBAL_LOCALE) {
++ memcpy(&tmp, base, sizeof(tmp));
++ } else {
++ if (base == LC_GLOBAL_LOCALE) {
++ /* Undefined: be helpful to client */
++ memcpy(&tmp, &__locale_global, sizeof(tmp));
++ } else {
++ /* Initialise to C locale */
++ __build_ctype_tables(&tmp, -2);
++ }
++ }
++
++ /* Now, apply the requested locale to each of the categories in the mask */
++ if (category_mask == LC_ALL_MASK) {
++ /* Special-case LC_ALL to handle the encoded locale string */
++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) {
++ return 0;
++ }
++ } else {
++ int category = 0, mask = category_mask;
++ while (mask != 0) {
++ if (mask & 1) {
++ if (__setlocale_l(&tmp, category, locale) == NULL) {
++ return 0;
++ }
++ }
++ category++;
++ mask >>= 1;
++ }
++ }
++
++ /* Allocate the result, if necessary */
++ if (base == 0 || base == LC_GLOBAL_LOCALE) {
++ base = (locale_t)malloc(sizeof(*base));
++ if (!base) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++ }
++ /* Fill it in */
++ memcpy(base, &tmp, sizeof(tmp));
++
++ /* Mark the lconv data stale */
++ base->lc_needs_refresh = 1;
++
++ return base;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy)
+@@ -195,7 +195,7 @@
+ }
+
+ static void
+-do_lc_all (char *buffer, int size)
++do_lc_all (locale_t locobj, char *buffer, int size)
+ {
+ char temp[64];
+ int category, same = 1;
+@@ -204,13 +204,13 @@
+ setlocale to set all locales. If all locales are
+ the same, then we can produce a very short string. */
+ for (category = 1; category < LC_ALL; ++category)
+- if (__locale_territory[0] != __locale_territory[category])
++ if (locobj->locale_territory[0] != locobj->locale_territory[category])
+ same = 0;
+
+ if (same)
+ {
+ /* All locales are set to the same territory. */
+- territory_name (__locale_territory[0], buffer, size);
++ territory_name (locobj->locale_territory[0], buffer, size);
+ }
+ else
+ {
+@@ -218,7 +218,7 @@
+ LC_CATEGORY=country;LC_CATEGORY=country; ... */
+ for (category = 0; category < LC_ALL; ++category)
+ {
+- territory_name (__locale_territory[category], temp, sizeof (temp));
++ territory_name (locobj->locale_territory[category], temp, sizeof (temp));
+ buffer = stpcpy (buffer, locale_names[category]);
+ *buffer++ = '=';
+ buffer = stpcpy (buffer, temp);
+@@ -230,15 +230,13 @@
+ }
+
+ char *
+-setlocale (int category, const char *locale)
++__setlocale_l (locale_t locobj, int category, const char *locale)
+ {
+ int new_territory, changed;
+ static char old_locale[256];
+
+- PTHREAD_UNSAFE
+-
+ /* This tells localeconv to re-read data for the lconv structure. */
+- __setlocale_called = 1;
++ locobj->lc_needs_refresh = 1;
+
+ if (locale == NULL)
+ {
+@@ -247,11 +245,11 @@
+ {
+ /* The locale string is specially encoded for LC_ALL so we
+ could restore all locales at any time. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+- territory_name (__locale_territory[category], old_locale, sizeof (old_locale));
++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+@@ -270,7 +268,7 @@
+ /* Encode the locale string, as we will be returning this
+ later. Remember, setlocale returns the locale settings
+ that are about to be changed. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+
+ /* Check for an encoded (composite) name. Simply looking for
+ a semi-colon will verify this. */
+@@ -332,11 +330,11 @@
+
+ /* We now know all locales exist, so set them. */
+ for (category = 0; category < LC_ALL; ++category)
+- __locale_territory[category] = territory_number (newnames[category]);
++ locobj->locale_territory[category] = territory_number (newnames[category]);
+
+ /* Re-build the character type tables according to the new
+ locale settings. */
+- __build_ctype_tables (__locale_territory[LC_CTYPE]);
++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]);
+ return old_locale;
+ }
+ }
+@@ -359,9 +357,9 @@
+ /* Change the locale for all categories. old_locale was created
+ when we previously checked for a composite string. */
+ for (category = 0; category < LC_ALL; ++category)
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -368,12 +366,12 @@
+ else
+ {
+ /* Change the locale for just one category. */
+- territory_name (__locale_territory[category],
++ territory_name (locobj->locale_territory[category],
+ old_locale, sizeof (old_locale));
+
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -384,7 +382,16 @@
+ is changing. The GNU Java compiler is known to repeatedly call
+ setlocale. */
+ if (changed && (category == LC_ALL || category == LC_CTYPE))
+- __build_ctype_tables (new_territory);
++ __build_ctype_tables (locobj, new_territory);
+
+ return old_locale;
+ }
++
++char *
++setlocale (int category, const char *locale)
++{
++
++ PTHREAD_UNSAFE
++
++ return __setlocale_l(&__locale_global, category, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)s1;
+ regs[2] = (int)s2;
+ regs[3] = 0;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)to;
+ regs[2] = (int)from;
+ regs[3] = size;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent)
+@@ -1,10 +0,0 @@
+-/* __locale_territory
+- * Copyright (c) 2000-2006 UnixLib Developers
+- */
+-
+-#include <locale.h>
+-
+-/* Global used for all calls to the Territory module. These variable
+- contain the territory number as set by setlocale. A value of
+- -1 means use the C locale. */
+-int __locale_territory[LC_ALL + 1];
+Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy)
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ stricmp (const char *s1, const char *s2)
+@@ -26,3 +27,24 @@
+ return result;
+ }
+ strong_alias (stricmp, strcasecmp)
++
++int
++strcasecmp_l (const char *s1, const char *s2, locale_t locobj)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ int result = 0;
++
++ if (p1 == p2)
++ return result;
++
++ while (! result)
++ {
++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
++ if (*p1++ == '\0')
++ break;
++ p2 ++;
++ }
++
++ return result;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy)
+@@ -5,6 +5,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ strnicmp (const char *s1, const char *s2, size_t n)
+@@ -26,3 +27,22 @@
+ }
+ strong_alias (strnicmp, strncasecmp)
+
++int
++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj)
++{
++ int i, j;
++
++ if (!n)
++ return 0;
++
++ do
++ {
++ i = *s1++, j = *s2++;
++ i = tolower_l (i, locobj);
++ j = tolower_l (j, locobj);
++ }
++ while (i && i == j && --n);
++
++ return i - j;
++}
++
+Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy)
+@@ -49,7 +49,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals);
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy)
+@@ -46,7 +46,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy)
+@@ -28,7 +28,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy)
+@@ -23,7 +23,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ ordinals)) != NULL)
+Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy)
+@@ -48,7 +48,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ result,
+Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy)
+@@ -353,7 +353,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+@@ -368,7 +368,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy)
+@@ -36,7 +36,7 @@
+ /* Get timezone information for current territory. */
+ _kernel_swi_regs regs;
+ #ifndef __TARGET_SCL__
+- regs.r[0] = __locale_territory[LC_TIME];
++ regs.r[0] = __locale_global.locale_territory[LC_TIME];
+ #else
+ regs.r[0] = -1; /* Current territory. */
+ #endif
+Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy)
+@@ -191,7 +191,7 @@
+ __pthread_prog_init ();
+ __unixlib_signal_initialise (__u);
+ /* Initialise ctype tables to the C locale. */
+- __build_ctype_tables (-2);
++ __build_ctype_tables (&__locale_global, -2);
+ /* Define and initialise the Unix I/O. */
+ initialise_unix_io ();
+ __stdioinit ();
+Index: gcc4/recipe/files/gcc/libunixlib/vscript
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy)
+@@ -58,6 +58,9 @@
+ __init_des_r;
+ __init_des;
+ __invalidate;
++ __locale_global;
++ __localeconv_lconv_init;
++ __localeconv_lconv_fini;
+ malloc_trim;
+ malloc_trim_unlocked;
+ malloc_unlocked;
+@@ -80,6 +83,7 @@
+ __res_vinit;
+ __runtime_features;
+ __setup_signalhandler_stack;
++ __setlocale_l;
+ __sdirinit;
+ __sfixinit;
+ __sfixfind;
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
index 7eb77c3..128e9eb 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
@@ -19,9 +19,9 @@
-$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz:
+$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://www.cs.unipr.it/ppl/download/ftp/releases/$(PPL_VERSION)/ppl-$(PPL...
+- cd $(SRCORIGDIR) && wget -c https://www.bugseng.com/external/ppl/download/ftp/releases/$(PPL_VERSION)...
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VERS...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VER...
# Download CLooG source:
$(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p
deleted file mode 100644
index 7631c68..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p
+++ /dev/null
@@ -1,175 +0,0 @@
-Index: gcc4/Makefile
-===================================================================
---- gcc4/Makefile (revision 7156)
-+++ gcc4/Makefile (working copy)
-@@ -45,7 +45,7 @@
- MPFR_VERSION=3.0.1
- MPC_VERSION=0.8.2
- GCC_USE_PPL_CLOOG=yes
--PPL_VERSION=0.11.2
-+PPL_VERSION=1.2
- CLOOG_VERSION=0.15.11
- GCC_USE_LTO=yes
-
-@@ -182,8 +182,8 @@
- RONATIVE_MPFR_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-
- # Configure arguments PPL:
--CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS)
--RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-+CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS)
-+RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-
- # Configure arguments CLooG:
- CROSS_CLOOG_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_CROSSGCC_LIBS) --with-bits=gmp --with-ppl=$(PREFIX_CROSSGCC_LIBS) --with-host-libstdcxx='-lstdc++' --prefix=$(PREFIX_CROSSGCC_LIBS)
-Index: gcc4/recipe/patches/cloog/configure.in.p
-===================================================================
---- gcc4/recipe/patches/cloog/configure.in.p (revision 7156)
-+++ gcc4/recipe/patches/cloog/configure.in.p (working copy)
-@@ -1,5 +1,5 @@
----- configure.in.orig 2013-05-01 16:15:33.235945936 +0200
--+++ configure.in 2013-05-01 16:15:15.484169106 +0200
-+--- configure.in.orig 2017-04-23 11:55:00.956204411 +0100
-++++ configure.in 2017-04-23 11:50:39.385519538 +0100
- @@ -41,7 +41,7 @@ dnl ************************************
- AC_PREREQ(2.13)
- AC_INIT(source/cloog.c)
-@@ -9,7 +9,13 @@
- dnl Every other copy of the package version number gets its value from here.
- AM_INIT_AUTOMAKE(cloog, 0.15)
- AC_CONFIG_HEADER(include/cloog/cloog-config.h)
--@@ -343,7 +343,7 @@ if test "x$with_ppl" != "x" -a "x$with_p
-+@@ -338,12 +338,12 @@ if test "x$with_ppl" != "x" -a "x$with_p
-+
-+ AC_MSG_CHECKING([for version 0.10 (or later revision) of PPL])
-+ AC_TRY_COMPILE([#include "ppl_c.h"],[
-+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
-++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 10
-+ choke me
- #endif
- ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
-
-Index: gcc4/recipe/patches/gcc/configure.ac.p
-===================================================================
---- gcc4/recipe/patches/gcc/configure.ac.p (revision 7156)
-+++ gcc4/recipe/patches/gcc/configure.ac.p (working copy)
-@@ -1,6 +1,6 @@
- Index: configure.ac
- ===================================================================
----- configure.ac (revision 197339)
-+--- configure.ac (revision 247077)
- +++ configure.ac (working copy)
- @@ -152,6 +152,7 @@
- # Note that libiberty is not a target library.
-@@ -34,6 +34,15 @@
-
- if test "$enable_ppl_version_check" != no; then
- saved_CFLAGS="$CFLAGS"
-+@@ -1577,7 +1586,7 @@
-+ CFLAGS="$CFLAGS $pplinc $gmpinc"
-+ AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL])
-+ AC_TRY_COMPILE([#include "ppl_c.h"],[
-+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
-++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
-+ choke me
-+ #endif
-+ ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ])
- @@ -2895,6 +2904,10 @@
- ;;
- esac
-Index: gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Congruence_System.defs.hh.orig 2015-03-01 19:57:52.887328139 +0100
--+++ src/Congruence_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Grid.types.hh"
-- #include "Grid_Certificate.types.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -235,7 +236,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Congruence,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Congruence*,
-- const Congruence&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Constraint_System.defs.hh.orig 2015-03-01 19:58:03.831328106 +0100
--+++ src/Constraint_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Congruence_System.types.hh"
-- #include <iterator>
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -204,7 +205,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Constraint,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Constraint*,
-- const Constraint&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Generator_System.defs.hh.orig 2015-03-01 19:58:13.511328077 +0100
--+++ src/Generator_System.defs.hh 2015-03-01 19:57:12.319328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Polyhedron.types.hh"
-- #include "Poly_Con_Relation.defs.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -250,7 +251,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Generator,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Generator*,
-- const Generator&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Grid_Generator_System.defs.hh.orig 2015-03-01 19:57:31.127328203 +0100
--+++ src/Grid_Generator_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -30,6 +30,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Variables_Set.types.hh"
-- #include "Grid.types.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -267,7 +268,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Grid_Generator,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Grid_Generator*,
-- const Grid_Generator&>,
-- private Generator_System::const_iterator {
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
deleted file mode 100644
index 045a0b8..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
+++ /dev/null
@@ -1,304 +0,0 @@
-Backport r7043 from upstream: partially replaces use of SWP with LDREX/STREX
-on systems where SWP is no longer available. This fix is incomplete,
-but sufficient for our purposes.
-
-Fri Mar 11 14:51:54 GMT 2016 Lee Noar <leenoar(a)sky.com>
-
- * sys/_cpucaps.s: New file. Provide functions to probe the
- OS for details of the CPU (currently SWP, LDREX/STREX
- availability).
- * Makefile.am: Add above file.
- * include/unixlib/local.h: Add declarations for user facing
- functions provided above.
- * incl-local/internal/asm_dec.s(__ul_global): Add entry to
- record CPU flags.
- * incl-local/internal/unix.h: Likewise.
- * pthread/_ints.s(__pthread_disable_ints,__pthread_protect_unsafe):
- Use CPU flags to determine whether to use the SWP instruction or
- LRDEX/STREX.
- * sys/_syslib.s(__main): Add call to __probe_cpu_caps.
- (__unixlib_fatal): Use CPU flags to determine whether to use the
- SWP instruction or LRDEX/STREX.
-
-
-Index: gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7043)
-@@ -2,7 +2,7 @@
- @ disable_ints can be called multiple times, provided enable_ints is
- @ subsequently called an equal number of times
- @ Written by Martin Piper and Alex Waugh
--@ Copyright (c) 2002-2008 UnixLib Developers
-+@ Copyright (c) 2002-2016 UnixLib Developers
-
- #include "internal/asm_dec.s"
-
-@@ -20,15 +20,26 @@
- PICEQ "LDR a2, [a2, #0]"
- PICEQ "LDR a2, [a2, #__GOTT_INDEX__]" @ a2 = GOT ptr
-
-- LDR a1, .L0 @=__ul_global
-+ LDR a1, .L0 @ =__ul_global
- PICEQ "LDR a1, [a2, a1]"
-+ LDR a4, [a1, #GBL_CPU_FLAGS]
- ADD a1, a1, #GBL_PTH_WORKSEMAPHORE
-+ TST a4, #__CPUCAP_HAVE_SWP
-+ @ From this point onwards we will not be interrupted by the callback
-+ BEQ 0f
-+
- MOV a3, #1
- SWP a2, a3, [a1]
-- @ From this point onwards we will not be interrupted by the callback
- ADD a2, a2, #1
- STR a2, [a1]
- MOV pc, lr
-+0:
-+ LDREX a2, [a1]
-+ ADD a2, a2, #1
-+ STREX a3, a2, [a1]
-+ TEQ a3, #1
-+ BEQ 0b
-+ MOV pc, lr
- .L0:
- WORD __ul_global
- DECLARE_FUNCTION __pthread_disable_ints
-@@ -78,18 +89,32 @@
- PICEQ "LDR a1, [a1, #0]"
- PICEQ "LDR a1, [a1, #__GOTT_INDEX__]" @ a1 = GOT ptr
-
-- LDR a4, .L2 @=__ul_global
-+ LDR a4, .L2 @ =__ul_global
- PICEQ "LDR a4, [a1, a4]"
-+ LDR a2, [a4, #GBL_CPU_FLAGS]
- ADD a1, a4, #GBL_PTH_WORKSEMAPHORE
-+ TST a2, #__CPUCAP_HAVE_SWP
-+ @ From this point onwards we cannot be interrupted by the callback
-+ BEQ 0f
-+
- MOV a2, #1
- SWP a3, a2, [a1]
-- @ From this point onwards we cannot be interrupted by the callback
- CMP a3, #0
-- STRNE a3, [a1, #0] @ Restore original value
-+ BEQ 1f
-+ STR a3, [a1, #0] @ Restore original value
- @ Return, as if ints are disabled on entry to the
- @ calling function then they should not be reenabled
- @ until the calling function has returned
-+ MOV pc, lr
-+0:
-+ LDREX a3, [a1]
-+ MOV ip, #1
-+ STREX a2, ip, [a1]
-+ TEQ a2, #1
-+ BEQ 0b
-+ TEQ a3, #0
- MOVNE pc, lr
-+1:
-
- #if __UNIXLIB_PARANOID
- LDR a3, [a4, #GBL_PTH_RETURN_ADDRESS]
-Index: gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7043)
-@@ -133,6 +133,16 @@
- socket. Is -1 when socket handle is not valid. */
- extern int __get_ro_socket (int __sockfd);
-
-+/* Return 1 if the SWP instruction is available, otherwise 0. */
-+extern unsigned int __cpucap_have_swp (void);
-+
-+/* Return 1 if the LDREX/STREX instructions are available, otherwise 0. */
-+extern unsigned int __cpucap_have_rex (void);
-+
-+/* Return 1 if the LDREX/STREX instructions that operate on bytes, half-words
-+ and double words are available, otherwise 0. */
-+extern unsigned int __cpucap_have_rexbhd (void);
-+
- __END_DECLS
-
- #endif
- * incl-local/internal/asm_dec.s(XSOM_DeregisterClient): Add
-Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7043)
-@@ -1027,6 +1027,7 @@
- sys/sigsetjmp.c \
- sys/stackalloc.c \
- sys/vfork.c \
-+ sys/_cpucaps.s \
- sys/_getcpuarch.s \
- sys/_jmp.s \
- sys/_mman.s \
-Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7043)
-@@ -269,8 +269,10 @@
- .set GBL_FLS_LBSTM_ON_RD, 108 @ = __ul_global.fls_lbstm_on_rd
- .set GBL_PTH_CALLEVERY_RMA, 112 @ = __ul_global.pthread_callevery_rma
-
-+.set GBL_CPU_FLAGS, 116 @ = __ul_global.cpu_flags
-+
- #if !defined(__SOFTFP__) && defined(__VFP_FP__)
--.set GBL_VFP_REGCOUNT, 116 @ = __ul_global.vfp_regcount
-+.set GBL_VFP_REGCOUNT, 120 @ = __ul_global.vfp_regcount
- #endif
-
- @ Entries in the __ul_memory table. Must be kept in sync with
-@@ -322,3 +324,7 @@
- .set CRT1_LIB_FINI, 32 @ Ptr to function to finalise shared libraries
- @ at program exit - can be NULL.
- #endif
-+
-+#define __CPUCAP_HAVE_SWP 0x1
-+#define __CPUCAP_HAVE_REX 0x2
-+#define __CPUCAP_HAVE_REXBHD 0x4
-Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7043)
-@@ -197,6 +197,8 @@
- the life of the program. This block is passed to the call_every handler in
- r12. */
-
-+ unsigned int cpu_flags; /* Flags indicating the capabilities of the CPU. */
-+
- #if !defined(__SOFTFP__) && defined(__VFP_FP__)
- int vfp_regcount; /* Number of doubleword registers we should request for
- VFP contexts */
-Index: gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 0)
-+++ gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 7043)
-@@ -0,0 +1,91 @@
-+@ Determine the capabilities of the CPU and allow callers to enquire
-+@ what they are.
-+@ Copyright (c) 2016 UnixLib Developers.
-+@ Written by Lee Noar.
-+
-+#include "internal/asm_dec.s"
-+
-+ .text
-+
-+@ Determine what the CPU capabilities are, and record them.
-+@ Called early on during program initialisation in _syslib.s.
-+ .global __probe_cpu_caps
-+ NAME __probe_cpu_caps
-+__probe_cpu_caps:
-+ MOV r0, #0
-+ SWI XOS_PlatformFeatures
-+ MOVVS r0, #0
-+
-+ MOV r2, #0
-+ @ The OS flag is set to 1 to indicate _no_ SWP instruction available (for
-+ @ backwards compatibility). We reverse it here and set our flag to 1 to
-+ @ indicate that SWP _is_ available.
-+ TST r0, #1<<11 @ SWP{B} not available
-+ ORREQ r2, r2, #__CPUCAP_HAVE_SWP
-+ TST r0, #1<<12 @ LDREX/STREX available
-+ ORRNE r2, r2, #__CPUCAP_HAVE_REX
-+ TST r0, #1<<13 @ LDREX/STREX{B/H/D} available
-+ ORRNE r2, r2, #__CPUCAP_HAVE_REXBHD
-+
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ STR r2, [r1, #GBL_CPU_FLAGS]
-+
-+ MOV pc, lr
-+.L0:
-+ WORD __ul_global
-+ DECLARE_FUNCTION __probe_cpu_caps
-+
-+ .global __cpucap_have_swp
-+ NAME __cpucap_have_swp
-+__cpucap_have_swp:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_SWP
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_swp
-+
-+@ Return 1 if LDREX/STREX instructions are available on the CPU, otherwise 0.
-+ .global __cpucap_have_rex
-+ NAME __cpucap_have_rex
-+__cpucap_have_rex:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_REX
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_rex
-+
-+@ Return 1 if LDREX/STREX instructions that work on non-32 bit data sizes
-+@ are available on the CPU, otherwise 0.
-+ .global __cpucap_have_rexbhd
-+ NAME __cpucap_have_rexbhd
-+__cpucap_have_rexbhd:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_REXBHD
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_rexbhd
-Index: gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7043)
-@@ -255,6 +255,8 @@
- BCC __exit_with_error_num
- unknown_cpu_arch:
-
-+ BL __probe_cpu_caps
-+
- @ Use of DAs explicitly overridden if __dynamic_no_da is declared
- MOV lr, #-1
- STR lr, [ip, #GBL_DYNAMIC_NUM]
-@@ -1286,9 +1288,21 @@
- @ error handling. As last resort to avoid an infinite loop
- @ we go for a straight OS_Exit scenario. Anything better we
- @ can do ?
-+ ADD a3, a4, #GBL_PANIC_MODE
-+ LDR a2, [a4, #GBL_CPU_FLAGS]
-+ TST a2, #__CPUCAP_HAVE_SWP
-+ BEQ 0f
-+
- MOV a2, #1
-- ADD a3, a4, #GBL_PANIC_MODE
- SWP a2, a2, [a3]
-+ B 1f
-+0:
-+ LDREX a2, [a3]
-+ MOV ip, #1
-+ STREX lr, ip, [a3]
-+ TEQ lr, #1
-+ BEQ 0b
-+1:
- TEQ a2, #0
- BEQ __unixlib_fatal_cont1
-
diff --git a/m5475-atari-mint/fetchsrc b/m5475-atari-mint/fetchsrc
index bbe8f6b..9396a4e 100755
--- a/m5475-atari-mint/fetchsrc
+++ b/m5475-atari-mint/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
diff --git a/m68k-atari-mint/fetchsrc b/m68k-atari-mint/fetchsrc
index e71d85f..92ae5bf 100755
--- a/m68k-atari-mint/fetchsrc
+++ b/m68k-atari-mint/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
deleted file mode 100644
index e0ecc21..0000000
--- a/sdk/recipes/patches/openssl/crypto.ctype.c.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
---- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
-@@ -295,7 +295,7 @@
- /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
- * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
-
--#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
-+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
-
- # if defined OPENSSL_SYS_WINDOWS
- # define locale_t _locale_t
--
Cross-compilation toolchains and environments
1 year, 3 months
toolchains: branch jmb/gccsdk-4.7.4r6 updated. 3cb936c6440affd4218edc901ec0cf24f048fa2b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/3cb936c6440affd421...
...commit http://git.netsurf-browser.org/toolchains.git/commit/3cb936c6440affd4218e...
...tree http://git.netsurf-browser.org/toolchains.git/tree/3cb936c6440affd4218edc...
The branch, jmb/gccsdk-4.7.4r6 has been updated
discards d695f894ba789bbf803ddf242c1efbd203773b0a (commit)
discards c7e8c85170de25597cabecfae80a76ee8b581938 (commit)
discards 892c5d970932541f9a5261fe75d0bb04384954a5 (commit)
via 3cb936c6440affd4218edc901ec0cf24f048fa2b (commit)
via 22154acc24e6ca34f953c4e7b63b4e5527805086 (commit)
via d1cf1d78f301da6dc6ffd5b79867556ea5f15dd6 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (d695f894ba789bbf803ddf242c1efbd203773b0a)
\
N -- N -- N (3cb936c6440affd4218edc901ec0cf24f048fa2b)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=3cb936c6440affd4...
commit 3cb936c6440affd4218edc901ec0cf24f048fa2b
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
arm-unknown-riscos: drop GCC download patches
Not useful if the CI cache doesn't have the things we need
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
deleted file mode 100644
index 3f2f110..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
+++ /dev/null
@@ -1,12 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 10:37:32.006594122 +0000
-+++ gcc4/Makefile 2018-01-26 10:38:42.316723336 +0000
-@@ -677,8 +677,7 @@
- # Download binutils source:
- $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BI...
-
- ifeq "$(GCC_USE_SCM)" "yes"
- # Checkout gcc source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
deleted file mode 100644
index 6f91911..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
+++ /dev/null
@@ -1,12 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 10:40:26.623881778 +0000
-+++ gcc4/Makefile 2018-01-26 10:41:24.141623273 +0000
-@@ -719,8 +719,7 @@
- # Download CLooG source:
- $(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-$(CLOOG_VERSION).tar.gz
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(C...
-
- # Download newlib source:
- $(SRCORIGDIR)/newlib-$(NEWLIB_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
deleted file mode 100644
index 4f99d57..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- gcc4/Makefile.orig 2018-01-25 22:42:43.937180762 +0000
-+++ gcc4/Makefile 2018-01-25 22:44:46.680863288 +0000
-@@ -703,7 +703,7 @@
- # Download mpc source:
- $(SRCORIGDIR)/mpc-$(MPC_VERSION).tar.gz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/mpc/mpc-$(MPC_VERSION).tar.gz
-+ cd $(SRCORIGDIR) && wget -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VER...
- touch $@
-
- # Download mpfr source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
deleted file mode 100644
index 128e9eb..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
+++ /dev/null
@@ -1,27 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 08:03:49.745541843 +0000
-+++ gcc4/Makefile 2018-01-26 08:05:15.256056177 +0000
-@@ -586,9 +586,9 @@
- touch $(BUILDSTEPSDIR)/$@
-
- # Unpack & copy ppl source:
--src-ppl-copied: $(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz
-+src-ppl-copied: $(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz
- -rm -rf $(SRCORIGDIR)/ppl-$(PPL_VERSION) $(SRCDIR)/ppl
-- cd $(SRCORIGDIR) && tar xf $<
-+ cd $(SRCORIGDIR) && tar axf $<
- -mkdir -p $(SRCDIR)/ppl
- cp -T -p -r $(SRCORIGDIR)/ppl-$(PPL_VERSION) $(SRCDIR)/ppl
- cd $(SRCDIR)/ppl && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" && $(SCRIPTSDIR)/do-patch-and-copy $(RECIPEDIR)
-@@ -713,10 +713,9 @@
- touch $@
-
- # Download ppl source:
--$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz:
-+$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://www.bugseng.com/external/ppl/download/ftp/releases/$(PPL_VERSION)...
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VER...
-
- # Download CLooG source:
- $(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=22154acc24e6ca34...
commit 22154acc24e6ca34f953c4e7b63b4e5527805086
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
OpenSSL: drop unnecessary patch
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
deleted file mode 100644
index e0ecc21..0000000
--- a/sdk/recipes/patches/openssl/crypto.ctype.c.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
---- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
-@@ -295,7 +295,7 @@
- /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
- * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
-
--#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
-+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
-
- # if defined OPENSSL_SYS_WINDOWS
- # define locale_t _locale_t
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=d1cf1d78f301da6d...
commit d1cf1d78f301da6dc6ffd5b79867556ea5f15dd6
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
UnixLib: add POSIX extended locale support
This is not a complete implementation, but is sufficient for
OpenSSL3's purposes.
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
new file mode 100644
index 0000000..f378a7e
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -0,0 +1,1352 @@
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
+@@ -587,7 +587,7 @@
+ locale/setlocale.c \
+ locale/strcoll.c \
+ locale/strxfrm.c \
+- locale/territory.c
++ locale/newlocale.c
+ endif
+ locale_src += \
+ locale/iconv.c
+@@ -1312,6 +1312,7 @@
+ bits/in.h \
+ bits/libc-lock.h \
+ bits/locale.h \
++ bits/locale_t.h \
+ bits/mathcalls.h \
+ bits/mathdef.h \
+ bits/mathinline.h \
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
+@@ -10,36 +10,35 @@
+ #include <internal/os.h>
+ #include <internal/unix.h>
+
+-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must
+- support EOF. */
+-static unsigned char ctype[257];
+-const unsigned char * const __ctype = &ctype[1];
++/* Global containing current locale settings. */
++struct _locale __locale_global;
++/* Offset 1 as the first entry is reserved for EOF. */
++const unsigned char * const __ctype = &__locale_global.ctype[1];
++const short * const __ctype_upper = &__locale_global.ctype_upper[1];
++const short * const __ctype_lower = &__locale_global.ctype_lower[1];
+
+-static short ctype_upper[257];
+-const short * const __ctype_upper = &ctype_upper[1];
+-
+-static short ctype_lower[257];
+-const short * const __ctype_lower = &ctype_lower[1];
+-
+ void
+-__build_ctype_tables (int territory)
++__build_ctype_tables (locale_t locobj, int territory)
+ {
+ PTHREAD_UNSAFE
+
+ if (territory == -2)
+ {
+- /* Initialise the array. This is only done by __unixinit(). */
++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */
+ territory = -1;
+- for (int x = 0; x <= LC_ALL; x++)
+- __locale_territory[x] = -1;
++ for (int x = 0; x < LC_ALL; x++)
++ locobj->locale_territory[x] = -1;
++ __localeconv_lconv_init(&locobj->lc);
++ locobj->lc_needs_refresh = 1;
+ }
+
+ /* Initialise ctype_upper/ctype_lower tables. */
+ for (int x = 0; x < 257; x++)
+ {
+- /* In the C/POSIX locate, tolower(top bit set char)
++ /* In the C/POSIX locale, tolower(top bit set char)
+ should return the character unchanged. */
+- ctype_lower[x] = ctype_upper[x] = x - 1;
++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
++ locobj->ctype[x] = 0;
+ }
+
+ int regs[10];
+@@ -61,7 +60,7 @@
+ for (int offset = 1; bits; bits = bits >> 1, offset += 1)
+ {
+ if (bits & 1)
+- ctype[pos + offset] |= 1 << code;
++ locobj->ctype[pos + offset] |= 1 << code;
+ }
+ pos += 32;
+ }
+@@ -80,7 +79,7 @@
+ int y = (territory == -1) ? 128 : 256;
+ for (int x = 1; x <= y; x++)
+ {
+- ctype_lower[x] = (short)*p++;
+- ctype_upper[x] = (short)*q++;
++ locobj->ctype_lower[x] = (short)*p++;
++ locobj->ctype_upper[x] = (short)*q++;
+ }
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalnum) (int c)
+@@ -10,3 +11,8 @@
+ return isalnum (c);
+ }
+
++int
++isalnum_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalpha) (int c)
+@@ -10,3 +11,8 @@
+ return isalpha (c);
+ }
+
++int
++isalpha_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_alpha);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return isascii (c);
+ }
+
++int
++isascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy)
+@@ -9,3 +9,10 @@
+ {
+ return isblank (c);
+ }
++
++int
++isblank_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isblank (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (iscntrl) (int c)
+@@ -10,3 +11,8 @@
+ return iscntrl (c);
+ }
+
++int
++iscntrl_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isdigit (c);
+ }
+
++int
++isdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_digit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isgraph) (int c)
+@@ -10,3 +11,8 @@
+ return isgraph (c);
+ }
+
++int
++isgraph_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (islower) (int c)
+@@ -10,3 +11,8 @@
+ return islower (c);
+ }
+
++int
++islower_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_lower);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isprint) (int c)
+@@ -10,3 +11,10 @@
+ return isprint (c);
+ }
+
++int
++isprint_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] &
++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc |
++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (ispunct) (int c)
+@@ -10,3 +11,8 @@
+ return ispunct (c);
+ }
+
++int
++ispunct_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_punc);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isspace) (int c)
+@@ -10,3 +11,8 @@
+ return isspace (c);
+ }
+
++int
++isspace_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_white);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isupper) (int c)
+@@ -10,3 +11,8 @@
+ return isupper (c);
+ }
+
++int
++isupper_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_upper);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isxdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isxdigit (c);
+ }
+
++int
++isxdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return toascii (c);
+ }
+
++int
++toascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return toascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (tolower) (int c)
+@@ -10,3 +11,8 @@
+ return tolower (c);
+ }
+
++int
++tolower_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_lower[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (toupper) (int c)
+@@ -10,3 +11,8 @@
+ return toupper (c);
+ }
+
++int
++toupper_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_upper[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy)
+@@ -13,15 +13,36 @@
+
+ #ifndef __TARGET_SCL__
+
+-/* Territory number for each locale. C locale is -1. */
+-extern int __locale_territory[LC_ALL + 1];
++struct _locale {
++ /* Map from locale category to territory number. C locale is -1. */
++ int locale_territory[LC_ALL];
+
+-/* Set to 1 is setlocale has been called since the last call to
+- localeconv. localeconv uses this flag to cache the lconv structure. */
+-extern int __setlocale_called;
++ /* Character type LUTs: EOF + one entry per character
++ *
++ * EOF is defined as -1, so character entries start at offset 1.
++ */
++ short ctype_upper[257];
++ short ctype_lower[257];
++ unsigned char ctype[257];
+
+-extern void __build_ctype_tables (int __territory) __THROW;
++ /* Set to 1 if the locale information has changed since the last time
++ * the lconv structure was updated. */
++ int lc_needs_refresh;
++ /* Numeric formatting information for locale */
++ struct lconv lc;
++};
+
++extern struct _locale __locale_global;
++
++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW;
++
++extern char *__setlocale_l (locale_t locobj, int __category,
++ const char *__locale) __THROW;
++
++void __localeconv_lconv_init (struct lconv *lc);
++void __localeconv_lconv_fini (struct lconv *lc);
++void __localeconv_l (locale_t locobj);
++
+ #endif
+
+ __END_DECLS
+Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+@@ -0,0 +1,10 @@
++/*
++ * Copyright (c) 2022 UnixLib Developers
++ */
++
++#ifndef _BITS_LOCALE_T_H_
++#define _BITS_LOCALE_T_H_
++
++typedef struct _locale *locale_t;
++
++#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy)
+@@ -51,6 +51,48 @@
+ extern int isblank (int __c) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++/* c is alphabetic or numeric. */
++extern int isalnum_l (int __c, locale_t locobj) __THROW;
++
++/* c is alphabetic. */
++extern int isalpha_l (int __c, locale_t locobj) __THROW;
++
++/* c is a control character. */
++extern int iscntrl_l (int __c, locale_t locobj) __THROW;
++
++/* c is a decimal digit. */
++extern int isdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is any printable character other than a space. */
++extern int isgraph_l (int __c, locale_t locobj) __THROW;
++
++/* c is a lower-case letter. */
++extern int islower_l (int __c, locale_t locobj) __THROW;
++
++/* c is an upper-case letter. */
++extern int isupper_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character. */
++extern int isprint_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character other than a space or a
++ alphanumeric character. */
++extern int ispunct_l (int __c, locale_t locobj) __THROW;
++
++/* c is a white space character e.g. space, newline, tab, linefeed,
++ return, vertical tab. */
++extern int isspace_l (int __c, locale_t locobj) __THROW;
++
++/* c is a hex digit. */
++extern int isxdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is tab or space. */
++extern int isblank_l (int __c, locale_t locobj) __THROW;
++# endif
++
+ /* Characteristics. */
+ extern const unsigned char * const __ctype;
+ /* Lower case table. */
+@@ -108,6 +150,10 @@
+ extern int toupper (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define toupper(c) ((int) __ctype_upper[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int toupper_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ /* Convert c to lower case. */
+@@ -114,6 +160,10 @@
+ extern int tolower (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define tolower(c) ((int) __ctype_lower[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int tolower_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ #ifndef __TARGET_SCL__
+@@ -135,6 +185,11 @@
+ /* Is c an ASCII character. */
+ extern int isascii (int __c) __THROW;
+ # define isascii(c) ((unsigned)(c) <= 0x7f)
++
++# ifdef __USE_XOPEN2K8
++extern int toascii_l (int __c, locale_t locobj) __THROW;
++extern int isascii_l (int __c, locale_t locobj) __THROW;
++# endif
+ # endif
+ #endif
+
+Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy)
+@@ -33,16 +33,16 @@
+ /* Entire locale. */
+ # define LC_ALL 6
+
+-#define LC_COLLATE_MASK (1L << 1)
+-#define LC_CTYPE_MASK (1L << 2)
+-#define LC_MESSAGES_MASK (1L << 3)
+-#define LC_MONETARY_MASK (1L << 4)
+-#define LC_NUMERIC_MASK (1L << 5)
+-#define LC_TIME_MASK (1L << 6)
+-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# ifdef __USE_XOPEN2K8
++# define LC_COLLATE_MASK (1L << 0)
++# define LC_CTYPE_MASK (1L << 1)
++# define LC_MESSAGES_MASK (1L << 2)
++# define LC_MONETARY_MASK (1L << 3)
++# define LC_NUMERIC_MASK (1L << 4)
++# define LC_TIME_MASK (1L << 5)
++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# endif
+
+-typedef struct _locale *locale_t;
+-
+ #else
+ /* String collation (functions 'strcoll' and 'strxfrm'). */
+ # define LC_COLLATE 1
+@@ -121,6 +121,9 @@
+ extern struct lconv *localeconv (void) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
+ extern locale_t uselocale(locale_t newloc);
+
+ extern void freelocale(locale_t locobj);
+@@ -127,7 +130,8 @@
+
+ extern locale_t newlocale(int category_mask, const char *locale,
+ locale_t base);
+-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# endif
+ #endif
+
+ __END_NAMESPACE_STD
+Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
+@@ -281,6 +281,17 @@
+ /* Compare no more than N chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
++
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
+ #endif /* Use BSD. */
+
+ #if defined __USE_XOPEN2K || defined __USE_MISC
+Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy)
+@@ -37,7 +37,17 @@
+ /* Compare n chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
++
+ /* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+ extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy)
+@@ -14,8 +14,6 @@
+
+ /* #define DEBUG */
+
+-int __setlocale_called = 1;
+-
+ static int
+ read_symbol (int reason_code, int territory)
+ {
+@@ -71,26 +69,44 @@
+ *grouping = new_grouping;
+ }
+
+-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL,
+- NULL, NULL, NULL, NULL, NULL,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX };
++void
++__localeconv_lconv_init (struct lconv *lc)
++{
++ memset(lc, 0, sizeof(*lc));
++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes =
++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space =
++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX;
++}
+
+-/* Defined by POSIX as not threadsafe */
+-struct lconv *
+-localeconv (void)
++void
++__localeconv_lconv_fini (struct lconv *lc)
+ {
++ free(lc->decimal_point);
++ free(lc->thousands_sep);
++ free(lc->grouping);
++ free(lc->int_curr_symbol);
++ free(lc->currency_symbol);
++ free(lc->mon_decimal_point);
++ free(lc->mon_thousands_sep);
++ free(lc->mon_grouping);
++ free(lc->positive_sign);
++ free(lc->negative_sign);
++}
++
++void
++__localeconv_l (locale_t locobj)
++{
+ int numeric, monetary;
+
+ /* If setlocale has not been called since the last call to
+ localeconv, then the lconv structure will be the same. */
+- if (!__setlocale_called)
+- return &lc;
++ if (!locobj->lc_needs_refresh)
++ return;
+
+- __setlocale_called = 0;
++ locobj->lc_needs_refresh = 0;
+
+- numeric = __locale_territory[LC_NUMERIC];
+- monetary = __locale_territory[LC_MONETARY];
++ numeric = locobj->locale_territory[LC_NUMERIC];
++ monetary = locobj->locale_territory[LC_MONETARY];
+
+ /* See the PRMs regarding SWI Territory_ReadSymbols for the
+ meanings of the following numbers. */
+@@ -97,71 +113,80 @@
+ if (numeric == -1)
+ {
+ /* We're using the 'C' locale. */
+- free (lc.decimal_point);
+- lc.decimal_point = strdup (".");
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ("");
+- free (lc.grouping);
+- lc.grouping = strdup ("");
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup (".");
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ("");
++ free (locobj->lc.grouping);
++ locobj->lc.grouping = strdup ("");
+ }
+ else
+ {
+- free (lc.decimal_point);
+- lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
+- read_byte_list (2, &lc.grouping, numeric);
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
++ read_byte_list (2, &locobj->lc.grouping, numeric);
+ }
+ if (monetary == -1)
+ {
+ /* We using the 'C' locale. Empty strings and CHAR_MAX means
+ that these fields are unspecified. */
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ("");
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ("");
+- free (lc.mon_grouping);
+- lc.mon_grouping = strdup ("");
+- lc.int_frac_digits = CHAR_MAX;
+- lc.frac_digits = CHAR_MAX;
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ("");
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ("");
+- lc.p_cs_precedes = CHAR_MAX;
+- lc.n_cs_precedes = CHAR_MAX;
+- lc.p_sep_by_space = CHAR_MAX;
+- lc.n_sep_by_space = CHAR_MAX;
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ("");
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ("");
+- lc.p_sign_posn = CHAR_MAX;
+- lc.n_sign_posn = CHAR_MAX;
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ("");
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ("");
++ free (locobj->lc.mon_grouping);
++ locobj->lc.mon_grouping = strdup ("");
++ locobj->lc.int_frac_digits = CHAR_MAX;
++ locobj->lc.frac_digits = CHAR_MAX;
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ("");
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ("");
++ locobj->lc.p_cs_precedes = CHAR_MAX;
++ locobj->lc.n_cs_precedes = CHAR_MAX;
++ locobj->lc.p_sep_by_space = CHAR_MAX;
++ locobj->lc.n_sep_by_space = CHAR_MAX;
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ("");
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ("");
++ locobj->lc.p_sign_posn = CHAR_MAX;
++ locobj->lc.n_sign_posn = CHAR_MAX;
+ }
+ else
+ {
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
+- read_byte_list (7, &lc.mon_grouping, monetary);
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
+- lc.int_frac_digits = (char)read_symbol (10, monetary);
+- lc.frac_digits = (char)read_symbol (11, monetary);
+- lc.p_cs_precedes = (char)read_symbol (12, monetary);
+- lc.p_sep_by_space = (char)read_symbol (13, monetary);
+- lc.n_cs_precedes = (char)read_symbol (14, monetary);
+- lc.n_sep_by_space = (char)read_symbol (15, monetary);
+- lc.p_sign_posn = (char)read_symbol (16, monetary);
+- lc.n_sign_posn = (char)read_symbol (17, monetary);
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
++ read_byte_list (7, &locobj->lc.mon_grouping, monetary);
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary);
++ locobj->lc.frac_digits = (char)read_symbol (11, monetary);
++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary);
++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary);
++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary);
++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary);
++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary);
++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary);
+ }
+- return &lc;
++ return;
+ }
++
++/* Defined by POSIX as not threadsafe */
++struct lconv *
++localeconv (void)
++{
++ __localeconv_l (&__locale_global);
++
++ return &__locale_global.lc;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
+@@ -1,15 +1,15 @@
+ /* Copyright (c) 2019 UnixLib Developers
+ */
+
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
++
++#include <internal/unix.h>
+
+-struct _locale {
+- struct lconv lc;
+-};
+-
+ /* This is supposed to be per-thread. */
+ static locale_t current_locale;
+
+@@ -27,20 +27,71 @@
+
+ void freelocale(locale_t locobj)
+ {
+- if (locobj)
++ if (locobj) {
++ __localeconv_lconv_fini(&locobj->lc);
+ free(locobj);
++ }
+ }
+
+ locale_t newlocale(int category_mask, const char *locale,
+ locale_t base)
+ {
+- locale_t loc = (locale_t)malloc(sizeof(*loc));
+- if (!loc) {
+- __set_errno (ENOMEM);
++ struct _locale tmp;
++
++ PTHREAD_UNSAFE
++
++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
++ __set_errno (EINVAL);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ /* The locale provided will be verified by __setlocale_l() */
+
+- return loc;
++ /* Prepare the temporary locale we will modify */
++ if (base != 0 && base != LC_GLOBAL_LOCALE) {
++ memcpy(&tmp, base, sizeof(tmp));
++ } else {
++ if (base == LC_GLOBAL_LOCALE) {
++ /* Undefined: be helpful to client */
++ memcpy(&tmp, &__locale_global, sizeof(tmp));
++ } else {
++ /* Initialise to C locale */
++ __build_ctype_tables(&tmp, -2);
++ }
++ }
++
++ /* Now, apply the requested locale to each of the categories in the mask */
++ if (category_mask == LC_ALL_MASK) {
++ /* Special-case LC_ALL to handle the encoded locale string */
++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) {
++ return 0;
++ }
++ } else {
++ int category = 0, mask = category_mask;
++ while (mask != 0) {
++ if (mask & 1) {
++ if (__setlocale_l(&tmp, category, locale) == NULL) {
++ return 0;
++ }
++ }
++ category++;
++ mask >>= 1;
++ }
++ }
++
++ /* Allocate the result, if necessary */
++ if (base == 0 || base == LC_GLOBAL_LOCALE) {
++ base = (locale_t)malloc(sizeof(*base));
++ if (!base) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++ }
++ /* Fill it in */
++ memcpy(base, &tmp, sizeof(tmp));
++
++ /* Mark the lconv data stale */
++ base->lc_needs_refresh = 1;
++
++ return base;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy)
+@@ -195,7 +195,7 @@
+ }
+
+ static void
+-do_lc_all (char *buffer, int size)
++do_lc_all (locale_t locobj, char *buffer, int size)
+ {
+ char temp[64];
+ int category, same = 1;
+@@ -204,13 +204,13 @@
+ setlocale to set all locales. If all locales are
+ the same, then we can produce a very short string. */
+ for (category = 1; category < LC_ALL; ++category)
+- if (__locale_territory[0] != __locale_territory[category])
++ if (locobj->locale_territory[0] != locobj->locale_territory[category])
+ same = 0;
+
+ if (same)
+ {
+ /* All locales are set to the same territory. */
+- territory_name (__locale_territory[0], buffer, size);
++ territory_name (locobj->locale_territory[0], buffer, size);
+ }
+ else
+ {
+@@ -218,7 +218,7 @@
+ LC_CATEGORY=country;LC_CATEGORY=country; ... */
+ for (category = 0; category < LC_ALL; ++category)
+ {
+- territory_name (__locale_territory[category], temp, sizeof (temp));
++ territory_name (locobj->locale_territory[category], temp, sizeof (temp));
+ buffer = stpcpy (buffer, locale_names[category]);
+ *buffer++ = '=';
+ buffer = stpcpy (buffer, temp);
+@@ -230,15 +230,13 @@
+ }
+
+ char *
+-setlocale (int category, const char *locale)
++__setlocale_l (locale_t locobj, int category, const char *locale)
+ {
+ int new_territory, changed;
+ static char old_locale[256];
+
+- PTHREAD_UNSAFE
+-
+ /* This tells localeconv to re-read data for the lconv structure. */
+- __setlocale_called = 1;
++ locobj->lc_needs_refresh = 1;
+
+ if (locale == NULL)
+ {
+@@ -247,11 +245,11 @@
+ {
+ /* The locale string is specially encoded for LC_ALL so we
+ could restore all locales at any time. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+- territory_name (__locale_territory[category], old_locale, sizeof (old_locale));
++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+@@ -270,7 +268,7 @@
+ /* Encode the locale string, as we will be returning this
+ later. Remember, setlocale returns the locale settings
+ that are about to be changed. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+
+ /* Check for an encoded (composite) name. Simply looking for
+ a semi-colon will verify this. */
+@@ -332,11 +330,11 @@
+
+ /* We now know all locales exist, so set them. */
+ for (category = 0; category < LC_ALL; ++category)
+- __locale_territory[category] = territory_number (newnames[category]);
++ locobj->locale_territory[category] = territory_number (newnames[category]);
+
+ /* Re-build the character type tables according to the new
+ locale settings. */
+- __build_ctype_tables (__locale_territory[LC_CTYPE]);
++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]);
+ return old_locale;
+ }
+ }
+@@ -359,9 +357,9 @@
+ /* Change the locale for all categories. old_locale was created
+ when we previously checked for a composite string. */
+ for (category = 0; category < LC_ALL; ++category)
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -368,12 +366,12 @@
+ else
+ {
+ /* Change the locale for just one category. */
+- territory_name (__locale_territory[category],
++ territory_name (locobj->locale_territory[category],
+ old_locale, sizeof (old_locale));
+
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -384,7 +382,16 @@
+ is changing. The GNU Java compiler is known to repeatedly call
+ setlocale. */
+ if (changed && (category == LC_ALL || category == LC_CTYPE))
+- __build_ctype_tables (new_territory);
++ __build_ctype_tables (locobj, new_territory);
+
+ return old_locale;
+ }
++
++char *
++setlocale (int category, const char *locale)
++{
++
++ PTHREAD_UNSAFE
++
++ return __setlocale_l(&__locale_global, category, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)s1;
+ regs[2] = (int)s2;
+ regs[3] = 0;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)to;
+ regs[2] = (int)from;
+ regs[3] = size;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent)
+@@ -1,10 +0,0 @@
+-/* __locale_territory
+- * Copyright (c) 2000-2006 UnixLib Developers
+- */
+-
+-#include <locale.h>
+-
+-/* Global used for all calls to the Territory module. These variable
+- contain the territory number as set by setlocale. A value of
+- -1 means use the C locale. */
+-int __locale_territory[LC_ALL + 1];
+Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy)
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ stricmp (const char *s1, const char *s2)
+@@ -26,3 +27,24 @@
+ return result;
+ }
+ strong_alias (stricmp, strcasecmp)
++
++int
++strcasecmp_l (const char *s1, const char *s2, locale_t locobj)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ int result = 0;
++
++ if (p1 == p2)
++ return result;
++
++ while (! result)
++ {
++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
++ if (*p1++ == '\0')
++ break;
++ p2 ++;
++ }
++
++ return result;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy)
+@@ -5,6 +5,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ strnicmp (const char *s1, const char *s2, size_t n)
+@@ -26,3 +27,22 @@
+ }
+ strong_alias (strnicmp, strncasecmp)
+
++int
++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj)
++{
++ int i, j;
++
++ if (!n)
++ return 0;
++
++ do
++ {
++ i = *s1++, j = *s2++;
++ i = tolower_l (i, locobj);
++ j = tolower_l (j, locobj);
++ }
++ while (i && i == j && --n);
++
++ return i - j;
++}
++
+Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy)
+@@ -49,7 +49,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals);
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy)
+@@ -46,7 +46,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy)
+@@ -28,7 +28,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy)
+@@ -23,7 +23,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ ordinals)) != NULL)
+Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy)
+@@ -48,7 +48,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ result,
+Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy)
+@@ -353,7 +353,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+@@ -368,7 +368,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy)
+@@ -36,7 +36,7 @@
+ /* Get timezone information for current territory. */
+ _kernel_swi_regs regs;
+ #ifndef __TARGET_SCL__
+- regs.r[0] = __locale_territory[LC_TIME];
++ regs.r[0] = __locale_global.locale_territory[LC_TIME];
+ #else
+ regs.r[0] = -1; /* Current territory. */
+ #endif
+Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy)
+@@ -191,7 +191,7 @@
+ __pthread_prog_init ();
+ __unixlib_signal_initialise (__u);
+ /* Initialise ctype tables to the C locale. */
+- __build_ctype_tables (-2);
++ __build_ctype_tables (&__locale_global, -2);
+ /* Define and initialise the Unix I/O. */
+ initialise_unix_io ();
+ __stdioinit ();
+Index: gcc4/recipe/files/gcc/libunixlib/vscript
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy)
+@@ -58,6 +58,9 @@
+ __init_des_r;
+ __init_des;
+ __invalidate;
++ __locale_global;
++ __localeconv_lconv_init;
++ __localeconv_lconv_fini;
+ malloc_trim;
+ malloc_trim_unlocked;
+ malloc_unlocked;
+@@ -80,6 +83,7 @@
+ __res_vinit;
+ __runtime_features;
+ __setup_signalhandler_stack;
++ __setlocale_l;
+ __sdirinit;
+ __sfixinit;
+ __sfixfind;
-----------------------------------------------------------------------
Summary of changes:
--
Cross-compilation toolchains and environments
1 year, 3 months
librufl: branch master updated. release/0.0.5-65-gb3bef34
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/librufl.git/shortlog/b3bef342bc585e9fd4517...
...commit http://git.netsurf-browser.org/librufl.git/commit/b3bef342bc585e9fd451775...
...tree http://git.netsurf-browser.org/librufl.git/tree/b3bef342bc585e9fd451775d6...
The branch, master has been updated
via b3bef342bc585e9fd451775d6fc8287d98b98684 (commit)
from 769b9ee5c1a1a70a0a75a78269ccabb2b7591832 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/librufl.git/commit/?id=b3bef342bc585e9fd45...
commit b3bef342bc585e9fd451775d6fc8287d98b98684
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
Substitution table/direct: handle >255 fonts
The direct substitution table constructor failed to allocate
sufficient space to store the table in the case where there are
more than 255 fonts installed on the system.
diff --git a/src/rufl_substitution_table.c b/src/rufl_substitution_table.c
index a599930..f5de7d8 100644
--- a/src/rufl_substitution_table.c
+++ b/src/rufl_substitution_table.c
@@ -818,7 +818,7 @@ static rufl_code direct(uint64_t *table, size_t table_entries,
/* Allocate table */
//XXX: can we just rearrange the existing one in-place?
- subst_table->table = malloc(table_size);
+ subst_table->table = malloc(table_size * (subst_table->bits_per_entry >> 3));
if (!subst_table->table) {
free(subst_table);
return rufl_OUT_OF_MEMORY;
diff --git a/test/INDEX b/test/INDEX
index a1b324c..417b032 100644
--- a/test/INDEX
+++ b/test/INDEX
@@ -5,3 +5,4 @@ nofonts Ensure a lack of fonts "works"
ucsinit Ensure that UCS FM initialisation works
olducsinit Ensure that UCS FM (pre 3.64) initialisation works
oldfminit Ensure that non-UCS FM initialisation works oldfminit
+manyfonts Ensure that more than 256 fonts works
diff --git a/test/Makefile b/test/Makefile
index ec15598..451ea46 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -9,7 +9,8 @@ else
DIR_TEST_ITEMS := nofonts:nofonts.c;harness.c;mocks.c \
oldfminit:oldfminit.c;harness.c;mocks.c \
olducsinit:olducsinit.c;harness.c;mocks.c \
- ucsinit:ucsinit.c;harness.c;mocks.c
+ ucsinit:ucsinit.c;harness.c;mocks.c \
+ manyfonts:manyfonts.c;harness.c;mocks.c
endif
include $(NSBUILD)/Makefile.subdir
diff --git a/test/manyfonts.c b/test/manyfonts.c
new file mode 100644
index 0000000..bc4b01e
--- /dev/null
+++ b/test/manyfonts.c
@@ -0,0 +1,100 @@
+/*
+ * XXX: This test currently needs the following patch to be valid.
+ * We need a way of ensuring the library chooses the direct substitution
+ * table format (which basically means we need to flood a plane with glyphs)
+ *
+ * diff --git a/src/rufl_substitution_table.c b/src/rufl_substitution_table.c
+ * index f5de7d8..2b58b72 100644
+ * --- a/src/rufl_substitution_table.c
+ * +++ b/src/rufl_substitution_table.c
+ * @@ -1019,7 +1019,7 @@ static rufl_code create_substitution_table_for_plane(unsigned int plane)
+ * table_entries, blocks_used);
+ * chd_size = rufl_substitution_table_estimate_size_chd(
+ * table_entries, blocks_used);
+ * - if (direct_size <= chd_size) {
+ * + if (1 || direct_size <= chd_size) {
+ * result = direct(table, table_entries, blocks_used,
+ * block_histogram,
+ * &rufl_substitution_table[plane]);
+ */
+
+#include <ftw.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "rufl.h"
+
+#include "harness.h"
+#include "testutils.h"
+
+static char template[] = "/tmp/manyfontsXXXXXX";
+static const char *ptmp = NULL;
+
+static int ftw_cb(const char *path, const struct stat *sb,
+ int typeflag, struct FTW *ftwbuf)
+{
+ (void) sb;
+ (void) typeflag;
+ (void) ftwbuf;
+
+ remove(path);
+
+ return 0;
+}
+
+static void cleanup(void)
+{
+ if (ptmp == NULL)
+ return;
+
+ nftw(ptmp, ftw_cb, FOPEN_MAX, FTW_DEPTH | FTW_MOUNT | FTW_PHYS);
+}
+
+int main(int argc, const char **argv)
+{
+ char *names[300];
+ int x;
+
+ UNUSED(argc);
+ UNUSED(argv);
+
+ ptmp = mkdtemp(template);
+ assert(NULL != ptmp);
+ atexit(cleanup);
+ chdir(ptmp);
+
+ rufl_test_harness_init(380, true, true);
+
+ for (x = 0; x < 300; x++) {
+ char buf[64];
+ sprintf(buf, "Font%03d", x);
+ names[x] = strdup(buf);
+ rufl_test_harness_register_font(names[x]);
+ }
+
+ assert(rufl_OK == rufl_init());
+ assert(NULL == rufl_fm_error);
+ assert(303 == rufl_family_list_entries);
+ assert(NULL != rufl_family_menu);
+
+ rufl_dump_state(true);
+
+ rufl_quit();
+
+ /* Reinit -- should load cache */
+ assert(rufl_OK == rufl_init());
+ assert(NULL == rufl_fm_error);
+ assert(303 == rufl_family_list_entries);
+ assert(NULL != rufl_family_menu);
+ /* Done for real this time */
+ rufl_quit();
+
+ for (x = 0; x < 300; x++) {
+ free(names[x]);
+ }
+
+ printf("PASS\n");
+
+ return 0;
+}
-----------------------------------------------------------------------
Summary of changes:
src/rufl_substitution_table.c | 2 +-
test/INDEX | 1 +
test/Makefile | 3 +-
test/manyfonts.c | 100 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 test/manyfonts.c
diff --git a/src/rufl_substitution_table.c b/src/rufl_substitution_table.c
index a599930..f5de7d8 100644
--- a/src/rufl_substitution_table.c
+++ b/src/rufl_substitution_table.c
@@ -818,7 +818,7 @@ static rufl_code direct(uint64_t *table, size_t table_entries,
/* Allocate table */
//XXX: can we just rearrange the existing one in-place?
- subst_table->table = malloc(table_size);
+ subst_table->table = malloc(table_size * (subst_table->bits_per_entry >> 3));
if (!subst_table->table) {
free(subst_table);
return rufl_OUT_OF_MEMORY;
diff --git a/test/INDEX b/test/INDEX
index a1b324c..417b032 100644
--- a/test/INDEX
+++ b/test/INDEX
@@ -5,3 +5,4 @@ nofonts Ensure a lack of fonts "works"
ucsinit Ensure that UCS FM initialisation works
olducsinit Ensure that UCS FM (pre 3.64) initialisation works
oldfminit Ensure that non-UCS FM initialisation works oldfminit
+manyfonts Ensure that more than 256 fonts works
diff --git a/test/Makefile b/test/Makefile
index ec15598..451ea46 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -9,7 +9,8 @@ else
DIR_TEST_ITEMS := nofonts:nofonts.c;harness.c;mocks.c \
oldfminit:oldfminit.c;harness.c;mocks.c \
olducsinit:olducsinit.c;harness.c;mocks.c \
- ucsinit:ucsinit.c;harness.c;mocks.c
+ ucsinit:ucsinit.c;harness.c;mocks.c \
+ manyfonts:manyfonts.c;harness.c;mocks.c
endif
include $(NSBUILD)/Makefile.subdir
diff --git a/test/manyfonts.c b/test/manyfonts.c
new file mode 100644
index 0000000..bc4b01e
--- /dev/null
+++ b/test/manyfonts.c
@@ -0,0 +1,100 @@
+/*
+ * XXX: This test currently needs the following patch to be valid.
+ * We need a way of ensuring the library chooses the direct substitution
+ * table format (which basically means we need to flood a plane with glyphs)
+ *
+ * diff --git a/src/rufl_substitution_table.c b/src/rufl_substitution_table.c
+ * index f5de7d8..2b58b72 100644
+ * --- a/src/rufl_substitution_table.c
+ * +++ b/src/rufl_substitution_table.c
+ * @@ -1019,7 +1019,7 @@ static rufl_code create_substitution_table_for_plane(unsigned int plane)
+ * table_entries, blocks_used);
+ * chd_size = rufl_substitution_table_estimate_size_chd(
+ * table_entries, blocks_used);
+ * - if (direct_size <= chd_size) {
+ * + if (1 || direct_size <= chd_size) {
+ * result = direct(table, table_entries, blocks_used,
+ * block_histogram,
+ * &rufl_substitution_table[plane]);
+ */
+
+#include <ftw.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "rufl.h"
+
+#include "harness.h"
+#include "testutils.h"
+
+static char template[] = "/tmp/manyfontsXXXXXX";
+static const char *ptmp = NULL;
+
+static int ftw_cb(const char *path, const struct stat *sb,
+ int typeflag, struct FTW *ftwbuf)
+{
+ (void) sb;
+ (void) typeflag;
+ (void) ftwbuf;
+
+ remove(path);
+
+ return 0;
+}
+
+static void cleanup(void)
+{
+ if (ptmp == NULL)
+ return;
+
+ nftw(ptmp, ftw_cb, FOPEN_MAX, FTW_DEPTH | FTW_MOUNT | FTW_PHYS);
+}
+
+int main(int argc, const char **argv)
+{
+ char *names[300];
+ int x;
+
+ UNUSED(argc);
+ UNUSED(argv);
+
+ ptmp = mkdtemp(template);
+ assert(NULL != ptmp);
+ atexit(cleanup);
+ chdir(ptmp);
+
+ rufl_test_harness_init(380, true, true);
+
+ for (x = 0; x < 300; x++) {
+ char buf[64];
+ sprintf(buf, "Font%03d", x);
+ names[x] = strdup(buf);
+ rufl_test_harness_register_font(names[x]);
+ }
+
+ assert(rufl_OK == rufl_init());
+ assert(NULL == rufl_fm_error);
+ assert(303 == rufl_family_list_entries);
+ assert(NULL != rufl_family_menu);
+
+ rufl_dump_state(true);
+
+ rufl_quit();
+
+ /* Reinit -- should load cache */
+ assert(rufl_OK == rufl_init());
+ assert(NULL == rufl_fm_error);
+ assert(303 == rufl_family_list_entries);
+ assert(NULL != rufl_family_menu);
+ /* Done for real this time */
+ rufl_quit();
+
+ for (x = 0; x < 300; x++) {
+ free(names[x]);
+ }
+
+ printf("PASS\n");
+
+ return 0;
+}
--
RISC OS Unicode Font Library
1 year, 3 months
toolchains: branch jmb/gccsdk-4.7.4r6 updated. d695f894ba789bbf803ddf242c1efbd203773b0a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/d695f894ba789bbf80...
...commit http://git.netsurf-browser.org/toolchains.git/commit/d695f894ba789bbf803d...
...tree http://git.netsurf-browser.org/toolchains.git/tree/d695f894ba789bbf803ddf...
The branch, jmb/gccsdk-4.7.4r6 has been updated
discards 22135a6c8e90338574f506baf384c92562db54ee (commit)
discards 1c7ac653095c7e7edb56c1d0054610ce526bfea5 (commit)
via d695f894ba789bbf803ddf242c1efbd203773b0a (commit)
via c7e8c85170de25597cabecfae80a76ee8b581938 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (22135a6c8e90338574f506baf384c92562db54ee)
\
N -- N -- N (d695f894ba789bbf803ddf242c1efbd203773b0a)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=d695f894ba789bbf...
commit d695f894ba789bbf803ddf242c1efbd203773b0a
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
OpenSSL: drop unnecessary patch
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
deleted file mode 100644
index e0ecc21..0000000
--- a/sdk/recipes/patches/openssl/crypto.ctype.c.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
---- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
-@@ -295,7 +295,7 @@
- /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
- * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
-
--#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
-+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
-
- # if defined OPENSSL_SYS_WINDOWS
- # define locale_t _locale_t
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=c7e8c85170de2559...
commit c7e8c85170de25597cabecfae80a76ee8b581938
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
UnixLib: add POSIX extended locale support
This is not a complete implementation, but is sufficient for
OpenSSL3's purposes.
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
new file mode 100644
index 0000000..f378a7e
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -0,0 +1,1352 @@
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
+@@ -587,7 +587,7 @@
+ locale/setlocale.c \
+ locale/strcoll.c \
+ locale/strxfrm.c \
+- locale/territory.c
++ locale/newlocale.c
+ endif
+ locale_src += \
+ locale/iconv.c
+@@ -1312,6 +1312,7 @@
+ bits/in.h \
+ bits/libc-lock.h \
+ bits/locale.h \
++ bits/locale_t.h \
+ bits/mathcalls.h \
+ bits/mathdef.h \
+ bits/mathinline.h \
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
+@@ -10,36 +10,35 @@
+ #include <internal/os.h>
+ #include <internal/unix.h>
+
+-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must
+- support EOF. */
+-static unsigned char ctype[257];
+-const unsigned char * const __ctype = &ctype[1];
++/* Global containing current locale settings. */
++struct _locale __locale_global;
++/* Offset 1 as the first entry is reserved for EOF. */
++const unsigned char * const __ctype = &__locale_global.ctype[1];
++const short * const __ctype_upper = &__locale_global.ctype_upper[1];
++const short * const __ctype_lower = &__locale_global.ctype_lower[1];
+
+-static short ctype_upper[257];
+-const short * const __ctype_upper = &ctype_upper[1];
+-
+-static short ctype_lower[257];
+-const short * const __ctype_lower = &ctype_lower[1];
+-
+ void
+-__build_ctype_tables (int territory)
++__build_ctype_tables (locale_t locobj, int territory)
+ {
+ PTHREAD_UNSAFE
+
+ if (territory == -2)
+ {
+- /* Initialise the array. This is only done by __unixinit(). */
++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */
+ territory = -1;
+- for (int x = 0; x <= LC_ALL; x++)
+- __locale_territory[x] = -1;
++ for (int x = 0; x < LC_ALL; x++)
++ locobj->locale_territory[x] = -1;
++ __localeconv_lconv_init(&locobj->lc);
++ locobj->lc_needs_refresh = 1;
+ }
+
+ /* Initialise ctype_upper/ctype_lower tables. */
+ for (int x = 0; x < 257; x++)
+ {
+- /* In the C/POSIX locate, tolower(top bit set char)
++ /* In the C/POSIX locale, tolower(top bit set char)
+ should return the character unchanged. */
+- ctype_lower[x] = ctype_upper[x] = x - 1;
++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
++ locobj->ctype[x] = 0;
+ }
+
+ int regs[10];
+@@ -61,7 +60,7 @@
+ for (int offset = 1; bits; bits = bits >> 1, offset += 1)
+ {
+ if (bits & 1)
+- ctype[pos + offset] |= 1 << code;
++ locobj->ctype[pos + offset] |= 1 << code;
+ }
+ pos += 32;
+ }
+@@ -80,7 +79,7 @@
+ int y = (territory == -1) ? 128 : 256;
+ for (int x = 1; x <= y; x++)
+ {
+- ctype_lower[x] = (short)*p++;
+- ctype_upper[x] = (short)*q++;
++ locobj->ctype_lower[x] = (short)*p++;
++ locobj->ctype_upper[x] = (short)*q++;
+ }
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalnum) (int c)
+@@ -10,3 +11,8 @@
+ return isalnum (c);
+ }
+
++int
++isalnum_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalpha) (int c)
+@@ -10,3 +11,8 @@
+ return isalpha (c);
+ }
+
++int
++isalpha_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_alpha);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return isascii (c);
+ }
+
++int
++isascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy)
+@@ -9,3 +9,10 @@
+ {
+ return isblank (c);
+ }
++
++int
++isblank_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isblank (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (iscntrl) (int c)
+@@ -10,3 +11,8 @@
+ return iscntrl (c);
+ }
+
++int
++iscntrl_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isdigit (c);
+ }
+
++int
++isdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_digit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isgraph) (int c)
+@@ -10,3 +11,8 @@
+ return isgraph (c);
+ }
+
++int
++isgraph_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (islower) (int c)
+@@ -10,3 +11,8 @@
+ return islower (c);
+ }
+
++int
++islower_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_lower);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isprint) (int c)
+@@ -10,3 +11,10 @@
+ return isprint (c);
+ }
+
++int
++isprint_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] &
++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc |
++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (ispunct) (int c)
+@@ -10,3 +11,8 @@
+ return ispunct (c);
+ }
+
++int
++ispunct_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_punc);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isspace) (int c)
+@@ -10,3 +11,8 @@
+ return isspace (c);
+ }
+
++int
++isspace_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_white);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isupper) (int c)
+@@ -10,3 +11,8 @@
+ return isupper (c);
+ }
+
++int
++isupper_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_upper);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isxdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isxdigit (c);
+ }
+
++int
++isxdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return toascii (c);
+ }
+
++int
++toascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return toascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (tolower) (int c)
+@@ -10,3 +11,8 @@
+ return tolower (c);
+ }
+
++int
++tolower_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_lower[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (toupper) (int c)
+@@ -10,3 +11,8 @@
+ return toupper (c);
+ }
+
++int
++toupper_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_upper[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy)
+@@ -13,15 +13,36 @@
+
+ #ifndef __TARGET_SCL__
+
+-/* Territory number for each locale. C locale is -1. */
+-extern int __locale_territory[LC_ALL + 1];
++struct _locale {
++ /* Map from locale category to territory number. C locale is -1. */
++ int locale_territory[LC_ALL];
+
+-/* Set to 1 is setlocale has been called since the last call to
+- localeconv. localeconv uses this flag to cache the lconv structure. */
+-extern int __setlocale_called;
++ /* Character type LUTs: EOF + one entry per character
++ *
++ * EOF is defined as -1, so character entries start at offset 1.
++ */
++ short ctype_upper[257];
++ short ctype_lower[257];
++ unsigned char ctype[257];
+
+-extern void __build_ctype_tables (int __territory) __THROW;
++ /* Set to 1 if the locale information has changed since the last time
++ * the lconv structure was updated. */
++ int lc_needs_refresh;
++ /* Numeric formatting information for locale */
++ struct lconv lc;
++};
+
++extern struct _locale __locale_global;
++
++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW;
++
++extern char *__setlocale_l (locale_t locobj, int __category,
++ const char *__locale) __THROW;
++
++void __localeconv_lconv_init (struct lconv *lc);
++void __localeconv_lconv_fini (struct lconv *lc);
++void __localeconv_l (locale_t locobj);
++
+ #endif
+
+ __END_DECLS
+Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+@@ -0,0 +1,10 @@
++/*
++ * Copyright (c) 2022 UnixLib Developers
++ */
++
++#ifndef _BITS_LOCALE_T_H_
++#define _BITS_LOCALE_T_H_
++
++typedef struct _locale *locale_t;
++
++#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy)
+@@ -51,6 +51,48 @@
+ extern int isblank (int __c) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++/* c is alphabetic or numeric. */
++extern int isalnum_l (int __c, locale_t locobj) __THROW;
++
++/* c is alphabetic. */
++extern int isalpha_l (int __c, locale_t locobj) __THROW;
++
++/* c is a control character. */
++extern int iscntrl_l (int __c, locale_t locobj) __THROW;
++
++/* c is a decimal digit. */
++extern int isdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is any printable character other than a space. */
++extern int isgraph_l (int __c, locale_t locobj) __THROW;
++
++/* c is a lower-case letter. */
++extern int islower_l (int __c, locale_t locobj) __THROW;
++
++/* c is an upper-case letter. */
++extern int isupper_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character. */
++extern int isprint_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character other than a space or a
++ alphanumeric character. */
++extern int ispunct_l (int __c, locale_t locobj) __THROW;
++
++/* c is a white space character e.g. space, newline, tab, linefeed,
++ return, vertical tab. */
++extern int isspace_l (int __c, locale_t locobj) __THROW;
++
++/* c is a hex digit. */
++extern int isxdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is tab or space. */
++extern int isblank_l (int __c, locale_t locobj) __THROW;
++# endif
++
+ /* Characteristics. */
+ extern const unsigned char * const __ctype;
+ /* Lower case table. */
+@@ -108,6 +150,10 @@
+ extern int toupper (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define toupper(c) ((int) __ctype_upper[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int toupper_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ /* Convert c to lower case. */
+@@ -114,6 +160,10 @@
+ extern int tolower (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define tolower(c) ((int) __ctype_lower[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int tolower_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ #ifndef __TARGET_SCL__
+@@ -135,6 +185,11 @@
+ /* Is c an ASCII character. */
+ extern int isascii (int __c) __THROW;
+ # define isascii(c) ((unsigned)(c) <= 0x7f)
++
++# ifdef __USE_XOPEN2K8
++extern int toascii_l (int __c, locale_t locobj) __THROW;
++extern int isascii_l (int __c, locale_t locobj) __THROW;
++# endif
+ # endif
+ #endif
+
+Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy)
+@@ -33,16 +33,16 @@
+ /* Entire locale. */
+ # define LC_ALL 6
+
+-#define LC_COLLATE_MASK (1L << 1)
+-#define LC_CTYPE_MASK (1L << 2)
+-#define LC_MESSAGES_MASK (1L << 3)
+-#define LC_MONETARY_MASK (1L << 4)
+-#define LC_NUMERIC_MASK (1L << 5)
+-#define LC_TIME_MASK (1L << 6)
+-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# ifdef __USE_XOPEN2K8
++# define LC_COLLATE_MASK (1L << 0)
++# define LC_CTYPE_MASK (1L << 1)
++# define LC_MESSAGES_MASK (1L << 2)
++# define LC_MONETARY_MASK (1L << 3)
++# define LC_NUMERIC_MASK (1L << 4)
++# define LC_TIME_MASK (1L << 5)
++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# endif
+
+-typedef struct _locale *locale_t;
+-
+ #else
+ /* String collation (functions 'strcoll' and 'strxfrm'). */
+ # define LC_COLLATE 1
+@@ -121,6 +121,9 @@
+ extern struct lconv *localeconv (void) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
+ extern locale_t uselocale(locale_t newloc);
+
+ extern void freelocale(locale_t locobj);
+@@ -127,7 +130,8 @@
+
+ extern locale_t newlocale(int category_mask, const char *locale,
+ locale_t base);
+-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# endif
+ #endif
+
+ __END_NAMESPACE_STD
+Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
+@@ -281,6 +281,17 @@
+ /* Compare no more than N chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
++
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
+ #endif /* Use BSD. */
+
+ #if defined __USE_XOPEN2K || defined __USE_MISC
+Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy)
+@@ -37,7 +37,17 @@
+ /* Compare n chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
++
+ /* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+ extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy)
+@@ -14,8 +14,6 @@
+
+ /* #define DEBUG */
+
+-int __setlocale_called = 1;
+-
+ static int
+ read_symbol (int reason_code, int territory)
+ {
+@@ -71,26 +69,44 @@
+ *grouping = new_grouping;
+ }
+
+-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL,
+- NULL, NULL, NULL, NULL, NULL,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX };
++void
++__localeconv_lconv_init (struct lconv *lc)
++{
++ memset(lc, 0, sizeof(*lc));
++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes =
++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space =
++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX;
++}
+
+-/* Defined by POSIX as not threadsafe */
+-struct lconv *
+-localeconv (void)
++void
++__localeconv_lconv_fini (struct lconv *lc)
+ {
++ free(lc->decimal_point);
++ free(lc->thousands_sep);
++ free(lc->grouping);
++ free(lc->int_curr_symbol);
++ free(lc->currency_symbol);
++ free(lc->mon_decimal_point);
++ free(lc->mon_thousands_sep);
++ free(lc->mon_grouping);
++ free(lc->positive_sign);
++ free(lc->negative_sign);
++}
++
++void
++__localeconv_l (locale_t locobj)
++{
+ int numeric, monetary;
+
+ /* If setlocale has not been called since the last call to
+ localeconv, then the lconv structure will be the same. */
+- if (!__setlocale_called)
+- return &lc;
++ if (!locobj->lc_needs_refresh)
++ return;
+
+- __setlocale_called = 0;
++ locobj->lc_needs_refresh = 0;
+
+- numeric = __locale_territory[LC_NUMERIC];
+- monetary = __locale_territory[LC_MONETARY];
++ numeric = locobj->locale_territory[LC_NUMERIC];
++ monetary = locobj->locale_territory[LC_MONETARY];
+
+ /* See the PRMs regarding SWI Territory_ReadSymbols for the
+ meanings of the following numbers. */
+@@ -97,71 +113,80 @@
+ if (numeric == -1)
+ {
+ /* We're using the 'C' locale. */
+- free (lc.decimal_point);
+- lc.decimal_point = strdup (".");
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ("");
+- free (lc.grouping);
+- lc.grouping = strdup ("");
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup (".");
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ("");
++ free (locobj->lc.grouping);
++ locobj->lc.grouping = strdup ("");
+ }
+ else
+ {
+- free (lc.decimal_point);
+- lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
+- read_byte_list (2, &lc.grouping, numeric);
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
++ read_byte_list (2, &locobj->lc.grouping, numeric);
+ }
+ if (monetary == -1)
+ {
+ /* We using the 'C' locale. Empty strings and CHAR_MAX means
+ that these fields are unspecified. */
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ("");
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ("");
+- free (lc.mon_grouping);
+- lc.mon_grouping = strdup ("");
+- lc.int_frac_digits = CHAR_MAX;
+- lc.frac_digits = CHAR_MAX;
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ("");
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ("");
+- lc.p_cs_precedes = CHAR_MAX;
+- lc.n_cs_precedes = CHAR_MAX;
+- lc.p_sep_by_space = CHAR_MAX;
+- lc.n_sep_by_space = CHAR_MAX;
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ("");
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ("");
+- lc.p_sign_posn = CHAR_MAX;
+- lc.n_sign_posn = CHAR_MAX;
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ("");
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ("");
++ free (locobj->lc.mon_grouping);
++ locobj->lc.mon_grouping = strdup ("");
++ locobj->lc.int_frac_digits = CHAR_MAX;
++ locobj->lc.frac_digits = CHAR_MAX;
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ("");
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ("");
++ locobj->lc.p_cs_precedes = CHAR_MAX;
++ locobj->lc.n_cs_precedes = CHAR_MAX;
++ locobj->lc.p_sep_by_space = CHAR_MAX;
++ locobj->lc.n_sep_by_space = CHAR_MAX;
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ("");
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ("");
++ locobj->lc.p_sign_posn = CHAR_MAX;
++ locobj->lc.n_sign_posn = CHAR_MAX;
+ }
+ else
+ {
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
+- read_byte_list (7, &lc.mon_grouping, monetary);
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
+- lc.int_frac_digits = (char)read_symbol (10, monetary);
+- lc.frac_digits = (char)read_symbol (11, monetary);
+- lc.p_cs_precedes = (char)read_symbol (12, monetary);
+- lc.p_sep_by_space = (char)read_symbol (13, monetary);
+- lc.n_cs_precedes = (char)read_symbol (14, monetary);
+- lc.n_sep_by_space = (char)read_symbol (15, monetary);
+- lc.p_sign_posn = (char)read_symbol (16, monetary);
+- lc.n_sign_posn = (char)read_symbol (17, monetary);
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
++ read_byte_list (7, &locobj->lc.mon_grouping, monetary);
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary);
++ locobj->lc.frac_digits = (char)read_symbol (11, monetary);
++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary);
++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary);
++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary);
++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary);
++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary);
++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary);
+ }
+- return &lc;
++ return;
+ }
++
++/* Defined by POSIX as not threadsafe */
++struct lconv *
++localeconv (void)
++{
++ __localeconv_l (&__locale_global);
++
++ return &__locale_global.lc;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
+@@ -1,15 +1,15 @@
+ /* Copyright (c) 2019 UnixLib Developers
+ */
+
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
++
++#include <internal/unix.h>
+
+-struct _locale {
+- struct lconv lc;
+-};
+-
+ /* This is supposed to be per-thread. */
+ static locale_t current_locale;
+
+@@ -27,20 +27,71 @@
+
+ void freelocale(locale_t locobj)
+ {
+- if (locobj)
++ if (locobj) {
++ __localeconv_lconv_fini(&locobj->lc);
+ free(locobj);
++ }
+ }
+
+ locale_t newlocale(int category_mask, const char *locale,
+ locale_t base)
+ {
+- locale_t loc = (locale_t)malloc(sizeof(*loc));
+- if (!loc) {
+- __set_errno (ENOMEM);
++ struct _locale tmp;
++
++ PTHREAD_UNSAFE
++
++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
++ __set_errno (EINVAL);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ /* The locale provided will be verified by __setlocale_l() */
+
+- return loc;
++ /* Prepare the temporary locale we will modify */
++ if (base != 0 && base != LC_GLOBAL_LOCALE) {
++ memcpy(&tmp, base, sizeof(tmp));
++ } else {
++ if (base == LC_GLOBAL_LOCALE) {
++ /* Undefined: be helpful to client */
++ memcpy(&tmp, &__locale_global, sizeof(tmp));
++ } else {
++ /* Initialise to C locale */
++ __build_ctype_tables(&tmp, -2);
++ }
++ }
++
++ /* Now, apply the requested locale to each of the categories in the mask */
++ if (category_mask == LC_ALL_MASK) {
++ /* Special-case LC_ALL to handle the encoded locale string */
++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) {
++ return 0;
++ }
++ } else {
++ int category = 0, mask = category_mask;
++ while (mask != 0) {
++ if (mask & 1) {
++ if (__setlocale_l(&tmp, category, locale) == NULL) {
++ return 0;
++ }
++ }
++ category++;
++ mask >>= 1;
++ }
++ }
++
++ /* Allocate the result, if necessary */
++ if (base == 0 || base == LC_GLOBAL_LOCALE) {
++ base = (locale_t)malloc(sizeof(*base));
++ if (!base) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++ }
++ /* Fill it in */
++ memcpy(base, &tmp, sizeof(tmp));
++
++ /* Mark the lconv data stale */
++ base->lc_needs_refresh = 1;
++
++ return base;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy)
+@@ -195,7 +195,7 @@
+ }
+
+ static void
+-do_lc_all (char *buffer, int size)
++do_lc_all (locale_t locobj, char *buffer, int size)
+ {
+ char temp[64];
+ int category, same = 1;
+@@ -204,13 +204,13 @@
+ setlocale to set all locales. If all locales are
+ the same, then we can produce a very short string. */
+ for (category = 1; category < LC_ALL; ++category)
+- if (__locale_territory[0] != __locale_territory[category])
++ if (locobj->locale_territory[0] != locobj->locale_territory[category])
+ same = 0;
+
+ if (same)
+ {
+ /* All locales are set to the same territory. */
+- territory_name (__locale_territory[0], buffer, size);
++ territory_name (locobj->locale_territory[0], buffer, size);
+ }
+ else
+ {
+@@ -218,7 +218,7 @@
+ LC_CATEGORY=country;LC_CATEGORY=country; ... */
+ for (category = 0; category < LC_ALL; ++category)
+ {
+- territory_name (__locale_territory[category], temp, sizeof (temp));
++ territory_name (locobj->locale_territory[category], temp, sizeof (temp));
+ buffer = stpcpy (buffer, locale_names[category]);
+ *buffer++ = '=';
+ buffer = stpcpy (buffer, temp);
+@@ -230,15 +230,13 @@
+ }
+
+ char *
+-setlocale (int category, const char *locale)
++__setlocale_l (locale_t locobj, int category, const char *locale)
+ {
+ int new_territory, changed;
+ static char old_locale[256];
+
+- PTHREAD_UNSAFE
+-
+ /* This tells localeconv to re-read data for the lconv structure. */
+- __setlocale_called = 1;
++ locobj->lc_needs_refresh = 1;
+
+ if (locale == NULL)
+ {
+@@ -247,11 +245,11 @@
+ {
+ /* The locale string is specially encoded for LC_ALL so we
+ could restore all locales at any time. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+- territory_name (__locale_territory[category], old_locale, sizeof (old_locale));
++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+@@ -270,7 +268,7 @@
+ /* Encode the locale string, as we will be returning this
+ later. Remember, setlocale returns the locale settings
+ that are about to be changed. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+
+ /* Check for an encoded (composite) name. Simply looking for
+ a semi-colon will verify this. */
+@@ -332,11 +330,11 @@
+
+ /* We now know all locales exist, so set them. */
+ for (category = 0; category < LC_ALL; ++category)
+- __locale_territory[category] = territory_number (newnames[category]);
++ locobj->locale_territory[category] = territory_number (newnames[category]);
+
+ /* Re-build the character type tables according to the new
+ locale settings. */
+- __build_ctype_tables (__locale_territory[LC_CTYPE]);
++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]);
+ return old_locale;
+ }
+ }
+@@ -359,9 +357,9 @@
+ /* Change the locale for all categories. old_locale was created
+ when we previously checked for a composite string. */
+ for (category = 0; category < LC_ALL; ++category)
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -368,12 +366,12 @@
+ else
+ {
+ /* Change the locale for just one category. */
+- territory_name (__locale_territory[category],
++ territory_name (locobj->locale_territory[category],
+ old_locale, sizeof (old_locale));
+
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -384,7 +382,16 @@
+ is changing. The GNU Java compiler is known to repeatedly call
+ setlocale. */
+ if (changed && (category == LC_ALL || category == LC_CTYPE))
+- __build_ctype_tables (new_territory);
++ __build_ctype_tables (locobj, new_territory);
+
+ return old_locale;
+ }
++
++char *
++setlocale (int category, const char *locale)
++{
++
++ PTHREAD_UNSAFE
++
++ return __setlocale_l(&__locale_global, category, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)s1;
+ regs[2] = (int)s2;
+ regs[3] = 0;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)to;
+ regs[2] = (int)from;
+ regs[3] = size;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent)
+@@ -1,10 +0,0 @@
+-/* __locale_territory
+- * Copyright (c) 2000-2006 UnixLib Developers
+- */
+-
+-#include <locale.h>
+-
+-/* Global used for all calls to the Territory module. These variable
+- contain the territory number as set by setlocale. A value of
+- -1 means use the C locale. */
+-int __locale_territory[LC_ALL + 1];
+Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy)
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ stricmp (const char *s1, const char *s2)
+@@ -26,3 +27,24 @@
+ return result;
+ }
+ strong_alias (stricmp, strcasecmp)
++
++int
++strcasecmp_l (const char *s1, const char *s2, locale_t locobj)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ int result = 0;
++
++ if (p1 == p2)
++ return result;
++
++ while (! result)
++ {
++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
++ if (*p1++ == '\0')
++ break;
++ p2 ++;
++ }
++
++ return result;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy)
+@@ -5,6 +5,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ strnicmp (const char *s1, const char *s2, size_t n)
+@@ -26,3 +27,22 @@
+ }
+ strong_alias (strnicmp, strncasecmp)
+
++int
++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj)
++{
++ int i, j;
++
++ if (!n)
++ return 0;
++
++ do
++ {
++ i = *s1++, j = *s2++;
++ i = tolower_l (i, locobj);
++ j = tolower_l (j, locobj);
++ }
++ while (i && i == j && --n);
++
++ return i - j;
++}
++
+Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy)
+@@ -49,7 +49,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals);
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy)
+@@ -46,7 +46,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy)
+@@ -28,7 +28,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy)
+@@ -23,7 +23,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ ordinals)) != NULL)
+Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy)
+@@ -48,7 +48,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ result,
+Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy)
+@@ -353,7 +353,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+@@ -368,7 +368,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy)
+@@ -36,7 +36,7 @@
+ /* Get timezone information for current territory. */
+ _kernel_swi_regs regs;
+ #ifndef __TARGET_SCL__
+- regs.r[0] = __locale_territory[LC_TIME];
++ regs.r[0] = __locale_global.locale_territory[LC_TIME];
+ #else
+ regs.r[0] = -1; /* Current territory. */
+ #endif
+Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy)
+@@ -191,7 +191,7 @@
+ __pthread_prog_init ();
+ __unixlib_signal_initialise (__u);
+ /* Initialise ctype tables to the C locale. */
+- __build_ctype_tables (-2);
++ __build_ctype_tables (&__locale_global, -2);
+ /* Define and initialise the Unix I/O. */
+ initialise_unix_io ();
+ __stdioinit ();
+Index: gcc4/recipe/files/gcc/libunixlib/vscript
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy)
+@@ -58,6 +58,9 @@
+ __init_des_r;
+ __init_des;
+ __invalidate;
++ __locale_global;
++ __localeconv_lconv_init;
++ __localeconv_lconv_fini;
+ malloc_trim;
+ malloc_trim_unlocked;
+ malloc_unlocked;
+@@ -80,6 +83,7 @@
+ __res_vinit;
+ __runtime_features;
+ __setup_signalhandler_stack;
++ __setlocale_l;
+ __sdirinit;
+ __sfixinit;
+ __sfixfind;
-----------------------------------------------------------------------
Summary of changes:
arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
index c357db4..f378a7e 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -23,7 +23,7 @@ Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
===================================================================
--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
+++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
-@@ -10,36 +10,34 @@
+@@ -10,36 +10,35 @@
#include <internal/os.h>
#include <internal/unix.h>
@@ -71,10 +71,11 @@ Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
should return the character unchanged. */
- ctype_lower[x] = ctype_upper[x] = x - 1;
+ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
++ locobj->ctype[x] = 0;
}
int regs[10];
-@@ -61,7 +59,7 @@
+@@ -61,7 +60,7 @@
for (int offset = 1; bits; bits = bits >> 1, offset += 1)
{
if (bits & 1)
@@ -83,7 +84,7 @@ Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
}
pos += 32;
}
-@@ -80,7 +78,7 @@
+@@ -80,7 +79,7 @@
int y = (territory == -1) ? 128 : 256;
for (int x = 1; x <= y; x++)
{
--
Cross-compilation toolchains and environments
1 year, 3 months
toolchains: branch jmb/gccsdk-4.7.4r6 updated. 22135a6c8e90338574f506baf384c92562db54ee
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/22135a6c8e90338574...
...commit http://git.netsurf-browser.org/toolchains.git/commit/22135a6c8e90338574f5...
...tree http://git.netsurf-browser.org/toolchains.git/tree/22135a6c8e90338574f506...
The branch, jmb/gccsdk-4.7.4r6 has been updated
via 22135a6c8e90338574f506baf384c92562db54ee (commit)
via 1c7ac653095c7e7edb56c1d0054610ce526bfea5 (commit)
from 892c5d970932541f9a5261fe75d0bb04384954a5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=22135a6c8e903385...
commit 22135a6c8e90338574f506baf384c92562db54ee
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
OpenSSL: drop unnecessary patch
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
deleted file mode 100644
index e0ecc21..0000000
--- a/sdk/recipes/patches/openssl/crypto.ctype.c.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
---- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
-@@ -295,7 +295,7 @@
- /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
- * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
-
--#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
-+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
-
- # if defined OPENSSL_SYS_WINDOWS
- # define locale_t _locale_t
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=1c7ac653095c7e7e...
commit 1c7ac653095c7e7edb56c1d0054610ce526bfea5
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
UnixLib: add POSIX extended locale support
This is not a complete implementation, but is sufficient for
OpenSSL3's purposes.
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
new file mode 100644
index 0000000..c357db4
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -0,0 +1,1351 @@
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
+@@ -587,7 +587,7 @@
+ locale/setlocale.c \
+ locale/strcoll.c \
+ locale/strxfrm.c \
+- locale/territory.c
++ locale/newlocale.c
+ endif
+ locale_src += \
+ locale/iconv.c
+@@ -1312,6 +1312,7 @@
+ bits/in.h \
+ bits/libc-lock.h \
+ bits/locale.h \
++ bits/locale_t.h \
+ bits/mathcalls.h \
+ bits/mathdef.h \
+ bits/mathinline.h \
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
+@@ -10,36 +10,34 @@
+ #include <internal/os.h>
+ #include <internal/unix.h>
+
+-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must
+- support EOF. */
+-static unsigned char ctype[257];
+-const unsigned char * const __ctype = &ctype[1];
++/* Global containing current locale settings. */
++struct _locale __locale_global;
++/* Offset 1 as the first entry is reserved for EOF. */
++const unsigned char * const __ctype = &__locale_global.ctype[1];
++const short * const __ctype_upper = &__locale_global.ctype_upper[1];
++const short * const __ctype_lower = &__locale_global.ctype_lower[1];
+
+-static short ctype_upper[257];
+-const short * const __ctype_upper = &ctype_upper[1];
+-
+-static short ctype_lower[257];
+-const short * const __ctype_lower = &ctype_lower[1];
+-
+ void
+-__build_ctype_tables (int territory)
++__build_ctype_tables (locale_t locobj, int territory)
+ {
+ PTHREAD_UNSAFE
+
+ if (territory == -2)
+ {
+- /* Initialise the array. This is only done by __unixinit(). */
++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */
+ territory = -1;
+- for (int x = 0; x <= LC_ALL; x++)
+- __locale_territory[x] = -1;
++ for (int x = 0; x < LC_ALL; x++)
++ locobj->locale_territory[x] = -1;
++ __localeconv_lconv_init(&locobj->lc);
++ locobj->lc_needs_refresh = 1;
+ }
+
+ /* Initialise ctype_upper/ctype_lower tables. */
+ for (int x = 0; x < 257; x++)
+ {
+- /* In the C/POSIX locate, tolower(top bit set char)
++ /* In the C/POSIX locale, tolower(top bit set char)
+ should return the character unchanged. */
+- ctype_lower[x] = ctype_upper[x] = x - 1;
++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
+ }
+
+ int regs[10];
+@@ -61,7 +59,7 @@
+ for (int offset = 1; bits; bits = bits >> 1, offset += 1)
+ {
+ if (bits & 1)
+- ctype[pos + offset] |= 1 << code;
++ locobj->ctype[pos + offset] |= 1 << code;
+ }
+ pos += 32;
+ }
+@@ -80,7 +78,7 @@
+ int y = (territory == -1) ? 128 : 256;
+ for (int x = 1; x <= y; x++)
+ {
+- ctype_lower[x] = (short)*p++;
+- ctype_upper[x] = (short)*q++;
++ locobj->ctype_lower[x] = (short)*p++;
++ locobj->ctype_upper[x] = (short)*q++;
+ }
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalnum) (int c)
+@@ -10,3 +11,8 @@
+ return isalnum (c);
+ }
+
++int
++isalnum_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalpha) (int c)
+@@ -10,3 +11,8 @@
+ return isalpha (c);
+ }
+
++int
++isalpha_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_alpha);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return isascii (c);
+ }
+
++int
++isascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy)
+@@ -9,3 +9,10 @@
+ {
+ return isblank (c);
+ }
++
++int
++isblank_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isblank (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (iscntrl) (int c)
+@@ -10,3 +11,8 @@
+ return iscntrl (c);
+ }
+
++int
++iscntrl_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isdigit (c);
+ }
+
++int
++isdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_digit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isgraph) (int c)
+@@ -10,3 +11,8 @@
+ return isgraph (c);
+ }
+
++int
++isgraph_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (islower) (int c)
+@@ -10,3 +11,8 @@
+ return islower (c);
+ }
+
++int
++islower_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_lower);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isprint) (int c)
+@@ -10,3 +11,10 @@
+ return isprint (c);
+ }
+
++int
++isprint_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] &
++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc |
++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (ispunct) (int c)
+@@ -10,3 +11,8 @@
+ return ispunct (c);
+ }
+
++int
++ispunct_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_punc);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isspace) (int c)
+@@ -10,3 +11,8 @@
+ return isspace (c);
+ }
+
++int
++isspace_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_white);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isupper) (int c)
+@@ -10,3 +11,8 @@
+ return isupper (c);
+ }
+
++int
++isupper_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_upper);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isxdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isxdigit (c);
+ }
+
++int
++isxdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return toascii (c);
+ }
+
++int
++toascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return toascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (tolower) (int c)
+@@ -10,3 +11,8 @@
+ return tolower (c);
+ }
+
++int
++tolower_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_lower[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (toupper) (int c)
+@@ -10,3 +11,8 @@
+ return toupper (c);
+ }
+
++int
++toupper_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_upper[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy)
+@@ -13,15 +13,36 @@
+
+ #ifndef __TARGET_SCL__
+
+-/* Territory number for each locale. C locale is -1. */
+-extern int __locale_territory[LC_ALL + 1];
++struct _locale {
++ /* Map from locale category to territory number. C locale is -1. */
++ int locale_territory[LC_ALL];
+
+-/* Set to 1 is setlocale has been called since the last call to
+- localeconv. localeconv uses this flag to cache the lconv structure. */
+-extern int __setlocale_called;
++ /* Character type LUTs: EOF + one entry per character
++ *
++ * EOF is defined as -1, so character entries start at offset 1.
++ */
++ short ctype_upper[257];
++ short ctype_lower[257];
++ unsigned char ctype[257];
+
+-extern void __build_ctype_tables (int __territory) __THROW;
++ /* Set to 1 if the locale information has changed since the last time
++ * the lconv structure was updated. */
++ int lc_needs_refresh;
++ /* Numeric formatting information for locale */
++ struct lconv lc;
++};
+
++extern struct _locale __locale_global;
++
++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW;
++
++extern char *__setlocale_l (locale_t locobj, int __category,
++ const char *__locale) __THROW;
++
++void __localeconv_lconv_init (struct lconv *lc);
++void __localeconv_lconv_fini (struct lconv *lc);
++void __localeconv_l (locale_t locobj);
++
+ #endif
+
+ __END_DECLS
+Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+@@ -0,0 +1,10 @@
++/*
++ * Copyright (c) 2022 UnixLib Developers
++ */
++
++#ifndef _BITS_LOCALE_T_H_
++#define _BITS_LOCALE_T_H_
++
++typedef struct _locale *locale_t;
++
++#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy)
+@@ -51,6 +51,48 @@
+ extern int isblank (int __c) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++/* c is alphabetic or numeric. */
++extern int isalnum_l (int __c, locale_t locobj) __THROW;
++
++/* c is alphabetic. */
++extern int isalpha_l (int __c, locale_t locobj) __THROW;
++
++/* c is a control character. */
++extern int iscntrl_l (int __c, locale_t locobj) __THROW;
++
++/* c is a decimal digit. */
++extern int isdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is any printable character other than a space. */
++extern int isgraph_l (int __c, locale_t locobj) __THROW;
++
++/* c is a lower-case letter. */
++extern int islower_l (int __c, locale_t locobj) __THROW;
++
++/* c is an upper-case letter. */
++extern int isupper_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character. */
++extern int isprint_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character other than a space or a
++ alphanumeric character. */
++extern int ispunct_l (int __c, locale_t locobj) __THROW;
++
++/* c is a white space character e.g. space, newline, tab, linefeed,
++ return, vertical tab. */
++extern int isspace_l (int __c, locale_t locobj) __THROW;
++
++/* c is a hex digit. */
++extern int isxdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is tab or space. */
++extern int isblank_l (int __c, locale_t locobj) __THROW;
++# endif
++
+ /* Characteristics. */
+ extern const unsigned char * const __ctype;
+ /* Lower case table. */
+@@ -108,6 +150,10 @@
+ extern int toupper (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define toupper(c) ((int) __ctype_upper[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int toupper_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ /* Convert c to lower case. */
+@@ -114,6 +160,10 @@
+ extern int tolower (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define tolower(c) ((int) __ctype_lower[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int tolower_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ #ifndef __TARGET_SCL__
+@@ -135,6 +185,11 @@
+ /* Is c an ASCII character. */
+ extern int isascii (int __c) __THROW;
+ # define isascii(c) ((unsigned)(c) <= 0x7f)
++
++# ifdef __USE_XOPEN2K8
++extern int toascii_l (int __c, locale_t locobj) __THROW;
++extern int isascii_l (int __c, locale_t locobj) __THROW;
++# endif
+ # endif
+ #endif
+
+Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy)
+@@ -33,16 +33,16 @@
+ /* Entire locale. */
+ # define LC_ALL 6
+
+-#define LC_COLLATE_MASK (1L << 1)
+-#define LC_CTYPE_MASK (1L << 2)
+-#define LC_MESSAGES_MASK (1L << 3)
+-#define LC_MONETARY_MASK (1L << 4)
+-#define LC_NUMERIC_MASK (1L << 5)
+-#define LC_TIME_MASK (1L << 6)
+-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# ifdef __USE_XOPEN2K8
++# define LC_COLLATE_MASK (1L << 0)
++# define LC_CTYPE_MASK (1L << 1)
++# define LC_MESSAGES_MASK (1L << 2)
++# define LC_MONETARY_MASK (1L << 3)
++# define LC_NUMERIC_MASK (1L << 4)
++# define LC_TIME_MASK (1L << 5)
++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# endif
+
+-typedef struct _locale *locale_t;
+-
+ #else
+ /* String collation (functions 'strcoll' and 'strxfrm'). */
+ # define LC_COLLATE 1
+@@ -121,6 +121,9 @@
+ extern struct lconv *localeconv (void) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
+ extern locale_t uselocale(locale_t newloc);
+
+ extern void freelocale(locale_t locobj);
+@@ -127,7 +130,8 @@
+
+ extern locale_t newlocale(int category_mask, const char *locale,
+ locale_t base);
+-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# endif
+ #endif
+
+ __END_NAMESPACE_STD
+Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
+@@ -281,6 +281,17 @@
+ /* Compare no more than N chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
++
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
+ #endif /* Use BSD. */
+
+ #if defined __USE_XOPEN2K || defined __USE_MISC
+Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy)
+@@ -37,7 +37,17 @@
+ /* Compare n chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
++
+ /* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+ extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy)
+@@ -14,8 +14,6 @@
+
+ /* #define DEBUG */
+
+-int __setlocale_called = 1;
+-
+ static int
+ read_symbol (int reason_code, int territory)
+ {
+@@ -71,26 +69,44 @@
+ *grouping = new_grouping;
+ }
+
+-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL,
+- NULL, NULL, NULL, NULL, NULL,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX };
++void
++__localeconv_lconv_init (struct lconv *lc)
++{
++ memset(lc, 0, sizeof(*lc));
++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes =
++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space =
++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX;
++}
+
+-/* Defined by POSIX as not threadsafe */
+-struct lconv *
+-localeconv (void)
++void
++__localeconv_lconv_fini (struct lconv *lc)
+ {
++ free(lc->decimal_point);
++ free(lc->thousands_sep);
++ free(lc->grouping);
++ free(lc->int_curr_symbol);
++ free(lc->currency_symbol);
++ free(lc->mon_decimal_point);
++ free(lc->mon_thousands_sep);
++ free(lc->mon_grouping);
++ free(lc->positive_sign);
++ free(lc->negative_sign);
++}
++
++void
++__localeconv_l (locale_t locobj)
++{
+ int numeric, monetary;
+
+ /* If setlocale has not been called since the last call to
+ localeconv, then the lconv structure will be the same. */
+- if (!__setlocale_called)
+- return &lc;
++ if (!locobj->lc_needs_refresh)
++ return;
+
+- __setlocale_called = 0;
++ locobj->lc_needs_refresh = 0;
+
+- numeric = __locale_territory[LC_NUMERIC];
+- monetary = __locale_territory[LC_MONETARY];
++ numeric = locobj->locale_territory[LC_NUMERIC];
++ monetary = locobj->locale_territory[LC_MONETARY];
+
+ /* See the PRMs regarding SWI Territory_ReadSymbols for the
+ meanings of the following numbers. */
+@@ -97,71 +113,80 @@
+ if (numeric == -1)
+ {
+ /* We're using the 'C' locale. */
+- free (lc.decimal_point);
+- lc.decimal_point = strdup (".");
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ("");
+- free (lc.grouping);
+- lc.grouping = strdup ("");
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup (".");
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ("");
++ free (locobj->lc.grouping);
++ locobj->lc.grouping = strdup ("");
+ }
+ else
+ {
+- free (lc.decimal_point);
+- lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
+- read_byte_list (2, &lc.grouping, numeric);
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
++ read_byte_list (2, &locobj->lc.grouping, numeric);
+ }
+ if (monetary == -1)
+ {
+ /* We using the 'C' locale. Empty strings and CHAR_MAX means
+ that these fields are unspecified. */
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ("");
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ("");
+- free (lc.mon_grouping);
+- lc.mon_grouping = strdup ("");
+- lc.int_frac_digits = CHAR_MAX;
+- lc.frac_digits = CHAR_MAX;
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ("");
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ("");
+- lc.p_cs_precedes = CHAR_MAX;
+- lc.n_cs_precedes = CHAR_MAX;
+- lc.p_sep_by_space = CHAR_MAX;
+- lc.n_sep_by_space = CHAR_MAX;
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ("");
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ("");
+- lc.p_sign_posn = CHAR_MAX;
+- lc.n_sign_posn = CHAR_MAX;
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ("");
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ("");
++ free (locobj->lc.mon_grouping);
++ locobj->lc.mon_grouping = strdup ("");
++ locobj->lc.int_frac_digits = CHAR_MAX;
++ locobj->lc.frac_digits = CHAR_MAX;
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ("");
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ("");
++ locobj->lc.p_cs_precedes = CHAR_MAX;
++ locobj->lc.n_cs_precedes = CHAR_MAX;
++ locobj->lc.p_sep_by_space = CHAR_MAX;
++ locobj->lc.n_sep_by_space = CHAR_MAX;
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ("");
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ("");
++ locobj->lc.p_sign_posn = CHAR_MAX;
++ locobj->lc.n_sign_posn = CHAR_MAX;
+ }
+ else
+ {
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
+- read_byte_list (7, &lc.mon_grouping, monetary);
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
+- lc.int_frac_digits = (char)read_symbol (10, monetary);
+- lc.frac_digits = (char)read_symbol (11, monetary);
+- lc.p_cs_precedes = (char)read_symbol (12, monetary);
+- lc.p_sep_by_space = (char)read_symbol (13, monetary);
+- lc.n_cs_precedes = (char)read_symbol (14, monetary);
+- lc.n_sep_by_space = (char)read_symbol (15, monetary);
+- lc.p_sign_posn = (char)read_symbol (16, monetary);
+- lc.n_sign_posn = (char)read_symbol (17, monetary);
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
++ read_byte_list (7, &locobj->lc.mon_grouping, monetary);
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary);
++ locobj->lc.frac_digits = (char)read_symbol (11, monetary);
++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary);
++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary);
++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary);
++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary);
++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary);
++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary);
+ }
+- return &lc;
++ return;
+ }
++
++/* Defined by POSIX as not threadsafe */
++struct lconv *
++localeconv (void)
++{
++ __localeconv_l (&__locale_global);
++
++ return &__locale_global.lc;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
+@@ -1,15 +1,15 @@
+ /* Copyright (c) 2019 UnixLib Developers
+ */
+
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
++
++#include <internal/unix.h>
+
+-struct _locale {
+- struct lconv lc;
+-};
+-
+ /* This is supposed to be per-thread. */
+ static locale_t current_locale;
+
+@@ -27,20 +27,71 @@
+
+ void freelocale(locale_t locobj)
+ {
+- if (locobj)
++ if (locobj) {
++ __localeconv_lconv_fini(&locobj->lc);
+ free(locobj);
++ }
+ }
+
+ locale_t newlocale(int category_mask, const char *locale,
+ locale_t base)
+ {
+- locale_t loc = (locale_t)malloc(sizeof(*loc));
+- if (!loc) {
+- __set_errno (ENOMEM);
++ struct _locale tmp;
++
++ PTHREAD_UNSAFE
++
++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
++ __set_errno (EINVAL);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ /* The locale provided will be verified by __setlocale_l() */
+
+- return loc;
++ /* Prepare the temporary locale we will modify */
++ if (base != 0 && base != LC_GLOBAL_LOCALE) {
++ memcpy(&tmp, base, sizeof(tmp));
++ } else {
++ if (base == LC_GLOBAL_LOCALE) {
++ /* Undefined: be helpful to client */
++ memcpy(&tmp, &__locale_global, sizeof(tmp));
++ } else {
++ /* Initialise to C locale */
++ __build_ctype_tables(&tmp, -2);
++ }
++ }
++
++ /* Now, apply the requested locale to each of the categories in the mask */
++ if (category_mask == LC_ALL_MASK) {
++ /* Special-case LC_ALL to handle the encoded locale string */
++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) {
++ return 0;
++ }
++ } else {
++ int category = 0, mask = category_mask;
++ while (mask != 0) {
++ if (mask & 1) {
++ if (__setlocale_l(&tmp, category, locale) == NULL) {
++ return 0;
++ }
++ }
++ category++;
++ mask >>= 1;
++ }
++ }
++
++ /* Allocate the result, if necessary */
++ if (base == 0 || base == LC_GLOBAL_LOCALE) {
++ base = (locale_t)malloc(sizeof(*base));
++ if (!base) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++ }
++ /* Fill it in */
++ memcpy(base, &tmp, sizeof(tmp));
++
++ /* Mark the lconv data stale */
++ base->lc_needs_refresh = 1;
++
++ return base;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy)
+@@ -195,7 +195,7 @@
+ }
+
+ static void
+-do_lc_all (char *buffer, int size)
++do_lc_all (locale_t locobj, char *buffer, int size)
+ {
+ char temp[64];
+ int category, same = 1;
+@@ -204,13 +204,13 @@
+ setlocale to set all locales. If all locales are
+ the same, then we can produce a very short string. */
+ for (category = 1; category < LC_ALL; ++category)
+- if (__locale_territory[0] != __locale_territory[category])
++ if (locobj->locale_territory[0] != locobj->locale_territory[category])
+ same = 0;
+
+ if (same)
+ {
+ /* All locales are set to the same territory. */
+- territory_name (__locale_territory[0], buffer, size);
++ territory_name (locobj->locale_territory[0], buffer, size);
+ }
+ else
+ {
+@@ -218,7 +218,7 @@
+ LC_CATEGORY=country;LC_CATEGORY=country; ... */
+ for (category = 0; category < LC_ALL; ++category)
+ {
+- territory_name (__locale_territory[category], temp, sizeof (temp));
++ territory_name (locobj->locale_territory[category], temp, sizeof (temp));
+ buffer = stpcpy (buffer, locale_names[category]);
+ *buffer++ = '=';
+ buffer = stpcpy (buffer, temp);
+@@ -230,15 +230,13 @@
+ }
+
+ char *
+-setlocale (int category, const char *locale)
++__setlocale_l (locale_t locobj, int category, const char *locale)
+ {
+ int new_territory, changed;
+ static char old_locale[256];
+
+- PTHREAD_UNSAFE
+-
+ /* This tells localeconv to re-read data for the lconv structure. */
+- __setlocale_called = 1;
++ locobj->lc_needs_refresh = 1;
+
+ if (locale == NULL)
+ {
+@@ -247,11 +245,11 @@
+ {
+ /* The locale string is specially encoded for LC_ALL so we
+ could restore all locales at any time. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+- territory_name (__locale_territory[category], old_locale, sizeof (old_locale));
++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+@@ -270,7 +268,7 @@
+ /* Encode the locale string, as we will be returning this
+ later. Remember, setlocale returns the locale settings
+ that are about to be changed. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+
+ /* Check for an encoded (composite) name. Simply looking for
+ a semi-colon will verify this. */
+@@ -332,11 +330,11 @@
+
+ /* We now know all locales exist, so set them. */
+ for (category = 0; category < LC_ALL; ++category)
+- __locale_territory[category] = territory_number (newnames[category]);
++ locobj->locale_territory[category] = territory_number (newnames[category]);
+
+ /* Re-build the character type tables according to the new
+ locale settings. */
+- __build_ctype_tables (__locale_territory[LC_CTYPE]);
++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]);
+ return old_locale;
+ }
+ }
+@@ -359,9 +357,9 @@
+ /* Change the locale for all categories. old_locale was created
+ when we previously checked for a composite string. */
+ for (category = 0; category < LC_ALL; ++category)
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -368,12 +366,12 @@
+ else
+ {
+ /* Change the locale for just one category. */
+- territory_name (__locale_territory[category],
++ territory_name (locobj->locale_territory[category],
+ old_locale, sizeof (old_locale));
+
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -384,7 +382,16 @@
+ is changing. The GNU Java compiler is known to repeatedly call
+ setlocale. */
+ if (changed && (category == LC_ALL || category == LC_CTYPE))
+- __build_ctype_tables (new_territory);
++ __build_ctype_tables (locobj, new_territory);
+
+ return old_locale;
+ }
++
++char *
++setlocale (int category, const char *locale)
++{
++
++ PTHREAD_UNSAFE
++
++ return __setlocale_l(&__locale_global, category, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)s1;
+ regs[2] = (int)s2;
+ regs[3] = 0;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)to;
+ regs[2] = (int)from;
+ regs[3] = size;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent)
+@@ -1,10 +0,0 @@
+-/* __locale_territory
+- * Copyright (c) 2000-2006 UnixLib Developers
+- */
+-
+-#include <locale.h>
+-
+-/* Global used for all calls to the Territory module. These variable
+- contain the territory number as set by setlocale. A value of
+- -1 means use the C locale. */
+-int __locale_territory[LC_ALL + 1];
+Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy)
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ stricmp (const char *s1, const char *s2)
+@@ -26,3 +27,24 @@
+ return result;
+ }
+ strong_alias (stricmp, strcasecmp)
++
++int
++strcasecmp_l (const char *s1, const char *s2, locale_t locobj)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ int result = 0;
++
++ if (p1 == p2)
++ return result;
++
++ while (! result)
++ {
++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
++ if (*p1++ == '\0')
++ break;
++ p2 ++;
++ }
++
++ return result;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy)
+@@ -5,6 +5,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ strnicmp (const char *s1, const char *s2, size_t n)
+@@ -26,3 +27,22 @@
+ }
+ strong_alias (strnicmp, strncasecmp)
+
++int
++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj)
++{
++ int i, j;
++
++ if (!n)
++ return 0;
++
++ do
++ {
++ i = *s1++, j = *s2++;
++ i = tolower_l (i, locobj);
++ j = tolower_l (j, locobj);
++ }
++ while (i && i == j && --n);
++
++ return i - j;
++}
++
+Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy)
+@@ -49,7 +49,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals);
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy)
+@@ -46,7 +46,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy)
+@@ -28,7 +28,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy)
+@@ -23,7 +23,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ ordinals)) != NULL)
+Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy)
+@@ -48,7 +48,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ result,
+Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy)
+@@ -353,7 +353,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+@@ -368,7 +368,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy)
+@@ -36,7 +36,7 @@
+ /* Get timezone information for current territory. */
+ _kernel_swi_regs regs;
+ #ifndef __TARGET_SCL__
+- regs.r[0] = __locale_territory[LC_TIME];
++ regs.r[0] = __locale_global.locale_territory[LC_TIME];
+ #else
+ regs.r[0] = -1; /* Current territory. */
+ #endif
+Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy)
+@@ -191,7 +191,7 @@
+ __pthread_prog_init ();
+ __unixlib_signal_initialise (__u);
+ /* Initialise ctype tables to the C locale. */
+- __build_ctype_tables (-2);
++ __build_ctype_tables (&__locale_global, -2);
+ /* Define and initialise the Unix I/O. */
+ initialise_unix_io ();
+ __stdioinit ();
+Index: gcc4/recipe/files/gcc/libunixlib/vscript
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy)
+@@ -58,6 +58,9 @@
+ __init_des_r;
+ __init_des;
+ __invalidate;
++ __locale_global;
++ __localeconv_lconv_init;
++ __localeconv_lconv_fini;
+ malloc_trim;
+ malloc_trim_unlocked;
+ malloc_unlocked;
+@@ -80,6 +83,7 @@
+ __res_vinit;
+ __runtime_features;
+ __setup_signalhandler_stack;
++ __setlocale_l;
+ __sdirinit;
+ __sfixinit;
+ __sfixfind;
-----------------------------------------------------------------------
Summary of changes:
.../recipes/patches/gcc4/posix-extended-locale.p | 1351 ++++++++++++++++++++
sdk/recipes/patches/openssl/crypto.ctype.c.p | 11 -
2 files changed, 1351 insertions(+), 11 deletions(-)
create mode 100644 arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
delete mode 100644 sdk/recipes/patches/openssl/crypto.ctype.c.p
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
new file mode 100644
index 0000000..c357db4
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/posix-extended-locale.p
@@ -0,0 +1,1351 @@
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (working copy)
+@@ -587,7 +587,7 @@
+ locale/setlocale.c \
+ locale/strcoll.c \
+ locale/strxfrm.c \
+- locale/territory.c
++ locale/newlocale.c
+ endif
+ locale_src += \
+ locale/iconv.c
+@@ -1312,6 +1312,7 @@
+ bits/in.h \
+ bits/libc-lock.h \
+ bits/locale.h \
++ bits/locale_t.h \
+ bits/mathcalls.h \
+ bits/mathdef.h \
+ bits/mathinline.h \
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ctypetable.c (working copy)
+@@ -10,36 +10,34 @@
+ #include <internal/os.h>
+ #include <internal/unix.h>
+
+-/* Note the offset 1 and depth 257 instead of 0 and 256: ISO C says we must
+- support EOF. */
+-static unsigned char ctype[257];
+-const unsigned char * const __ctype = &ctype[1];
++/* Global containing current locale settings. */
++struct _locale __locale_global;
++/* Offset 1 as the first entry is reserved for EOF. */
++const unsigned char * const __ctype = &__locale_global.ctype[1];
++const short * const __ctype_upper = &__locale_global.ctype_upper[1];
++const short * const __ctype_lower = &__locale_global.ctype_lower[1];
+
+-static short ctype_upper[257];
+-const short * const __ctype_upper = &ctype_upper[1];
+-
+-static short ctype_lower[257];
+-const short * const __ctype_lower = &ctype_lower[1];
+-
+ void
+-__build_ctype_tables (int territory)
++__build_ctype_tables (locale_t locobj, int territory)
+ {
+ PTHREAD_UNSAFE
+
+ if (territory == -2)
+ {
+- /* Initialise the array. This is only done by __unixinit(). */
++ /* Initialise the array. This is only done by __unixinit()/newlocale(). */
+ territory = -1;
+- for (int x = 0; x <= LC_ALL; x++)
+- __locale_territory[x] = -1;
++ for (int x = 0; x < LC_ALL; x++)
++ locobj->locale_territory[x] = -1;
++ __localeconv_lconv_init(&locobj->lc);
++ locobj->lc_needs_refresh = 1;
+ }
+
+ /* Initialise ctype_upper/ctype_lower tables. */
+ for (int x = 0; x < 257; x++)
+ {
+- /* In the C/POSIX locate, tolower(top bit set char)
++ /* In the C/POSIX locale, tolower(top bit set char)
+ should return the character unchanged. */
+- ctype_lower[x] = ctype_upper[x] = x - 1;
++ locobj->ctype_lower[x] = locobj->ctype_upper[x] = x - 1;
+ }
+
+ int regs[10];
+@@ -61,7 +59,7 @@
+ for (int offset = 1; bits; bits = bits >> 1, offset += 1)
+ {
+ if (bits & 1)
+- ctype[pos + offset] |= 1 << code;
++ locobj->ctype[pos + offset] |= 1 << code;
+ }
+ pos += 32;
+ }
+@@ -80,7 +78,7 @@
+ int y = (territory == -1) ? 128 : 256;
+ for (int x = 1; x <= y; x++)
+ {
+- ctype_lower[x] = (short)*p++;
+- ctype_upper[x] = (short)*q++;
++ locobj->ctype_lower[x] = (short)*p++;
++ locobj->ctype_upper[x] = (short)*q++;
+ }
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalnum.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalnum) (int c)
+@@ -10,3 +11,8 @@
+ return isalnum (c);
+ }
+
++int
++isalnum_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & (___ctype_alpha | ___ctype_digit));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isalpha.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isalpha) (int c)
+@@ -10,3 +11,8 @@
+ return isalpha (c);
+ }
+
++int
++isalpha_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_alpha);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return isascii (c);
+ }
+
++int
++isascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isblank.c (working copy)
+@@ -9,3 +9,10 @@
+ {
+ return isblank (c);
+ }
++
++int
++isblank_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return isblank (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/iscntrl.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (iscntrl) (int c)
+@@ -10,3 +11,8 @@
+ return iscntrl (c);
+ }
+
++int
++iscntrl_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isdigit (c);
+ }
+
++int
++isdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_digit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isgraph.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isgraph) (int c)
+@@ -10,3 +11,8 @@
+ return isgraph (c);
+ }
+
++int
++isgraph_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ~(___ctype_white | ___ctype_ctrl));
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/islower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/islower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (islower) (int c)
+@@ -10,3 +11,8 @@
+ return islower (c);
+ }
+
++int
++islower_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_lower);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isprint.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isprint) (int c)
+@@ -10,3 +11,10 @@
+ return isprint (c);
+ }
+
++int
++isprint_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] &
++ (___ctype_upper | ___ctype_lower | ___ctype_digit | ___ctype_punc |
++ ___ctype_white)) && !((&locobj->ctype[1])[c] & ___ctype_ctrl);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/ispunct.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (ispunct) (int c)
+@@ -10,3 +11,8 @@
+ return ispunct (c);
+ }
+
++int
++ispunct_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_punc);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isspace.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isspace) (int c)
+@@ -10,3 +11,8 @@
+ return isspace (c);
+ }
+
++int
++isspace_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_white);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isupper) (int c)
+@@ -10,3 +11,8 @@
+ return isupper (c);
+ }
+
++int
++isupper_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_upper);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/isxdigit.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (isxdigit) (int c)
+@@ -10,3 +11,8 @@
+ return isxdigit (c);
+ }
+
++int
++isxdigit_l (int c, locale_t locobj)
++{
++ return ((&locobj->ctype[1])[c] & ___ctype_xdigit);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toascii.c (working copy)
+@@ -10,3 +10,9 @@
+ return toascii (c);
+ }
+
++int
++toascii_l (int c, locale_t locobj)
++{
++ (void) locobj;
++ return toascii (c);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/tolower.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (tolower) (int c)
+@@ -10,3 +11,8 @@
+ return tolower (c);
+ }
+
++int
++tolower_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_lower[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/ctype/toupper.c (working copy)
+@@ -3,6 +3,7 @@
+ */
+
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ (toupper) (int c)
+@@ -10,3 +11,8 @@
+ return toupper (c);
+ }
+
++int
++toupper_l (int c, locale_t locobj)
++{
++ return (&locobj->ctype_upper[1])[c];
++}
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/locale.h (working copy)
+@@ -13,15 +13,36 @@
+
+ #ifndef __TARGET_SCL__
+
+-/* Territory number for each locale. C locale is -1. */
+-extern int __locale_territory[LC_ALL + 1];
++struct _locale {
++ /* Map from locale category to territory number. C locale is -1. */
++ int locale_territory[LC_ALL];
+
+-/* Set to 1 is setlocale has been called since the last call to
+- localeconv. localeconv uses this flag to cache the lconv structure. */
+-extern int __setlocale_called;
++ /* Character type LUTs: EOF + one entry per character
++ *
++ * EOF is defined as -1, so character entries start at offset 1.
++ */
++ short ctype_upper[257];
++ short ctype_lower[257];
++ unsigned char ctype[257];
+
+-extern void __build_ctype_tables (int __territory) __THROW;
++ /* Set to 1 if the locale information has changed since the last time
++ * the lconv structure was updated. */
++ int lc_needs_refresh;
++ /* Numeric formatting information for locale */
++ struct lconv lc;
++};
+
++extern struct _locale __locale_global;
++
++extern void __build_ctype_tables (locale_t locobj, int __territory) __THROW;
++
++extern char *__setlocale_l (locale_t locobj, int __category,
++ const char *__locale) __THROW;
++
++void __localeconv_lconv_init (struct lconv *lc);
++void __localeconv_lconv_fini (struct lconv *lc);
++void __localeconv_l (locale_t locobj);
++
+ #endif
+
+ __END_DECLS
+Index: gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (nonexistent)
++++ gcc4/recipe/files/gcc/libunixlib/include/bits/locale_t.h (working copy)
+@@ -0,0 +1,10 @@
++/*
++ * Copyright (c) 2022 UnixLib Developers
++ */
++
++#ifndef _BITS_LOCALE_T_H_
++#define _BITS_LOCALE_T_H_
++
++typedef struct _locale *locale_t;
++
++#endif
+Index: gcc4/recipe/files/gcc/libunixlib/include/ctype.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/ctype.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/ctype.h (working copy)
+@@ -51,6 +51,48 @@
+ extern int isblank (int __c) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++/* c is alphabetic or numeric. */
++extern int isalnum_l (int __c, locale_t locobj) __THROW;
++
++/* c is alphabetic. */
++extern int isalpha_l (int __c, locale_t locobj) __THROW;
++
++/* c is a control character. */
++extern int iscntrl_l (int __c, locale_t locobj) __THROW;
++
++/* c is a decimal digit. */
++extern int isdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is any printable character other than a space. */
++extern int isgraph_l (int __c, locale_t locobj) __THROW;
++
++/* c is a lower-case letter. */
++extern int islower_l (int __c, locale_t locobj) __THROW;
++
++/* c is an upper-case letter. */
++extern int isupper_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character. */
++extern int isprint_l (int __c, locale_t locobj) __THROW;
++
++/* c is a printable character other than a space or a
++ alphanumeric character. */
++extern int ispunct_l (int __c, locale_t locobj) __THROW;
++
++/* c is a white space character e.g. space, newline, tab, linefeed,
++ return, vertical tab. */
++extern int isspace_l (int __c, locale_t locobj) __THROW;
++
++/* c is a hex digit. */
++extern int isxdigit_l (int __c, locale_t locobj) __THROW;
++
++/* c is tab or space. */
++extern int isblank_l (int __c, locale_t locobj) __THROW;
++# endif
++
+ /* Characteristics. */
+ extern const unsigned char * const __ctype;
+ /* Lower case table. */
+@@ -108,6 +150,10 @@
+ extern int toupper (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define toupper(c) ((int) __ctype_upper[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int toupper_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ /* Convert c to lower case. */
+@@ -114,6 +160,10 @@
+ extern int tolower (int __c) __THROW;
+ #ifndef __TARGET_SCL__
+ # define tolower(c) ((int) __ctype_lower[(int) (c)])
++
++# ifdef __USE_XOPEN2K8
++extern int tolower_l (int __c, locale_t locobj) __THROW;
++# endif
+ #endif
+
+ #ifndef __TARGET_SCL__
+@@ -135,6 +185,11 @@
+ /* Is c an ASCII character. */
+ extern int isascii (int __c) __THROW;
+ # define isascii(c) ((unsigned)(c) <= 0x7f)
++
++# ifdef __USE_XOPEN2K8
++extern int toascii_l (int __c, locale_t locobj) __THROW;
++extern int isascii_l (int __c, locale_t locobj) __THROW;
++# endif
+ # endif
+ #endif
+
+Index: gcc4/recipe/files/gcc/libunixlib/include/locale.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/locale.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/locale.h (working copy)
+@@ -33,16 +33,16 @@
+ /* Entire locale. */
+ # define LC_ALL 6
+
+-#define LC_COLLATE_MASK (1L << 1)
+-#define LC_CTYPE_MASK (1L << 2)
+-#define LC_MESSAGES_MASK (1L << 3)
+-#define LC_MONETARY_MASK (1L << 4)
+-#define LC_NUMERIC_MASK (1L << 5)
+-#define LC_TIME_MASK (1L << 6)
+-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# ifdef __USE_XOPEN2K8
++# define LC_COLLATE_MASK (1L << 0)
++# define LC_CTYPE_MASK (1L << 1)
++# define LC_MESSAGES_MASK (1L << 2)
++# define LC_MONETARY_MASK (1L << 3)
++# define LC_NUMERIC_MASK (1L << 4)
++# define LC_TIME_MASK (1L << 5)
++# define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
++# endif
+
+-typedef struct _locale *locale_t;
+-
+ #else
+ /* String collation (functions 'strcoll' and 'strxfrm'). */
+ # define LC_COLLATE 1
+@@ -121,6 +121,9 @@
+ extern struct lconv *localeconv (void) __THROW;
+
+ #ifndef __TARGET_SCL__
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
+ extern locale_t uselocale(locale_t newloc);
+
+ extern void freelocale(locale_t locobj);
+@@ -127,7 +130,8 @@
+
+ extern locale_t newlocale(int category_mask, const char *locale,
+ locale_t base);
+-# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# define LC_GLOBAL_LOCALE ((locale_t) -1L)
++# endif
+ #endif
+
+ __END_NAMESPACE_STD
+Index: gcc4/recipe/files/gcc/libunixlib/include/string.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/string.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/string.h (working copy)
+@@ -281,6 +281,17 @@
+ /* Compare no more than N chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2)) __wur;
++
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
++
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
+ #endif /* Use BSD. */
+
+ #if defined __USE_XOPEN2K || defined __USE_MISC
+Index: gcc4/recipe/files/gcc/libunixlib/include/strings.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/strings.h (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/include/strings.h (working copy)
+@@ -37,7 +37,17 @@
+ /* Compare n chars of S1 and S2, ignoring case. */
+ extern int strncasecmp (const char *__s1, const char *__s2, size_t __n);
+
++# ifdef __USE_XOPEN2K8
++# include <bits/locale_t.h>
+
++extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
++
++extern int strncasecmp_l (const char *__s1, const char *__s2,
++ size_t __n, locale_t __loc)
++ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
++# endif
++
+ /* Return the position of the first bit set in I, or 0 if none are set.
+ The least-significant bit is position 1, the most-significant 32. */
+ extern int ffs (int __i);
+Index: gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/localeconv.c (working copy)
+@@ -14,8 +14,6 @@
+
+ /* #define DEBUG */
+
+-int __setlocale_called = 1;
+-
+ static int
+ read_symbol (int reason_code, int territory)
+ {
+@@ -71,26 +69,44 @@
+ *grouping = new_grouping;
+ }
+
+-static struct lconv lc = { NULL, NULL, NULL, NULL, NULL,
+- NULL, NULL, NULL, NULL, NULL,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+- CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX };
++void
++__localeconv_lconv_init (struct lconv *lc)
++{
++ memset(lc, 0, sizeof(*lc));
++ lc->int_frac_digits = lc->frac_digits = lc->p_cs_precedes =
++ lc->p_sep_by_space = lc->n_cs_precedes = lc->n_sep_by_space =
++ lc->p_sign_posn = lc->n_sign_posn = CHAR_MAX;
++}
+
+-/* Defined by POSIX as not threadsafe */
+-struct lconv *
+-localeconv (void)
++void
++__localeconv_lconv_fini (struct lconv *lc)
+ {
++ free(lc->decimal_point);
++ free(lc->thousands_sep);
++ free(lc->grouping);
++ free(lc->int_curr_symbol);
++ free(lc->currency_symbol);
++ free(lc->mon_decimal_point);
++ free(lc->mon_thousands_sep);
++ free(lc->mon_grouping);
++ free(lc->positive_sign);
++ free(lc->negative_sign);
++}
++
++void
++__localeconv_l (locale_t locobj)
++{
+ int numeric, monetary;
+
+ /* If setlocale has not been called since the last call to
+ localeconv, then the lconv structure will be the same. */
+- if (!__setlocale_called)
+- return &lc;
++ if (!locobj->lc_needs_refresh)
++ return;
+
+- __setlocale_called = 0;
++ locobj->lc_needs_refresh = 0;
+
+- numeric = __locale_territory[LC_NUMERIC];
+- monetary = __locale_territory[LC_MONETARY];
++ numeric = locobj->locale_territory[LC_NUMERIC];
++ monetary = locobj->locale_territory[LC_MONETARY];
+
+ /* See the PRMs regarding SWI Territory_ReadSymbols for the
+ meanings of the following numbers. */
+@@ -97,71 +113,80 @@
+ if (numeric == -1)
+ {
+ /* We're using the 'C' locale. */
+- free (lc.decimal_point);
+- lc.decimal_point = strdup (".");
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ("");
+- free (lc.grouping);
+- lc.grouping = strdup ("");
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup (".");
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ("");
++ free (locobj->lc.grouping);
++ locobj->lc.grouping = strdup ("");
+ }
+ else
+ {
+- free (lc.decimal_point);
+- lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
+- free (lc.thousands_sep);
+- lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
+- read_byte_list (2, &lc.grouping, numeric);
++ free (locobj->lc.decimal_point);
++ locobj->lc.decimal_point = strdup ((char *) read_symbol (0, numeric));
++ free (locobj->lc.thousands_sep);
++ locobj->lc.thousands_sep = strdup ((char *) read_symbol (1, numeric));
++ read_byte_list (2, &locobj->lc.grouping, numeric);
+ }
+ if (monetary == -1)
+ {
+ /* We using the 'C' locale. Empty strings and CHAR_MAX means
+ that these fields are unspecified. */
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ("");
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ("");
+- free (lc.mon_grouping);
+- lc.mon_grouping = strdup ("");
+- lc.int_frac_digits = CHAR_MAX;
+- lc.frac_digits = CHAR_MAX;
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ("");
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ("");
+- lc.p_cs_precedes = CHAR_MAX;
+- lc.n_cs_precedes = CHAR_MAX;
+- lc.p_sep_by_space = CHAR_MAX;
+- lc.n_sep_by_space = CHAR_MAX;
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ("");
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ("");
+- lc.p_sign_posn = CHAR_MAX;
+- lc.n_sign_posn = CHAR_MAX;
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ("");
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ("");
++ free (locobj->lc.mon_grouping);
++ locobj->lc.mon_grouping = strdup ("");
++ locobj->lc.int_frac_digits = CHAR_MAX;
++ locobj->lc.frac_digits = CHAR_MAX;
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ("");
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ("");
++ locobj->lc.p_cs_precedes = CHAR_MAX;
++ locobj->lc.n_cs_precedes = CHAR_MAX;
++ locobj->lc.p_sep_by_space = CHAR_MAX;
++ locobj->lc.n_sep_by_space = CHAR_MAX;
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ("");
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ("");
++ locobj->lc.p_sign_posn = CHAR_MAX;
++ locobj->lc.n_sign_posn = CHAR_MAX;
+ }
+ else
+ {
+- free (lc.int_curr_symbol);
+- lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
+- free (lc.currency_symbol);
+- lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
+- free (lc.mon_decimal_point);
+- lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
+- free (lc.mon_thousands_sep);
+- lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
+- read_byte_list (7, &lc.mon_grouping, monetary);
+- free (lc.positive_sign);
+- lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
+- free (lc.negative_sign);
+- lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
+- lc.int_frac_digits = (char)read_symbol (10, monetary);
+- lc.frac_digits = (char)read_symbol (11, monetary);
+- lc.p_cs_precedes = (char)read_symbol (12, monetary);
+- lc.p_sep_by_space = (char)read_symbol (13, monetary);
+- lc.n_cs_precedes = (char)read_symbol (14, monetary);
+- lc.n_sep_by_space = (char)read_symbol (15, monetary);
+- lc.p_sign_posn = (char)read_symbol (16, monetary);
+- lc.n_sign_posn = (char)read_symbol (17, monetary);
++ free (locobj->lc.int_curr_symbol);
++ locobj->lc.int_curr_symbol = strdup ((char *)read_symbol (3, monetary));
++ free (locobj->lc.currency_symbol);
++ locobj->lc.currency_symbol = strdup ((char *)read_symbol (4, monetary));
++ free (locobj->lc.mon_decimal_point);
++ locobj->lc.mon_decimal_point = strdup ((char *)read_symbol (5, monetary));
++ free (locobj->lc.mon_thousands_sep);
++ locobj->lc.mon_thousands_sep = strdup ((char *)read_symbol (6, monetary));
++ read_byte_list (7, &locobj->lc.mon_grouping, monetary);
++ free (locobj->lc.positive_sign);
++ locobj->lc.positive_sign = strdup ((char *)read_symbol (8, monetary));
++ free (locobj->lc.negative_sign);
++ locobj->lc.negative_sign = strdup ((char *)read_symbol (9, monetary));
++ locobj->lc.int_frac_digits = (char)read_symbol (10, monetary);
++ locobj->lc.frac_digits = (char)read_symbol (11, monetary);
++ locobj->lc.p_cs_precedes = (char)read_symbol (12, monetary);
++ locobj->lc.p_sep_by_space = (char)read_symbol (13, monetary);
++ locobj->lc.n_cs_precedes = (char)read_symbol (14, monetary);
++ locobj->lc.n_sep_by_space = (char)read_symbol (15, monetary);
++ locobj->lc.p_sign_posn = (char)read_symbol (16, monetary);
++ locobj->lc.n_sign_posn = (char)read_symbol (17, monetary);
+ }
+- return &lc;
++ return;
+ }
++
++/* Defined by POSIX as not threadsafe */
++struct lconv *
++localeconv (void)
++{
++ __localeconv_l (&__locale_global);
++
++ return &__locale_global.lc;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/newlocale.c (working copy)
+@@ -1,15 +1,15 @@
+ /* Copyright (c) 2019 UnixLib Developers
+ */
+
++#include <ctype.h>
+ #include <stdlib.h>
+ #include <locale.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
++
++#include <internal/unix.h>
+
+-struct _locale {
+- struct lconv lc;
+-};
+-
+ /* This is supposed to be per-thread. */
+ static locale_t current_locale;
+
+@@ -27,20 +27,71 @@
+
+ void freelocale(locale_t locobj)
+ {
+- if (locobj)
++ if (locobj) {
++ __localeconv_lconv_fini(&locobj->lc);
+ free(locobj);
++ }
+ }
+
+ locale_t newlocale(int category_mask, const char *locale,
+ locale_t base)
+ {
+- locale_t loc = (locale_t)malloc(sizeof(*loc));
+- if (!loc) {
+- __set_errno (ENOMEM);
++ struct _locale tmp;
++
++ PTHREAD_UNSAFE
++
++ if ((category_mask & ~LC_ALL_MASK) || locale == NULL) {
++ __set_errno (EINVAL);
+ return 0;
+ }
+
+- loc->lc = *localeconv();
++ /* The locale provided will be verified by __setlocale_l() */
+
+- return loc;
++ /* Prepare the temporary locale we will modify */
++ if (base != 0 && base != LC_GLOBAL_LOCALE) {
++ memcpy(&tmp, base, sizeof(tmp));
++ } else {
++ if (base == LC_GLOBAL_LOCALE) {
++ /* Undefined: be helpful to client */
++ memcpy(&tmp, &__locale_global, sizeof(tmp));
++ } else {
++ /* Initialise to C locale */
++ __build_ctype_tables(&tmp, -2);
++ }
++ }
++
++ /* Now, apply the requested locale to each of the categories in the mask */
++ if (category_mask == LC_ALL_MASK) {
++ /* Special-case LC_ALL to handle the encoded locale string */
++ if (__setlocale_l(&tmp, LC_ALL, locale) == NULL) {
++ return 0;
++ }
++ } else {
++ int category = 0, mask = category_mask;
++ while (mask != 0) {
++ if (mask & 1) {
++ if (__setlocale_l(&tmp, category, locale) == NULL) {
++ return 0;
++ }
++ }
++ category++;
++ mask >>= 1;
++ }
++ }
++
++ /* Allocate the result, if necessary */
++ if (base == 0 || base == LC_GLOBAL_LOCALE) {
++ base = (locale_t)malloc(sizeof(*base));
++ if (!base) {
++ __set_errno (ENOMEM);
++ return 0;
++ }
++ }
++ /* Fill it in */
++ memcpy(base, &tmp, sizeof(tmp));
++
++ /* Mark the lconv data stale */
++ base->lc_needs_refresh = 1;
++
++ return base;
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/setlocale.c (working copy)
+@@ -195,7 +195,7 @@
+ }
+
+ static void
+-do_lc_all (char *buffer, int size)
++do_lc_all (locale_t locobj, char *buffer, int size)
+ {
+ char temp[64];
+ int category, same = 1;
+@@ -204,13 +204,13 @@
+ setlocale to set all locales. If all locales are
+ the same, then we can produce a very short string. */
+ for (category = 1; category < LC_ALL; ++category)
+- if (__locale_territory[0] != __locale_territory[category])
++ if (locobj->locale_territory[0] != locobj->locale_territory[category])
+ same = 0;
+
+ if (same)
+ {
+ /* All locales are set to the same territory. */
+- territory_name (__locale_territory[0], buffer, size);
++ territory_name (locobj->locale_territory[0], buffer, size);
+ }
+ else
+ {
+@@ -218,7 +218,7 @@
+ LC_CATEGORY=country;LC_CATEGORY=country; ... */
+ for (category = 0; category < LC_ALL; ++category)
+ {
+- territory_name (__locale_territory[category], temp, sizeof (temp));
++ territory_name (locobj->locale_territory[category], temp, sizeof (temp));
+ buffer = stpcpy (buffer, locale_names[category]);
+ *buffer++ = '=';
+ buffer = stpcpy (buffer, temp);
+@@ -230,15 +230,13 @@
+ }
+
+ char *
+-setlocale (int category, const char *locale)
++__setlocale_l (locale_t locobj, int category, const char *locale)
+ {
+ int new_territory, changed;
+ static char old_locale[256];
+
+- PTHREAD_UNSAFE
+-
+ /* This tells localeconv to re-read data for the lconv structure. */
+- __setlocale_called = 1;
++ locobj->lc_needs_refresh = 1;
+
+ if (locale == NULL)
+ {
+@@ -247,11 +245,11 @@
+ {
+ /* The locale string is specially encoded for LC_ALL so we
+ could restore all locales at any time. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+- territory_name (__locale_territory[category], old_locale, sizeof (old_locale));
++ territory_name (locobj->locale_territory[category], old_locale, sizeof (old_locale));
+ return old_locale;
+ }
+
+@@ -270,7 +268,7 @@
+ /* Encode the locale string, as we will be returning this
+ later. Remember, setlocale returns the locale settings
+ that are about to be changed. */
+- do_lc_all (old_locale, sizeof (old_locale));
++ do_lc_all (locobj, old_locale, sizeof (old_locale));
+
+ /* Check for an encoded (composite) name. Simply looking for
+ a semi-colon will verify this. */
+@@ -332,11 +330,11 @@
+
+ /* We now know all locales exist, so set them. */
+ for (category = 0; category < LC_ALL; ++category)
+- __locale_territory[category] = territory_number (newnames[category]);
++ locobj->locale_territory[category] = territory_number (newnames[category]);
+
+ /* Re-build the character type tables according to the new
+ locale settings. */
+- __build_ctype_tables (__locale_territory[LC_CTYPE]);
++ __build_ctype_tables (locobj, locobj->locale_territory[LC_CTYPE]);
+ return old_locale;
+ }
+ }
+@@ -359,9 +357,9 @@
+ /* Change the locale for all categories. old_locale was created
+ when we previously checked for a composite string. */
+ for (category = 0; category < LC_ALL; ++category)
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -368,12 +366,12 @@
+ else
+ {
+ /* Change the locale for just one category. */
+- territory_name (__locale_territory[category],
++ territory_name (locobj->locale_territory[category],
+ old_locale, sizeof (old_locale));
+
+- if (__locale_territory[category] != new_territory)
++ if (locobj->locale_territory[category] != new_territory)
+ {
+- __locale_territory[category] = new_territory;
++ locobj->locale_territory[category] = new_territory;
+ changed = 1;
+ }
+ }
+@@ -384,7 +382,16 @@
+ is changing. The GNU Java compiler is known to repeatedly call
+ setlocale. */
+ if (changed && (category == LC_ALL || category == LC_CTYPE))
+- __build_ctype_tables (new_territory);
++ __build_ctype_tables (locobj, new_territory);
+
+ return old_locale;
+ }
++
++char *
++setlocale (int category, const char *locale)
++{
++
++ PTHREAD_UNSAFE
++
++ return __setlocale_l(&__locale_global, category, locale);
++}
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strcoll.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)s1;
+ regs[2] = (int)s2;
+ regs[3] = 0;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/strxfrm.c (working copy)
+@@ -13,7 +13,7 @@
+ {
+ int regs[10];
+
+- regs[0] = __locale_territory[LC_COLLATE];
++ regs[0] = __locale_global.locale_territory[LC_COLLATE];
+ regs[1] = (int)to;
+ regs[2] = (int)from;
+ regs[3] = size;
+Index: gcc4/recipe/files/gcc/libunixlib/locale/territory.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/locale/territory.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/locale/territory.c (nonexistent)
+@@ -1,10 +0,0 @@
+-/* __locale_territory
+- * Copyright (c) 2000-2006 UnixLib Developers
+- */
+-
+-#include <locale.h>
+-
+-/* Global used for all calls to the Territory module. These variable
+- contain the territory number as set by setlocale. A value of
+- -1 means use the C locale. */
+-int __locale_territory[LC_ALL + 1];
+Index: gcc4/recipe/files/gcc/libunixlib/string/stricmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/stricmp.c (working copy)
+@@ -4,6 +4,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ stricmp (const char *s1, const char *s2)
+@@ -26,3 +27,24 @@
+ return result;
+ }
+ strong_alias (stricmp, strcasecmp)
++
++int
++strcasecmp_l (const char *s1, const char *s2, locale_t locobj)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++ int result = 0;
++
++ if (p1 == p2)
++ return result;
++
++ while (! result)
++ {
++ result = tolower_l (*p1, locobj) - tolower_l (*p2, locobj);
++ if (*p1++ == '\0')
++ break;
++ p2 ++;
++ }
++
++ return result;
++}
+Index: gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/string/strnicmp.c (working copy)
+@@ -5,6 +5,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ int
+ strnicmp (const char *s1, const char *s2, size_t n)
+@@ -26,3 +27,22 @@
+ }
+ strong_alias (strnicmp, strncasecmp)
+
++int
++strncasecmp_l (const char *s1, const char *s2, size_t n, locale_t locobj)
++{
++ int i, j;
++
++ if (!n)
++ return 0;
++
++ do
++ {
++ i = *s1++, j = *s2++;
++ i = tolower_l (i, locobj);
++ j = tolower_l (j, locobj);
++ }
++ while (i && i == j && --n);
++
++ return i - j;
++}
++
+Index: gcc4/recipe/files/gcc/libunixlib/time/broken.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/broken.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/broken.c (working copy)
+@@ -49,7 +49,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals);
+ }
+Index: gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/gmtime_r.c (working copy)
+@@ -46,7 +46,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/localtime_r.c (working copy)
+@@ -28,7 +28,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time, ordinals)) != NULL)
+ {
+Index: gcc4/recipe/files/gcc/libunixlib/time/mktime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/mktime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/mktime.c (working copy)
+@@ -23,7 +23,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ ordinals)) != NULL)
+Index: gcc4/recipe/files/gcc/libunixlib/time/stdtime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/stdtime.c (working copy)
+@@ -48,7 +48,7 @@
+ #ifdef __TARGET_SCL__
+ -1,
+ #else
+- __locale_territory[LC_TIME],
++ __locale_global.locale_territory[LC_TIME],
+ #endif
+ riscos_time,
+ result,
+Index: gcc4/recipe/files/gcc/libunixlib/time/strftime.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/strftime.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/strftime.c (working copy)
+@@ -353,7 +353,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+@@ -368,7 +368,7 @@
+ int regs[10];
+ char buffer[64];
+
+- regs[0] = __locale_territory[LC_TIME];
++ regs[0] = __locale_global.locale_territory[LC_TIME];
+ regs[1] = (int)timep;
+ regs[2] = (int)buffer;
+ regs[3] = sizeof (buffer) - 1;
+Index: gcc4/recipe/files/gcc/libunixlib/time/tzset.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/time/tzset.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/time/tzset.c (working copy)
+@@ -36,7 +36,7 @@
+ /* Get timezone information for current territory. */
+ _kernel_swi_regs regs;
+ #ifndef __TARGET_SCL__
+- regs.r[0] = __locale_territory[LC_TIME];
++ regs.r[0] = __locale_global.locale_territory[LC_TIME];
+ #else
+ regs.r[0] = -1; /* Current territory. */
+ #endif
+Index: gcc4/recipe/files/gcc/libunixlib/unix/unix.c
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/unix/unix.c (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/unix/unix.c (working copy)
+@@ -191,7 +191,7 @@
+ __pthread_prog_init ();
+ __unixlib_signal_initialise (__u);
+ /* Initialise ctype tables to the C locale. */
+- __build_ctype_tables (-2);
++ __build_ctype_tables (&__locale_global, -2);
+ /* Define and initialise the Unix I/O. */
+ initialise_unix_io ();
+ __stdioinit ();
+Index: gcc4/recipe/files/gcc/libunixlib/vscript
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/vscript (revision 7698)
++++ gcc4/recipe/files/gcc/libunixlib/vscript (working copy)
+@@ -58,6 +58,9 @@
+ __init_des_r;
+ __init_des;
+ __invalidate;
++ __locale_global;
++ __localeconv_lconv_init;
++ __localeconv_lconv_fini;
+ malloc_trim;
+ malloc_trim_unlocked;
+ malloc_unlocked;
+@@ -80,6 +83,7 @@
+ __res_vinit;
+ __runtime_features;
+ __setup_signalhandler_stack;
++ __setlocale_l;
+ __sdirinit;
+ __sfixinit;
+ __sfixfind;
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
deleted file mode 100644
index e0ecc21..0000000
--- a/sdk/recipes/patches/openssl/crypto.ctype.c.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
---- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
-@@ -295,7 +295,7 @@
- /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
- * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
-
--#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
-+#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
-
- # if defined OPENSSL_SYS_WINDOWS
- # define locale_t _locale_t
--
Cross-compilation toolchains and environments
1 year, 3 months
toolchains: branch jmb/gccsdk-4.7.4r6 created. 892c5d970932541f9a5261fe75d0bb04384954a5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/892c5d970932541f9a...
...commit http://git.netsurf-browser.org/toolchains.git/commit/892c5d970932541f9a52...
...tree http://git.netsurf-browser.org/toolchains.git/tree/892c5d970932541f9a5261...
The branch, jmb/gccsdk-4.7.4r6 has been created
at 892c5d970932541f9a5261fe75d0bb04384954a5 (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=892c5d970932541f...
commit 892c5d970932541f9a5261fe75d0bb04384954a5
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
arm-unknown-riscos: drop GCC download patches
Not useful if the CI cache doesn't have the things we need
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
deleted file mode 100644
index 3f2f110..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
+++ /dev/null
@@ -1,12 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 10:37:32.006594122 +0000
-+++ gcc4/Makefile 2018-01-26 10:38:42.316723336 +0000
-@@ -677,8 +677,7 @@
- # Download binutils source:
- $(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BI...
-
- ifeq "$(GCC_USE_SCM)" "yes"
- # Checkout gcc source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
deleted file mode 100644
index 6f91911..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
+++ /dev/null
@@ -1,12 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 10:40:26.623881778 +0000
-+++ gcc4/Makefile 2018-01-26 10:41:24.141623273 +0000
-@@ -719,8 +719,7 @@
- # Download CLooG source:
- $(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-$(CLOOG_VERSION).tar.gz
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(C...
-
- # Download newlib source:
- $(SRCORIGDIR)/newlib-$(NEWLIB_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
deleted file mode 100644
index 4f99d57..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
+++ /dev/null
@@ -1,11 +0,0 @@
---- gcc4/Makefile.orig 2018-01-25 22:42:43.937180762 +0000
-+++ gcc4/Makefile 2018-01-25 22:44:46.680863288 +0000
-@@ -703,7 +703,7 @@
- # Download mpc source:
- $(SRCORIGDIR)/mpc-$(MPC_VERSION).tar.gz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/mpc/mpc-$(MPC_VERSION).tar.gz
-+ cd $(SRCORIGDIR) && wget -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VER...
- touch $@
-
- # Download mpfr source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
deleted file mode 100644
index 128e9eb..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
+++ /dev/null
@@ -1,27 +0,0 @@
---- gcc4/Makefile.orig 2018-01-26 08:03:49.745541843 +0000
-+++ gcc4/Makefile 2018-01-26 08:05:15.256056177 +0000
-@@ -586,9 +586,9 @@
- touch $(BUILDSTEPSDIR)/$@
-
- # Unpack & copy ppl source:
--src-ppl-copied: $(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz
-+src-ppl-copied: $(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz
- -rm -rf $(SRCORIGDIR)/ppl-$(PPL_VERSION) $(SRCDIR)/ppl
-- cd $(SRCORIGDIR) && tar xf $<
-+ cd $(SRCORIGDIR) && tar axf $<
- -mkdir -p $(SRCDIR)/ppl
- cp -T -p -r $(SRCORIGDIR)/ppl-$(PPL_VERSION) $(SRCDIR)/ppl
- cd $(SRCDIR)/ppl && PATH="$(PREFIX_BUILDTOOL_GCC)/bin:$(PATH)" && $(SCRIPTSDIR)/do-patch-and-copy $(RECIPEDIR)
-@@ -713,10 +713,9 @@
- touch $@
-
- # Download ppl source:
--$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz:
-+$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz:
- -mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c https://www.bugseng.com/external/ppl/download/ftp/releases/$(PPL_VERSION)...
-- touch $@
-+ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VER...
-
- # Download CLooG source:
- $(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=c3bff19a559b50cc...
commit c3bff19a559b50cc88b4d27146222193bc11a2b1
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
arm-unknown-riscos: fetch GCC sources as a tarball
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p
new file mode 100644
index 0000000..5e12120
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/no-scm.p
@@ -0,0 +1,11 @@
+--- gcc4/Makefile (old)
++++ gcc4/Makefile (new)
+@@ -36,7 +36,7 @@
+ AUTOMAKE_FOR_GCC_VERSION=1.11.1
+ LIBTOOL_FOR_GCC_VERSION=2.4.2
+ GCC_VERSION=$(GCCSDK_SUPPORTED_GCC_RELEASE)
+-GCC_USE_SCM=yes
++GCC_USE_SCM=no
+ GCC_SCM_PATH=branches/gcc-4_7-branch
+ NEWLIB_VERSION=1.19.0
+ NEWLIB_USE_SCM=no
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=72cb8bef5540cc97...
commit 72cb8bef5540cc97e369c0e5754af35add9e776d
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
arm-unknown-riscos: update to 4.7.4r6
diff --git a/arm-unknown-riscos/Makefile b/arm-unknown-riscos/Makefile
index 64516de..017dcd9 100644
--- a/arm-unknown-riscos/Makefile
+++ b/arm-unknown-riscos/Makefile
@@ -1,5 +1,5 @@
# Use a tested trunk version of GCCSDK
-UPSTREAM_GCCSDK_VERSION := release_4_7_4_v2
+UPSTREAM_GCCSDK_VERSION := release_4_7_4_v6
UPSTREAM_GCCSDK_TARBALL := gcc4$(UPSTREAM_GCCSDK_VERSION).tar.gz
UPSTREAM_GCCSDK_URI := svn://svn.riscos.info/gccsdk/tags/$(UPSTREAM_GCCSDK_VERSION)
@@ -26,7 +26,7 @@ UPSTREAM_SQUEEZE_URI := git://git.netsurf-browser.org/squeeze.git
# Infozip
UPSTREAM_INFOZIP_VERSION := 30
UPSTREAM_INFOZIP_TARBALL := zip$(UPSTREAM_INFOZIP_VERSION).tar.gz
-UPSTREAM_INFOZIP_URI := http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29...
+UPSTREAM_INFOZIP_URI := https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%2...
TOP := $(CURDIR)
RECIPES := $(TOP)/recipes
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
index 54720f5..3f2f110 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/binutils-download.p
@@ -4,9 +4,9 @@
# Download binutils source:
$(SRCORIGDIR)/binutils-$(BINUTILS_VERSION).tar.bz2:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
+- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BIN...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/binutils-$(BI...
ifeq "$(GCC_USE_SCM)" "yes"
# Checkout gcc source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
index 194ef7f..6f91911 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/cloog-ppl-download.p
@@ -6,7 +6,7 @@
-mkdir -p $(SRCORIGDIR)
- cd $(SRCORIGDIR) && wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-ppl-$(CLOOG_VERSION).tar.gz
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(CL...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/cloog-ppl-$(C...
# Download newlib source:
$(SRCORIGDIR)/newlib-$(NEWLIB_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
index 0bfd4ec..4f99d57 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/gmp-download.p
@@ -4,8 +4,8 @@
# Download mpc source:
$(SRCORIGDIR)/mpc-$(MPC_VERSION).tar.gz:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://www.multiprecision.org/mpc/download/mpc-$(MPC_VERSION).tar.gz
-+ cd $(SRCORIGDIR) && wget -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VERS...
+- cd $(SRCORIGDIR) && wget -c https://ftpmirror.gnu.org/mpc/mpc-$(MPC_VERSION).tar.gz
++ cd $(SRCORIGDIR) && wget -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/mpc-$(MPC_VER...
touch $@
# Download mpfr source:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
index 7eb77c3..128e9eb 100644
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
+++ b/arm-unknown-riscos/recipes/patches/gcc4/ppl-download.p
@@ -19,9 +19,9 @@
-$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.gz:
+$(SRCORIGDIR)/ppl-$(PPL_VERSION).tar.xz:
-mkdir -p $(SRCORIGDIR)
-- cd $(SRCORIGDIR) && wget -c http://www.cs.unipr.it/ppl/download/ftp/releases/$(PPL_VERSION)/ppl-$(PPL...
+- cd $(SRCORIGDIR) && wget -c https://www.bugseng.com/external/ppl/download/ftp/releases/$(PPL_VERSION)...
- touch $@
-+ wget -O $@ -c http://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VERS...
++ wget -O $@ -c https://ci.netsurf-browser.org/toolchain/arm-unknown-riscos/ppl-$(PPL_VER...
# Download CLooG source:
$(SRCORIGDIR)/cloog-ppl-$(CLOOG_VERSION).tar.gz:
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p b/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p
deleted file mode 100644
index 7631c68..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/ppl-version.p
+++ /dev/null
@@ -1,175 +0,0 @@
-Index: gcc4/Makefile
-===================================================================
---- gcc4/Makefile (revision 7156)
-+++ gcc4/Makefile (working copy)
-@@ -45,7 +45,7 @@
- MPFR_VERSION=3.0.1
- MPC_VERSION=0.8.2
- GCC_USE_PPL_CLOOG=yes
--PPL_VERSION=0.11.2
-+PPL_VERSION=1.2
- CLOOG_VERSION=0.15.11
- GCC_USE_LTO=yes
-
-@@ -182,8 +182,8 @@
- RONATIVE_MPFR_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-
- # Configure arguments PPL:
--CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS)
--RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp-prefix=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-+CROSS_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_CROSSGCC_LIBS) --prefix=$(PREFIX_CROSSGCC_LIBS)
-+RONATIVE_PPL_CONFIG_ARGS := --disable-shared --disable-watchdog --with-gnu-ld --with-gmp=$(PREFIX_RONATIVEGCC_LIBS) --host=$(TARGET) --prefix=$(PREFIX_RONATIVEGCC_LIBS)
-
- # Configure arguments CLooG:
- CROSS_CLOOG_CONFIG_ARGS := --disable-shared --with-gmp=$(PREFIX_CROSSGCC_LIBS) --with-bits=gmp --with-ppl=$(PREFIX_CROSSGCC_LIBS) --with-host-libstdcxx='-lstdc++' --prefix=$(PREFIX_CROSSGCC_LIBS)
-Index: gcc4/recipe/patches/cloog/configure.in.p
-===================================================================
---- gcc4/recipe/patches/cloog/configure.in.p (revision 7156)
-+++ gcc4/recipe/patches/cloog/configure.in.p (working copy)
-@@ -1,5 +1,5 @@
----- configure.in.orig 2013-05-01 16:15:33.235945936 +0200
--+++ configure.in 2013-05-01 16:15:15.484169106 +0200
-+--- configure.in.orig 2017-04-23 11:55:00.956204411 +0100
-++++ configure.in 2017-04-23 11:50:39.385519538 +0100
- @@ -41,7 +41,7 @@ dnl ************************************
- AC_PREREQ(2.13)
- AC_INIT(source/cloog.c)
-@@ -9,7 +9,13 @@
- dnl Every other copy of the package version number gets its value from here.
- AM_INIT_AUTOMAKE(cloog, 0.15)
- AC_CONFIG_HEADER(include/cloog/cloog-config.h)
--@@ -343,7 +343,7 @@ if test "x$with_ppl" != "x" -a "x$with_p
-+@@ -338,12 +338,12 @@ if test "x$with_ppl" != "x" -a "x$with_p
-+
-+ AC_MSG_CHECKING([for version 0.10 (or later revision) of PPL])
-+ AC_TRY_COMPILE([#include "ppl_c.h"],[
-+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
-++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 10
-+ choke me
- #endif
- ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
-
-Index: gcc4/recipe/patches/gcc/configure.ac.p
-===================================================================
---- gcc4/recipe/patches/gcc/configure.ac.p (revision 7156)
-+++ gcc4/recipe/patches/gcc/configure.ac.p (working copy)
-@@ -1,6 +1,6 @@
- Index: configure.ac
- ===================================================================
----- configure.ac (revision 197339)
-+--- configure.ac (revision 247077)
- +++ configure.ac (working copy)
- @@ -152,6 +152,7 @@
- # Note that libiberty is not a target library.
-@@ -34,6 +34,15 @@
-
- if test "$enable_ppl_version_check" != no; then
- saved_CFLAGS="$CFLAGS"
-+@@ -1577,7 +1586,7 @@
-+ CFLAGS="$CFLAGS $pplinc $gmpinc"
-+ AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL])
-+ AC_TRY_COMPILE([#include "ppl_c.h"],[
-+- #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
-++ #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
-+ choke me
-+ #endif
-+ ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ])
- @@ -2895,6 +2904,10 @@
- ;;
- esac
-Index: gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Congruence_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Congruence_System.defs.hh.orig 2015-03-01 19:57:52.887328139 +0100
--+++ src/Congruence_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Grid.types.hh"
-- #include "Grid_Certificate.types.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -235,7 +236,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Congruence,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Congruence*,
-- const Congruence&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Constraint_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Constraint_System.defs.hh.orig 2015-03-01 19:58:03.831328106 +0100
--+++ src/Constraint_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Congruence_System.types.hh"
-- #include <iterator>
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -204,7 +205,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Constraint,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Constraint*,
-- const Constraint&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Generator_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Generator_System.defs.hh.orig 2015-03-01 19:58:13.511328077 +0100
--+++ src/Generator_System.defs.hh 2015-03-01 19:57:12.319328259 +0100
--@@ -33,6 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Polyhedron.types.hh"
-- #include "Poly_Con_Relation.defs.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -250,7 +251,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Generator,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Generator*,
-- const Generator&> {
-- public:
-Index: gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p
-===================================================================
---- gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (revision 7156)
-+++ gcc4/recipe/patches/ppl/src.Grid_Generator_System.defs.hh.p (nonexistent)
-@@ -1,19 +0,0 @@
----- src/Grid_Generator_System.defs.hh.orig 2015-03-01 19:57:31.127328203 +0100
--+++ src/Grid_Generator_System.defs.hh 2015-03-01 19:57:12.315328259 +0100
--@@ -30,6 +30,7 @@ site: http://www.cs.unipr.it/ppl/ . */
-- #include "Variables_Set.types.hh"
-- #include "Grid.types.hh"
-- #include <iosfwd>
--+#include <cstddef>
--
-- namespace Parma_Polyhedra_Library {
--
--@@ -267,7 +268,7 @@ public:
-- class const_iterator
-- : public std::iterator<std::forward_iterator_tag,
-- Grid_Generator,
--- ptrdiff_t,
--+ std::ptrdiff_t,
-- const Grid_Generator*,
-- const Grid_Generator&>,
-- private Generator_System::const_iterator {
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
deleted file mode 100644
index 045a0b8..0000000
--- a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
+++ /dev/null
@@ -1,304 +0,0 @@
-Backport r7043 from upstream: partially replaces use of SWP with LDREX/STREX
-on systems where SWP is no longer available. This fix is incomplete,
-but sufficient for our purposes.
-
-Fri Mar 11 14:51:54 GMT 2016 Lee Noar <leenoar(a)sky.com>
-
- * sys/_cpucaps.s: New file. Provide functions to probe the
- OS for details of the CPU (currently SWP, LDREX/STREX
- availability).
- * Makefile.am: Add above file.
- * include/unixlib/local.h: Add declarations for user facing
- functions provided above.
- * incl-local/internal/asm_dec.s(__ul_global): Add entry to
- record CPU flags.
- * incl-local/internal/unix.h: Likewise.
- * pthread/_ints.s(__pthread_disable_ints,__pthread_protect_unsafe):
- Use CPU flags to determine whether to use the SWP instruction or
- LRDEX/STREX.
- * sys/_syslib.s(__main): Add call to __probe_cpu_caps.
- (__unixlib_fatal): Use CPU flags to determine whether to use the
- SWP instruction or LRDEX/STREX.
-
-
-Index: gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7043)
-@@ -2,7 +2,7 @@
- @ disable_ints can be called multiple times, provided enable_ints is
- @ subsequently called an equal number of times
- @ Written by Martin Piper and Alex Waugh
--@ Copyright (c) 2002-2008 UnixLib Developers
-+@ Copyright (c) 2002-2016 UnixLib Developers
-
- #include "internal/asm_dec.s"
-
-@@ -20,15 +20,26 @@
- PICEQ "LDR a2, [a2, #0]"
- PICEQ "LDR a2, [a2, #__GOTT_INDEX__]" @ a2 = GOT ptr
-
-- LDR a1, .L0 @=__ul_global
-+ LDR a1, .L0 @ =__ul_global
- PICEQ "LDR a1, [a2, a1]"
-+ LDR a4, [a1, #GBL_CPU_FLAGS]
- ADD a1, a1, #GBL_PTH_WORKSEMAPHORE
-+ TST a4, #__CPUCAP_HAVE_SWP
-+ @ From this point onwards we will not be interrupted by the callback
-+ BEQ 0f
-+
- MOV a3, #1
- SWP a2, a3, [a1]
-- @ From this point onwards we will not be interrupted by the callback
- ADD a2, a2, #1
- STR a2, [a1]
- MOV pc, lr
-+0:
-+ LDREX a2, [a1]
-+ ADD a2, a2, #1
-+ STREX a3, a2, [a1]
-+ TEQ a3, #1
-+ BEQ 0b
-+ MOV pc, lr
- .L0:
- WORD __ul_global
- DECLARE_FUNCTION __pthread_disable_ints
-@@ -78,18 +89,32 @@
- PICEQ "LDR a1, [a1, #0]"
- PICEQ "LDR a1, [a1, #__GOTT_INDEX__]" @ a1 = GOT ptr
-
-- LDR a4, .L2 @=__ul_global
-+ LDR a4, .L2 @ =__ul_global
- PICEQ "LDR a4, [a1, a4]"
-+ LDR a2, [a4, #GBL_CPU_FLAGS]
- ADD a1, a4, #GBL_PTH_WORKSEMAPHORE
-+ TST a2, #__CPUCAP_HAVE_SWP
-+ @ From this point onwards we cannot be interrupted by the callback
-+ BEQ 0f
-+
- MOV a2, #1
- SWP a3, a2, [a1]
-- @ From this point onwards we cannot be interrupted by the callback
- CMP a3, #0
-- STRNE a3, [a1, #0] @ Restore original value
-+ BEQ 1f
-+ STR a3, [a1, #0] @ Restore original value
- @ Return, as if ints are disabled on entry to the
- @ calling function then they should not be reenabled
- @ until the calling function has returned
-+ MOV pc, lr
-+0:
-+ LDREX a3, [a1]
-+ MOV ip, #1
-+ STREX a2, ip, [a1]
-+ TEQ a2, #1
-+ BEQ 0b
-+ TEQ a3, #0
- MOVNE pc, lr
-+1:
-
- #if __UNIXLIB_PARANOID
- LDR a3, [a4, #GBL_PTH_RETURN_ADDRESS]
-Index: gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7043)
-@@ -133,6 +133,16 @@
- socket. Is -1 when socket handle is not valid. */
- extern int __get_ro_socket (int __sockfd);
-
-+/* Return 1 if the SWP instruction is available, otherwise 0. */
-+extern unsigned int __cpucap_have_swp (void);
-+
-+/* Return 1 if the LDREX/STREX instructions are available, otherwise 0. */
-+extern unsigned int __cpucap_have_rex (void);
-+
-+/* Return 1 if the LDREX/STREX instructions that operate on bytes, half-words
-+ and double words are available, otherwise 0. */
-+extern unsigned int __cpucap_have_rexbhd (void);
-+
- __END_DECLS
-
- #endif
- * incl-local/internal/asm_dec.s(XSOM_DeregisterClient): Add
-Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7043)
-@@ -1027,6 +1027,7 @@
- sys/sigsetjmp.c \
- sys/stackalloc.c \
- sys/vfork.c \
-+ sys/_cpucaps.s \
- sys/_getcpuarch.s \
- sys/_jmp.s \
- sys/_mman.s \
-Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7043)
-@@ -269,8 +269,10 @@
- .set GBL_FLS_LBSTM_ON_RD, 108 @ = __ul_global.fls_lbstm_on_rd
- .set GBL_PTH_CALLEVERY_RMA, 112 @ = __ul_global.pthread_callevery_rma
-
-+.set GBL_CPU_FLAGS, 116 @ = __ul_global.cpu_flags
-+
- #if !defined(__SOFTFP__) && defined(__VFP_FP__)
--.set GBL_VFP_REGCOUNT, 116 @ = __ul_global.vfp_regcount
-+.set GBL_VFP_REGCOUNT, 120 @ = __ul_global.vfp_regcount
- #endif
-
- @ Entries in the __ul_memory table. Must be kept in sync with
-@@ -322,3 +324,7 @@
- .set CRT1_LIB_FINI, 32 @ Ptr to function to finalise shared libraries
- @ at program exit - can be NULL.
- #endif
-+
-+#define __CPUCAP_HAVE_SWP 0x1
-+#define __CPUCAP_HAVE_REX 0x2
-+#define __CPUCAP_HAVE_REXBHD 0x4
-Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7043)
-@@ -197,6 +197,8 @@
- the life of the program. This block is passed to the call_every handler in
- r12. */
-
-+ unsigned int cpu_flags; /* Flags indicating the capabilities of the CPU. */
-+
- #if !defined(__SOFTFP__) && defined(__VFP_FP__)
- int vfp_regcount; /* Number of doubleword registers we should request for
- VFP contexts */
-Index: gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 0)
-+++ gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 7043)
-@@ -0,0 +1,91 @@
-+@ Determine the capabilities of the CPU and allow callers to enquire
-+@ what they are.
-+@ Copyright (c) 2016 UnixLib Developers.
-+@ Written by Lee Noar.
-+
-+#include "internal/asm_dec.s"
-+
-+ .text
-+
-+@ Determine what the CPU capabilities are, and record them.
-+@ Called early on during program initialisation in _syslib.s.
-+ .global __probe_cpu_caps
-+ NAME __probe_cpu_caps
-+__probe_cpu_caps:
-+ MOV r0, #0
-+ SWI XOS_PlatformFeatures
-+ MOVVS r0, #0
-+
-+ MOV r2, #0
-+ @ The OS flag is set to 1 to indicate _no_ SWP instruction available (for
-+ @ backwards compatibility). We reverse it here and set our flag to 1 to
-+ @ indicate that SWP _is_ available.
-+ TST r0, #1<<11 @ SWP{B} not available
-+ ORREQ r2, r2, #__CPUCAP_HAVE_SWP
-+ TST r0, #1<<12 @ LDREX/STREX available
-+ ORRNE r2, r2, #__CPUCAP_HAVE_REX
-+ TST r0, #1<<13 @ LDREX/STREX{B/H/D} available
-+ ORRNE r2, r2, #__CPUCAP_HAVE_REXBHD
-+
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ STR r2, [r1, #GBL_CPU_FLAGS]
-+
-+ MOV pc, lr
-+.L0:
-+ WORD __ul_global
-+ DECLARE_FUNCTION __probe_cpu_caps
-+
-+ .global __cpucap_have_swp
-+ NAME __cpucap_have_swp
-+__cpucap_have_swp:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_SWP
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_swp
-+
-+@ Return 1 if LDREX/STREX instructions are available on the CPU, otherwise 0.
-+ .global __cpucap_have_rex
-+ NAME __cpucap_have_rex
-+__cpucap_have_rex:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_REX
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_rex
-+
-+@ Return 1 if LDREX/STREX instructions that work on non-32 bit data sizes
-+@ are available on the CPU, otherwise 0.
-+ .global __cpucap_have_rexbhd
-+ NAME __cpucap_have_rexbhd
-+__cpucap_have_rexbhd:
-+ PICEQ "LDR r0, =__GOTT_BASE__"
-+ PICEQ "LDR r0, [r0, #0]"
-+ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
-+ LDR r1, .L0 @ =__ul_global
-+ PICEQ "LDR r1, [r0, r1]"
-+ LDR r0, [r1, #GBL_CPU_FLAGS]
-+ TST r0, #__CPUCAP_HAVE_REXBHD
-+ MOVEQ r0, #0
-+ MOVNE r0, #1
-+
-+ MOV pc, lr
-+ DECLARE_FUNCTION __cpucap_have_rexbhd
-Index: gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s
-===================================================================
---- gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7042)
-+++ gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7043)
-@@ -255,6 +255,8 @@
- BCC __exit_with_error_num
- unknown_cpu_arch:
-
-+ BL __probe_cpu_caps
-+
- @ Use of DAs explicitly overridden if __dynamic_no_da is declared
- MOV lr, #-1
- STR lr, [ip, #GBL_DYNAMIC_NUM]
-@@ -1286,9 +1288,21 @@
- @ error handling. As last resort to avoid an infinite loop
- @ we go for a straight OS_Exit scenario. Anything better we
- @ can do ?
-+ ADD a3, a4, #GBL_PANIC_MODE
-+ LDR a2, [a4, #GBL_CPU_FLAGS]
-+ TST a2, #__CPUCAP_HAVE_SWP
-+ BEQ 0f
-+
- MOV a2, #1
-- ADD a3, a4, #GBL_PANIC_MODE
- SWP a2, a2, [a3]
-+ B 1f
-+0:
-+ LDREX a2, [a3]
-+ MOV ip, #1
-+ STREX lr, ip, [a3]
-+ TEQ lr, #1
-+ BEQ 0b
-+1:
- TEQ a2, #0
- BEQ __unixlib_fatal_cont1
-
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=0498d005a489508a...
commit 0498d005a489508a2dbd181d4cf145b2224a61de
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
Fetchsrc: use https
diff --git a/arm-unknown-riscos/fetchsrc b/arm-unknown-riscos/fetchsrc
index e71d85f..92ae5bf 100755
--- a/arm-unknown-riscos/fetchsrc
+++ b/arm-unknown-riscos/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
diff --git a/m5475-atari-mint/fetchsrc b/m5475-atari-mint/fetchsrc
index bbe8f6b..9396a4e 100755
--- a/m5475-atari-mint/fetchsrc
+++ b/m5475-atari-mint/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
diff --git a/m68k-atari-mint/fetchsrc b/m68k-atari-mint/fetchsrc
index e71d85f..92ae5bf 100755
--- a/m68k-atari-mint/fetchsrc
+++ b/m68k-atari-mint/fetchsrc
@@ -4,7 +4,7 @@
# Usage fetchsrc <target> <source> <upstream> <output>
-NSSRV="http://ci.netsurf-browser.org/toolchain/"
+NSSRV="https://ci.netsurf-browser.org/toolchain/"
wget -q -O ${4} ${NSSRV}/${1}/${2}
if [ $? -ne 0 ];then
-----------------------------------------------------------------------
--
Cross-compilation toolchains and environments
1 year, 3 months
toolchains: branch master updated. 2c28cd73e55b80b358ec008d07ff0cae310e96d6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/2c28cd73e55b80b358...
...commit http://git.netsurf-browser.org/toolchains.git/commit/2c28cd73e55b80b358ec...
...tree http://git.netsurf-browser.org/toolchains.git/tree/2c28cd73e55b80b358ec00...
The branch, master has been updated
via 2c28cd73e55b80b358ec008d07ff0cae310e96d6 (commit)
via 2549a2d898f96e636f6052f2017824ec42186da3 (commit)
via 5aa9b885910ff71cd07040f3ba2f973a4ec96723 (commit)
from e9696cf369a61ce1422354796b3e39a6d6e1dafc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
sdk/Makefile | 2 +-
.../openssl/Configurations-50-amigaos.conf.p | 9 +++----
.../openssl/Configurations-50-windows.conf.p | 9 +++----
sdk/recipes/patches/openssl/Configure.p | 10 ++++----
sdk/recipes/patches/openssl/apps.s_socket.c.p | 18 --------------
sdk/recipes/patches/openssl/apps.speed.c.p | 6 ++---
sdk/recipes/patches/openssl/aps.opt.c.p | 12 +++++-----
sdk/recipes/patches/openssl/crypto.arm_arch.h.p | 11 +++++++++
.../patches/openssl/crypto.bio.bio_local.h.p | 2 +-
sdk/recipes/patches/openssl/crypto.ctype.c.p | 11 +++++++++
.../patches/openssl/crypto.rand.rand_unix.c.p | 6 ++---
sdk/recipes/patches/openssl/e_os.h.p | 25 +++++++++-----------
12 files changed, 62 insertions(+), 59 deletions(-)
delete mode 100644 sdk/recipes/patches/openssl/apps.s_socket.c.p
create mode 100644 sdk/recipes/patches/openssl/crypto.arm_arch.h.p
create mode 100644 sdk/recipes/patches/openssl/crypto.ctype.c.p
diff --git a/sdk/Makefile b/sdk/Makefile
index b638f1c..a00c029 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -30,7 +30,7 @@ VERSION_LIBICONV := 1.17
# https://laurikari.net/tre/
VERSION_LIBTRE := 0.8.0
# https://www.openssl.org/
-VERSION_OPENSSL := 1.1.1o
+VERSION_OPENSSL := 3.0.3
# http://www.libpng.org/pub/png/libpng.html
VERSION_LIBPNG := 1.6.37
# http://libjpeg.sourceforge.net/
diff --git a/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p b/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p
index 53b266e..26bb873 100644
--- a/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p
+++ b/sdk/recipes/patches/openssl/Configurations-50-amigaos.conf.p
@@ -1,16 +1,17 @@
--- /dev/null 2017-10-10 15:19:45.611896396 +0100
+++ Configurations/50-amigaos.conf 2017-10-17 15:42:25.304921197 +0100
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,32 @@
+my %targets = (
+
+ "ppc-amigaos" => {
-+ inherit_from => [ "BASE_unix", asm("ppc32_asm") ],
++ inherit_from => [ "BASE_unix" ],
+ cc => "ppc-amigaos-gcc",
+ cflags => picker(default => "-DB_ENDIAN -DTERMIOS -DNO_SYS_UN_H -DNO_SYSLOG",
+ debug => "-O0 -g",
+ release => "-O3 -fomit-frame-pointer",
-+ threads("-D_REENTRANT")),
++ threads("-D_REENTRANT")),
+ thread_scheme => "(unknown)",
++ asm_arch => "ppc32",
+ perlasm_scheme => "linux32",
+ sys_id => "AMIGAOS4",
+ bn_ops => "THIRTY_TWO_BIT BN_LLONG RC4_CHAR",
@@ -23,7 +24,7 @@
+ cflags => picker(default => "-DB_ENDIAN -DTERMIOS -DNO_SYS_UN_H -DNO_SYS_PARAM_H -DNO_SYSLOG -m68020 -std=gnu99",
+ debug => "-O0 -g",
+ release => "-O3 -fomit-frame-pointer",
-+ threads("-D_REENTRANT")),
++ threads("-D_REENTRANT")),
+ thread_scheme => "(unknown)",
+ ex_libs => add("-lm -lnet"),
+ sys_id => "AMIGAOS3",
diff --git a/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p b/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p
index 6a15f5d..fafa6cf 100644
--- a/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p
+++ b/sdk/recipes/patches/openssl/Configurations-50-windows.conf.p
@@ -1,20 +1,21 @@
--- /dev/null 2017-10-10 15:19:45.611896396 +0100
+++ Configurations/50-windows.conf 2017-10-17 15:42:25.304921197 +0100
-@@ -0,0 +1,25 @@
+@@ -0,0 +1,26 @@
+my %targets = (
+
+ "i686-w64-mingw32" => {
-+ inherit_from => [ "BASE_unix", asm("x86_asm"),
-+ sub { $disabled{shared} ? () : "x86_uplink" } ],
++ inherit_from => [ "BASE_unix",
++ sub { $disabled{shared} ? () : "x86_uplink" } ],
+ cc => "gcc",
+ cflags => combine(picker(default => "-DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE -m32 -Wall",
-+ debug => "-g -O0",
++ debug => "-g -O0",
+ release => "-O3 -fomit-frame-pointer"),
+ threads("-D_MT")),
+ sys_id => "MINGW32",
+ ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
+ bn_ops => "BN_LLONG EXPORT_VAR_AS_FN",
+ thread_scheme => "winthreads",
++ asm_arch => "x86",
+ perlasm_scheme => "coff",
+ dso_scheme => "win32",
+ shared_target => "mingw-shared",
diff --git a/sdk/recipes/patches/openssl/Configure.p b/sdk/recipes/patches/openssl/Configure.p
index 5a21528..6b1a39e 100644
--- a/sdk/recipes/patches/openssl/Configure.p
+++ b/sdk/recipes/patches/openssl/Configure.p
@@ -1,10 +1,10 @@
--- Configure.orig 2017-10-17 14:53:18.369801491 +0100
+++ Configure 2017-10-17 15:11:04.312242542 +0100
-@@ -1143,6 +1143,7 @@
- $target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
- || $config{target} =~ /^(?:Cygwin|mingw)/);
+@@ -1329,6 +1329,7 @@
+ $target{cxxflags}//=$target{cflags} if $target{CXX};
+ $target{exe_extension}=".exe" if ($config{target} eq "DJGPP");
$target{exe_extension}=".pm" if ($config{target} =~ /vos/);
+$target{exe_extension}=",e1f" if ($config{target} eq "arm-unknown-riscos");
- ($target{shared_extension_simple}=$target{shared_extension})
- =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||
+ # Fill %config with values from %user, and in case those are undefined or
+ # empty, use values from %target (acting as a default).
diff --git a/sdk/recipes/patches/openssl/apps.s_socket.c.p b/sdk/recipes/patches/openssl/apps.s_socket.c.p
deleted file mode 100644
index cc6f582..0000000
--- a/sdk/recipes/patches/openssl/apps.s_socket.c.p
+++ /dev/null
@@ -1,18 +0,0 @@
---- apps/s_socket.c.orig 2019-02-13 18:04:36.643334493 +0000
-+++ apps/s_socket.c 2019-02-13 18:04:46.271279170 +0000
-@@ -239,6 +239,7 @@
- sock_protocol = BIO_ADDRINFO_protocol(res);
- sock_address = BIO_ADDRINFO_address(res);
- next = BIO_ADDRINFO_next(res);
-+#ifdef AF_INET6
- if (sock_family == AF_INET6)
- sock_options |= BIO_SOCK_V6_ONLY;
- if (next != NULL
-@@ -257,6 +258,7 @@
- sock_options &= ~BIO_SOCK_V6_ONLY;
- }
- }
-+#endif
-
- asock = BIO_socket(sock_family, sock_type, sock_protocol, 0);
- if (asock == INVALID_SOCKET && sock_family_fallback != AF_UNSPEC) {
diff --git a/sdk/recipes/patches/openssl/apps.speed.c.p b/sdk/recipes/patches/openssl/apps.speed.c.p
index 20d455e..1ccac30 100644
--- a/sdk/recipes/patches/openssl/apps.speed.c.p
+++ b/sdk/recipes/patches/openssl/apps.speed.c.p
@@ -1,7 +1,7 @@
--- apps/speed.c.orig 2017-11-22 08:07:53.851790744 +0000
+++ apps/speed.c 2017-11-22 08:15:49.608768064 +0000
-@@ -99,6 +99,12 @@
- #endif
+@@ -62,6 +62,12 @@
+ #include "./testdsa.h"
#include <openssl/modes.h>
+
@@ -13,7 +13,7 @@
#ifndef HAVE_FORK
# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_VXWORKS)
# define HAVE_FORK 0
-@@ -220,8 +226,10 @@
+@@ -134,8 +240,10 @@
static double Time_F(int s)
{
double ret = app_tminterval(s, usertime);
diff --git a/sdk/recipes/patches/openssl/aps.opt.c.p b/sdk/recipes/patches/openssl/aps.opt.c.p
index 7c6bab2..2ba3fba 100644
--- a/sdk/recipes/patches/openssl/aps.opt.c.p
+++ b/sdk/recipes/patches/openssl/aps.opt.c.p
@@ -1,8 +1,8 @@
---- apps/opt.c.orig 2017-11-22 08:42:07.605882648 +0000
-+++ apps/opt.c 2017-11-22 08:48:31.712843519 +0000
-@@ -374,6 +374,11 @@
- #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
- defined(INTMAX_MAX) && defined(UINTMAX_MAX)
+--- apps/lib/opt.c.orig 2017-11-22 08:42:07.605882648 +0000
++++ apps/lib/opt.c 2017-11-22 08:48:31.712843519 +0000
+@@ -564,6 +564,11 @@
+ defined(INTMAX_MAX) && defined(UINTMAX_MAX) && \
+ !defined(OPENSSL_NO_INTTYPES_H)
+#if defined(OPENSSL_SYS_AMIGAOS3) || defined(OPENSSL_SYS_AMIGAOS4)
+# define strtoimax strtol
@@ -10,5 +10,5 @@
+#endif
+
/* Parse an intmax_t, put it into *result; return 0 on failure, else 1. */
- int opt_imax(const char *value, intmax_t *result)
+ int opt_intmax(const char *value, ossl_intmax_t *result)
{
diff --git a/sdk/recipes/patches/openssl/crypto.arm_arch.h.p b/sdk/recipes/patches/openssl/crypto.arm_arch.h.p
new file mode 100644
index 0000000..093e4de
--- /dev/null
+++ b/sdk/recipes/patches/openssl/crypto.arm_arch.h.p
@@ -0,0 +1,11 @@
+--- crypto/arm_arch.h 2015-07-09 12:21:24.000000000 +0000
++++ crypto/arm_arch.h 2015-11-13 13:47:02.386910047 +0000
+@@ -51,6 +51,8 @@
+ # define __ARM_ARCH__ 5
+ # elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
+ # define __ARM_ARCH__ 4
++# elif defined(__ARM_ARCH_3__)
++# define __ARM_ARCH__ 3
+ # else
+ # error "unsupported ARM architecture"
+ # endif
diff --git a/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p b/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p
index 6caa72f..e811d8b 100644
--- a/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p
+++ b/sdk/recipes/patches/openssl/crypto.bio.bio_local.h.p
@@ -1,6 +1,6 @@
--- crypto/bio/bio_local.h.orig 2017-10-17 16:19:36.908150231 +0100
+++ crypto/bio/bio_local.h 2017-10-17 16:19:52.056631064 +0100
-@@ -37,7 +37,7 @@
+@@ -36,7 +36,7 @@
/*
* Undefine AF_UNIX on systems that define it but don't support it.
*/
diff --git a/sdk/recipes/patches/openssl/crypto.ctype.c.p b/sdk/recipes/patches/openssl/crypto.ctype.c.p
new file mode 100644
index 0000000..e0ecc21
--- /dev/null
+++ b/sdk/recipes/patches/openssl/crypto.ctype.c.p
@@ -0,0 +1,11 @@
+--- crypto/ctype.c.orig 2022-05-27 00:00:00.000000000 +0000
+--- crypto/ctype.c 2022-05-27 00:00:00.000000000 +0000
+@@ -295,7 +295,7 @@
+ /* str[n]casecmp_l is defined in POSIX 2008-01. Value is taken accordingly
+ * https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */
+
+-#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L)
++#if (defined OPENSSL_SYS_WINDOWS) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L && !defined(OPENSSL_SYS_RISCOS))
+
+ # if defined OPENSSL_SYS_WINDOWS
+ # define locale_t _locale_t
diff --git a/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p b/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p
index b517fd8..366cd19 100644
--- a/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p
+++ b/sdk/recipes/patches/openssl/crypto.rand.rand_unix.c.p
@@ -1,6 +1,6 @@
---- crypto/rand/rand_unix.c.orig 2017-11-22 11:25:03.096636507 +0000
-+++ crypto/rand/rand_unix.c 2017-11-22 11:25:52.649406308 +0000
-@@ -122,7 +122,8 @@
+--- providers/implementations/rands/seeding/rand_unix.c.orig 2017-11-22 11:25:03.096636507 +0000
++++ providers/implementations/rands/seeding/rand_unix.c 2017-11-22 11:25:52.649406308 +0000
+@@ -109,7 +109,8 @@
#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) \
|| defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VXWORKS) \
diff --git a/sdk/recipes/patches/openssl/e_os.h.p b/sdk/recipes/patches/openssl/e_os.h.p
index 6c91409..07ed97e 100644
--- a/sdk/recipes/patches/openssl/e_os.h.p
+++ b/sdk/recipes/patches/openssl/e_os.h.p
@@ -1,16 +1,13 @@
--- e_os.h.orig 2019-02-13 14:25:17.725058588 +0000
+++ e_os.h 2019-02-13 14:35:39.790029062 +0000
-@@ -350,7 +350,12 @@
- # endif
-
- /* unistd.h defines _POSIX_VERSION */
--# if !defined(OPENSSL_NO_SECURE_MEMORY) && defined(OPENSSL_SYS_UNIX) \
-+# if !defined(OPENSSL_NO_SECURE_MEMORY) \
-+ && !defined(OPENSSL_SYS_RISCOS) \
-+ && !defined(OPENSSL_SYS_AMIGAOS3) \
-+ && !defined(OPENSSL_SYS_AMIGAOS4) \
-+ && !defined(OPENSSL_SYS_MINT) \
-+ && defined(OPENSSL_SYS_UNIX) \
- && ( (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
- || defined(__sun) || defined(__hpux) || defined(__sgi) \
- || defined(__osf__) )
+@@ -399,6 +399,10 @@
+ # ifndef OPENSSL_NO_SECURE_MEMORY
+ /* unistd.h defines _POSIX_VERSION */
+ # if (defined(OPENSSL_SYS_UNIX) \
++ && !defined(OPENSSL_SYS_RISCOS) \
++ && !defined(OPENSSL_SYS_AMIGAOS3) \
++ && !defined(OPENSSL_SYS_AMIGAOS4) \
++ && !defined(OPENSSL_SYS_MINT) \
+ && ( (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+ || defined(__sun) || defined(__hpux) || defined(__sgi) \
+ || defined(__osf__) )) \
--
Cross-compilation toolchains and environments
1 year, 4 months
netsurf: branch master updated. release/3.10-249-ga9eecb3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a9eecb30a70c3c68f5383...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a9eecb30a70c3c68f5383b2...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a9eecb30a70c3c68f5383b2ec...
The branch, master has been updated
via a9eecb30a70c3c68f5383b2ec897e3131ef2124e (commit)
via 09b39f2dc7c067d6e63bad7d11eb71239951cb07 (commit)
via cd7ed847d4ba10f1dd8e987df4b42037f55e1435 (commit)
via 2c42b1898c2dcd8a81bb226a56097f3493a67aec (commit)
from 6f99d28488c0eb39722079340864563318c7ef6b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a9eecb30a70c3c68f53...
commit a9eecb30a70c3c68f5383b2ec897e3131ef2124e
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
About/Cert: get EC key details using OpenSSL 3 APIs
Replace the fetching and poking around inside the low-level EC
object with appropriate calls to EVP_PKEY_get_(octet|utf8)_string_param()
and add a compatibility layer for old versions of OpenSSL.
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index 70487ee..554f06e 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -198,6 +198,104 @@ static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
return (result != NULL) ? 1 : 0;
}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#elif (OPENSSL_VERSION_NUMBER < 0x1010100fL)
/* 1.1.0 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -254,6 +352,104 @@ static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
return (result != NULL) ? 1 : 0;
}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#elif (OPENSSL_VERSION_NUMBER < 0x30000000L)
/* 1.1.1 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -294,6 +490,104 @@ static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
return (result != NULL) ? 1 : 0;
}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#else
/* 3.x and later */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -301,6 +595,8 @@ static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
#define ns_RSA_get0_n RSA_get0_n
#define ns_RSA_get0_e RSA_get0_e
#define ns_EVP_PKEY_get_bn_param EVP_PKEY_get_bn_param
+#define ns_EVP_PKEY_get_octet_string_param EVP_PKEY_get_octet_string_param
+#define ns_EVP_PKEY_get_utf8_string_param EVP_PKEY_get_utf8_string_param
#endif
/**
@@ -538,43 +834,43 @@ dh_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
static nserror
ec_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- const EC_GROUP *ecgroup;
- const EC_POINT *ecpoint;
- BN_CTX *bnctx;
- char *ecpoint_hex;
- EC_KEY *ec = EVP_PKEY_get1_EC_KEY(pkey);
-
- if (ec == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
+ size_t len;
ikey->algor = strdup("Elliptic Curve");
ikey->size = EVP_PKEY_bits(pkey);
- ecgroup = EC_KEY_get0_group(ec);
-
- if (ecgroup != NULL) {
- ikey->curve = strdup(OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup)));
+ len = 0;
+ ns_EVP_PKEY_get_utf8_string_param(pkey, "group", NULL, 0, &len);
+ if (len != 0) {
+ ikey->curve = malloc(len + 1);
+ if (ikey->curve != NULL) {
+ if (ns_EVP_PKEY_get_utf8_string_param(pkey, "group",
+ ikey->curve, len + 1, NULL) == 0) {
+ free(ikey->curve);
+ ikey->curve = NULL;
+ }
+ }
+ }
- ecpoint = EC_KEY_get0_public_key(ec);
- if (ecpoint != NULL) {
- bnctx = BN_CTX_new();
- ecpoint_hex = EC_POINT_point2hex(ecgroup,
- ecpoint,
- POINT_CONVERSION_UNCOMPRESSED,
- bnctx);
- ikey->public = hexdup(ecpoint_hex);
- OPENSSL_free(ecpoint_hex);
- BN_CTX_free(bnctx);
+ len = 0;
+ ns_EVP_PKEY_get_octet_string_param(pkey, "encoded-pub-key",
+ NULL, 0, &len);
+ if (len != 0) {
+ unsigned char *point = malloc(len);
+ if (point != NULL) {
+ if (ns_EVP_PKEY_get_octet_string_param(pkey,
+ "encoded-pub-key", point, len,
+ NULL) == 1) {
+ ikey->public = bindup(point, len);
+ }
+ free(point);
}
}
- EC_KEY_free(ec);
return NSERROR_OK;
}
-
/**
* extract public key information to info structure
*
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=09b39f2dc7c067d6e63...
commit 09b39f2dc7c067d6e63bad7d11eb71239951cb07
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
About/Cert: get RSA n/e using OpenSSL 3 APIs
Replace the fetching and poking around inside the low-level RSA
object with appropriate calls to EVP_PKEY_get_bn_param() and
add a compatibility layer for old versions of OpenSSL.
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index e946e38..70487ee 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -165,6 +165,39 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *d)
return d->e;
}
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
#elif (OPENSSL_VERSION_NUMBER < 0x1010100fL)
/* 1.1.0 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -188,12 +221,86 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *r)
return e;
}
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
+#elif (OPENSSL_VERSION_NUMBER < 0x30000000L)
+/* 1.1.1 */
+#define ns_X509_get_signature_nid X509_get_signature_nid
+#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
+#define ns_RSA_get0_n RSA_get0_n
+#define ns_RSA_get0_e RSA_get0_e
+
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
#else
-/* 1.1.1 and later */
+/* 3.x and later */
#define ns_X509_get_signature_nid X509_get_signature_nid
#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
#define ns_RSA_get0_n RSA_get0_n
#define ns_RSA_get0_e RSA_get0_e
+#define ns_EVP_PKEY_get_bn_param EVP_PKEY_get_bn_param
#endif
/**
@@ -350,10 +457,15 @@ static char *bindup(unsigned char *bin, unsigned int binlen)
static nserror
rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- RSA *rsa = EVP_PKEY_get1_RSA(pkey);
+ BIGNUM *n = NULL, *e = NULL;
char *tmp;
- if (rsa == NULL) {
+ if (ns_EVP_PKEY_get_bn_param(pkey, "n", &n) != 1) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (ns_EVP_PKEY_get_bn_param(pkey, "e", &e) != 1) {
+ BN_free(n);
return NSERROR_BAD_PARAMETER;
}
@@ -361,19 +473,20 @@ rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
ikey->size = EVP_PKEY_bits(pkey);
- tmp = BN_bn2hex(ns_RSA_get0_n(rsa));
+ tmp = BN_bn2hex(n);
if (tmp != NULL) {
ikey->modulus = hexdup(tmp);
OPENSSL_free(tmp);
}
- tmp = BN_bn2dec(ns_RSA_get0_e(rsa));
+ tmp = BN_bn2dec(e);
if (tmp != NULL) {
ikey->exponent = strdup(tmp);
OPENSSL_free(tmp);
}
- RSA_free(rsa);
+ BN_free(e);
+ BN_free(n);
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=cd7ed847d4ba10f1dd8...
commit cd7ed847d4ba10f1dd8e987df4b42037f55e1435
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
About/Cert: use EVP_PKEY_bits to get key size
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index a92575a..e946e38 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -165,21 +165,6 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *d)
return d->e;
}
-static int ns_RSA_bits(const RSA *rsa)
-{
- return RSA_size(rsa) * 8;
-}
-
-static int ns_DSA_bits(const DSA *dsa)
-{
- return DSA_size(dsa) * 8;
-}
-
-static int ns_DH_bits(const DH *dh)
-{
- return DH_size(dh) * 8;
-}
-
#elif (OPENSSL_VERSION_NUMBER < 0x1010100fL)
/* 1.1.0 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -203,19 +188,12 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *r)
return e;
}
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
-
#else
/* 1.1.1 and later */
#define ns_X509_get_signature_nid X509_get_signature_nid
#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
#define ns_RSA_get0_n RSA_get0_n
#define ns_RSA_get0_e RSA_get0_e
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
#endif
/**
@@ -381,7 +359,7 @@ rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
ikey->algor = strdup("RSA");
- ikey->size = ns_RSA_bits(rsa);
+ ikey->size = EVP_PKEY_bits(pkey);
tmp = BN_bn2hex(ns_RSA_get0_n(rsa));
if (tmp != NULL) {
@@ -411,17 +389,9 @@ rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
static nserror
dsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- DSA *dsa = EVP_PKEY_get1_DSA(pkey);
-
- if (dsa == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("DSA");
- ikey->size = ns_DSA_bits(dsa);
-
- DSA_free(dsa);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -437,17 +407,9 @@ dsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
static nserror
dh_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- DH *dh = EVP_PKEY_get1_DH(pkey);
-
- if (dh == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("Diffie Hellman");
- ikey->size = ns_DH_bits(dh);
-
- DH_free(dh);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -475,11 +437,11 @@ ec_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
ikey->algor = strdup("Elliptic Curve");
+ ikey->size = EVP_PKEY_bits(pkey);
+
ecgroup = EC_KEY_get0_group(ec);
if (ecgroup != NULL) {
- ikey->size = EC_GROUP_get_degree(ecgroup);
-
ikey->curve = strdup(OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup)));
ecpoint = EC_KEY_get0_public_key(ec);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2c42b1898c2dcd8a81b...
commit 2c42b1898c2dcd8a81bb226a56097f3493a67aec
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
About/Cert: contain pkey inspection in type methods
Use of the low-level key types is deprecated in OpenSSL 3. Prepare
to stop using them by removing them from function calls.
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index 0d0d6f5..a92575a 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -365,13 +365,14 @@ static char *bindup(unsigned char *bin, unsigned int binlen)
/**
* extract RSA key information to info structure
*
- * \param rsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The RSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
+rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
+ RSA *rsa = EVP_PKEY_get1_RSA(pkey);
char *tmp;
if (rsa == NULL) {
@@ -403,13 +404,15 @@ rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
/**
* extract DSA key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
+dsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
+ DSA *dsa = EVP_PKEY_get1_DSA(pkey);
+
if (dsa == NULL) {
return NSERROR_BAD_PARAMETER;
}
@@ -427,13 +430,15 @@ dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
/**
* extract DH key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DH key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
+dh_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
+ DH *dh = EVP_PKEY_get1_DH(pkey);
+
if (dh == NULL) {
return NSERROR_BAD_PARAMETER;
}
@@ -451,17 +456,18 @@ dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
/**
* extract EC key information to info structure
*
- * \param ec The EC key to examine. The reference is dropped on return
+ * \param pkey The EC key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-ec_to_info(EC_KEY *ec, struct ns_cert_pkey *ikey)
+ec_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
const EC_GROUP *ecgroup;
const EC_POINT *ecpoint;
BN_CTX *bnctx;
char *ecpoint_hex;
+ EC_KEY *ec = EVP_PKEY_get1_EC_KEY(pkey);
if (ec == NULL) {
return NSERROR_BAD_PARAMETER;
@@ -512,19 +518,19 @@ pkey_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
switch (EVP_PKEY_base_id(pkey)) {
case EVP_PKEY_RSA:
- res = rsa_to_info(EVP_PKEY_get1_RSA(pkey), ikey);
+ res = rsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DSA:
- res = dsa_to_info(EVP_PKEY_get1_DSA(pkey), ikey);
+ res = dsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DH:
- res = dh_to_info(EVP_PKEY_get1_DH(pkey), ikey);
+ res = dh_to_info(pkey, ikey);
break;
case EVP_PKEY_EC:
- res = ec_to_info(EVP_PKEY_get1_EC_KEY(pkey), ikey);
+ res = ec_to_info(pkey, ikey);
break;
default:
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about/certificate.c | 521 +++++++++++++++++++++++++++++-----
1 file changed, 449 insertions(+), 72 deletions(-)
diff --git a/content/fetchers/about/certificate.c b/content/fetchers/about/certificate.c
index 0d0d6f5..554f06e 100644
--- a/content/fetchers/about/certificate.c
+++ b/content/fetchers/about/certificate.c
@@ -165,21 +165,137 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *d)
return d->e;
}
-static int ns_RSA_bits(const RSA *rsa)
-{
- return RSA_size(rsa) * 8;
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
}
-static int ns_DSA_bits(const DSA *dsa)
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
{
- return DSA_size(dsa) * 8;
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
}
-static int ns_DH_bits(const DH *dh)
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
{
- return DH_size(dh) * 8;
-}
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#elif (OPENSSL_VERSION_NUMBER < 0x1010100fL)
/* 1.1.0 */
#define ns_X509_get_signature_nid X509_get_signature_nid
@@ -203,19 +319,284 @@ static const BIGNUM *ns_RSA_get0_e(const RSA *r)
return e;
}
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+ EC_KEY_free(ec);
+
+ return ret;
+}
+#elif (OPENSSL_VERSION_NUMBER < 0x30000000L)
+/* 1.1.1 */
+#define ns_X509_get_signature_nid X509_get_signature_nid
+#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
+#define ns_RSA_get0_n RSA_get0_n
+#define ns_RSA_get0_e RSA_get0_e
+
+static int ns_EVP_PKEY_get_bn_param(const EVP_PKEY *pkey,
+ const char *key_name, BIGNUM **bn) {
+ RSA *rsa;
+ BIGNUM *result = NULL;
+
+ /* Check parameters: only support allocation-form *bn */
+ if (pkey == NULL || key_name == NULL || bn == NULL || *bn != NULL)
+ return 0;
+
+ /* Only support RSA keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_RSA)
+ return 0;
+
+ rsa = EVP_PKEY_get1_RSA((EVP_PKEY *) pkey);
+ if (rsa == NULL)
+ return 0;
+
+ if (strcmp(key_name, "n") == 0) {
+ const BIGNUM *n = ns_RSA_get0_n(rsa);
+ if (n != NULL)
+ result = BN_dup(n);
+ } else if (strcmp(key_name, "e") == 0) {
+ const BIGNUM *e = ns_RSA_get0_e(rsa);
+ if (e != NULL)
+ result = BN_dup(e);
+ }
+
+ RSA_free(rsa);
+
+ *bn = result;
+
+ return (result != NULL) ? 1 : 0;
+}
+
+static int ns_EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey,
+ const char *key_name, char *str, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const char *group;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ /* Only support fetching the group */
+ if (strcmp(key_name, "group") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup == NULL) {
+ group = "";
+ } else {
+ group = OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup));
+ }
+
+ if (str != NULL && max_len > strlen(group)) {
+ strcpy(str, group);
+ str[strlen(group)] = '\0';
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = strlen(group);
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
+
+static int ns_EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey,
+ const char *key_name, unsigned char *buf, size_t max_len,
+ size_t *out_len)
+{
+ const EC_GROUP *ecgroup;
+ const EC_POINT *ecpoint;
+ size_t len;
+ BN_CTX *bnctx;
+ EC_KEY *ec;
+ int ret = 0;
+
+ if (pkey == NULL || key_name == NULL)
+ return 0;
+
+ /* Only support EC keys */
+ if (EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
+ return 0;
+
+ if (strcmp(key_name, "encoded-pub-key") != 0)
+ return 0;
+
+ ec = EVP_PKEY_get1_EC_KEY((EVP_PKEY *) pkey);
+ if (ec == NULL)
+ return 0;
+
+ ecgroup = EC_KEY_get0_group(ec);
+ if (ecgroup != NULL) {
+ ecpoint = EC_KEY_get0_public_key(ec);
+ if (ecpoint != NULL) {
+ bnctx = BN_CTX_new();
+ len = EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ NULL,
+ 0,
+ bnctx);
+ if (len != 0 && len <= max_len) {
+ if (EC_POINT_point2oct(ecgroup,
+ ecpoint,
+ POINT_CONVERSION_UNCOMPRESSED,
+ buf,
+ len,
+ bnctx) == len)
+ ret = 1;
+ }
+ if (out_len != NULL)
+ *out_len = len;
+ BN_CTX_free(bnctx);
+ }
+ }
+
+ EC_KEY_free(ec);
+
+ return ret;
+}
#else
-/* 1.1.1 and later */
+/* 3.x and later */
#define ns_X509_get_signature_nid X509_get_signature_nid
#define ns_ASN1_STRING_get0_data ASN1_STRING_get0_data
#define ns_RSA_get0_n RSA_get0_n
#define ns_RSA_get0_e RSA_get0_e
-#define ns_RSA_bits RSA_bits
-#define ns_DSA_bits DSA_bits
-#define ns_DH_bits DH_bits
+#define ns_EVP_PKEY_get_bn_param EVP_PKEY_get_bn_param
+#define ns_EVP_PKEY_get_octet_string_param EVP_PKEY_get_octet_string_param
+#define ns_EVP_PKEY_get_utf8_string_param EVP_PKEY_get_utf8_string_param
#endif
/**
@@ -365,36 +746,43 @@ static char *bindup(unsigned char *bin, unsigned int binlen)
/**
* extract RSA key information to info structure
*
- * \param rsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The RSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
+rsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
+ BIGNUM *n = NULL, *e = NULL;
char *tmp;
- if (rsa == NULL) {
+ if (ns_EVP_PKEY_get_bn_param(pkey, "n", &n) != 1) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (ns_EVP_PKEY_get_bn_param(pkey, "e", &e) != 1) {
+ BN_free(n);
return NSERROR_BAD_PARAMETER;
}
ikey->algor = strdup("RSA");
- ikey->size = ns_RSA_bits(rsa);
+ ikey->size = EVP_PKEY_bits(pkey);
- tmp = BN_bn2hex(ns_RSA_get0_n(rsa));
+ tmp = BN_bn2hex(n);
if (tmp != NULL) {
ikey->modulus = hexdup(tmp);
OPENSSL_free(tmp);
}
- tmp = BN_bn2dec(ns_RSA_get0_e(rsa));
+ tmp = BN_bn2dec(e);
if (tmp != NULL) {
ikey->exponent = strdup(tmp);
OPENSSL_free(tmp);
}
- RSA_free(rsa);
+ BN_free(e);
+ BN_free(n);
return NSERROR_OK;
}
@@ -403,22 +791,16 @@ rsa_to_info(RSA *rsa, struct ns_cert_pkey *ikey)
/**
* extract DSA key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DSA key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
+dsa_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- if (dsa == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("DSA");
- ikey->size = ns_DSA_bits(dsa);
-
- DSA_free(dsa);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -427,22 +809,16 @@ dsa_to_info(DSA *dsa, struct ns_cert_pkey *ikey)
/**
* extract DH key information to info structure
*
- * \param dsa The RSA key to examine. The reference is dropped on return
+ * \param pkey The DH key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
+dh_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- if (dh == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
-
ikey->algor = strdup("Diffie Hellman");
- ikey->size = ns_DH_bits(dh);
-
- DH_free(dh);
+ ikey->size = EVP_PKEY_bits(pkey);
return NSERROR_OK;
}
@@ -451,49 +827,50 @@ dh_to_info(DH *dh, struct ns_cert_pkey *ikey)
/**
* extract EC key information to info structure
*
- * \param ec The EC key to examine. The reference is dropped on return
+ * \param pkey The EC key to examine.
* \param ikey The public key info structure to fill
* \rerun NSERROR_OK on success else error code.
*/
static nserror
-ec_to_info(EC_KEY *ec, struct ns_cert_pkey *ikey)
+ec_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
{
- const EC_GROUP *ecgroup;
- const EC_POINT *ecpoint;
- BN_CTX *bnctx;
- char *ecpoint_hex;
-
- if (ec == NULL) {
- return NSERROR_BAD_PARAMETER;
- }
+ size_t len;
ikey->algor = strdup("Elliptic Curve");
- ecgroup = EC_KEY_get0_group(ec);
-
- if (ecgroup != NULL) {
- ikey->size = EC_GROUP_get_degree(ecgroup);
-
- ikey->curve = strdup(OBJ_nid2ln(EC_GROUP_get_curve_name(ecgroup)));
+ ikey->size = EVP_PKEY_bits(pkey);
+
+ len = 0;
+ ns_EVP_PKEY_get_utf8_string_param(pkey, "group", NULL, 0, &len);
+ if (len != 0) {
+ ikey->curve = malloc(len + 1);
+ if (ikey->curve != NULL) {
+ if (ns_EVP_PKEY_get_utf8_string_param(pkey, "group",
+ ikey->curve, len + 1, NULL) == 0) {
+ free(ikey->curve);
+ ikey->curve = NULL;
+ }
+ }
+ }
- ecpoint = EC_KEY_get0_public_key(ec);
- if (ecpoint != NULL) {
- bnctx = BN_CTX_new();
- ecpoint_hex = EC_POINT_point2hex(ecgroup,
- ecpoint,
- POINT_CONVERSION_UNCOMPRESSED,
- bnctx);
- ikey->public = hexdup(ecpoint_hex);
- OPENSSL_free(ecpoint_hex);
- BN_CTX_free(bnctx);
+ len = 0;
+ ns_EVP_PKEY_get_octet_string_param(pkey, "encoded-pub-key",
+ NULL, 0, &len);
+ if (len != 0) {
+ unsigned char *point = malloc(len);
+ if (point != NULL) {
+ if (ns_EVP_PKEY_get_octet_string_param(pkey,
+ "encoded-pub-key", point, len,
+ NULL) == 1) {
+ ikey->public = bindup(point, len);
+ }
+ free(point);
}
}
- EC_KEY_free(ec);
return NSERROR_OK;
}
-
/**
* extract public key information to info structure
*
@@ -512,19 +889,19 @@ pkey_to_info(EVP_PKEY *pkey, struct ns_cert_pkey *ikey)
switch (EVP_PKEY_base_id(pkey)) {
case EVP_PKEY_RSA:
- res = rsa_to_info(EVP_PKEY_get1_RSA(pkey), ikey);
+ res = rsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DSA:
- res = dsa_to_info(EVP_PKEY_get1_DSA(pkey), ikey);
+ res = dsa_to_info(pkey, ikey);
break;
case EVP_PKEY_DH:
- res = dh_to_info(EVP_PKEY_get1_DH(pkey), ikey);
+ res = dh_to_info(pkey, ikey);
break;
case EVP_PKEY_EC:
- res = ec_to_info(EVP_PKEY_get1_EC_KEY(pkey), ikey);
+ res = ec_to_info(pkey, ikey);
break;
default:
--
NetSurf Browser
1 year, 4 months