diff options
Diffstat (limited to 'packages/picolibc')
7 files changed, 237 insertions, 8 deletions
diff --git a/packages/picolibc/1.4.7/0001-tinystdio-Make-ungetc-buffer-type-purely-architectur.patch b/packages/picolibc/1.4.7/0001-tinystdio-Make-ungetc-buffer-type-purely-architectur.patch new file mode 100644 index 00000000..0bedf41d --- /dev/null +++ b/packages/picolibc/1.4.7/0001-tinystdio-Make-ungetc-buffer-type-purely-architectur.patch @@ -0,0 +1,159 @@ +From 2adb30bd8e64bf06fb5366585e305c28c4325e01 Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +Date: Tue, 3 Nov 2020 16:36:48 -0800 +Subject: [PATCH] tinystdio: Make ungetc buffer type purely + architecture-specific + +Instead of attempting to figure out what type this object should be +based on compiler support for atomics, just make it 32-bits on RISC-V +when using atomic ungetc, otherwise make it 16-bits, then select +whether there are 'real' atomics based on compiler support for the +chosen type, which may depend on the compiler options used to build +the library. + +This ensures that the picolibc ABI is consistent for each +architecture. + +This also removes the use of stdatomic.h from stdio.h, which isn't +supported by C++. + +Signed-off-by: Keith Packard <keithp@keithp.com> +--- + newlib/libc/tinystdio/exchange.c | 2 +- + newlib/libc/tinystdio/stdio.h | 39 +++++++++++---------------- + newlib/libc/tinystdio/stdio_private.h | 24 ++++++++++++----- + 3 files changed, 34 insertions(+), 31 deletions(-) + +diff --git a/newlib/libc/tinystdio/exchange.c b/newlib/libc/tinystdio/exchange.c +index 1272ae36e..e8c785f8a 100644 +--- a/newlib/libc/tinystdio/exchange.c ++++ b/newlib/libc/tinystdio/exchange.c +@@ -39,7 +39,7 @@ + #if defined(ATOMIC_UNGETC) && !defined(PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP) + + __ungetc_t +-__picolibc_non_atomic_exchange_ungetc(__ungetc_store_t *p, __ungetc_t v) ++__picolibc_non_atomic_exchange_ungetc(__ungetc_t *p, __ungetc_t v) + { + return __non_atomic_exchange_ungetc(p, v); + } +diff --git a/newlib/libc/tinystdio/stdio.h b/newlib/libc/tinystdio/stdio.h +index 1e36f73e9..8bc0f8843 100644 +--- a/newlib/libc/tinystdio/stdio.h ++++ b/newlib/libc/tinystdio/stdio.h +@@ -224,38 +224,31 @@ + * elements of it beyond by using the official interfaces provided. + */ + +-/* Use 32-bit ungetc storage when doing atomic ungetc and when +- * the platform has 4-byte swap intrinsics but not 2-byte swap +- * intrinsics, as is the case for RISC-V processors. This increases +- * the size of the __file struct by four bytes. +- */ +- + #ifdef ATOMIC_UNGETC +-#include <stdatomic.h> +-# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +- +-# define PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP +-typedef atomic_uint_least32_t __ungetc_store_t; +-typedef uint_least32_t __ungetc_t; +- +-# else +-# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 ++#ifdef __riscv ++/* ++ * Use 32-bit ungetc storage when doing atomic ungetc on RISC-V, which ++ * has 4-byte swap intrinsics but not 2-byte swap intrinsics. This ++ * increases the size of the __file struct by four bytes. ++ */ ++#define __PICOLIBC_UNGETC_SIZE 4 ++#endif ++#endif + +-# define PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP +-typedef atomic_uint_least16_t __ungetc_store_t; +-typedef uint_least16_t __ungetc_t; ++#ifndef __PICOLIBC_UNGETC_SIZE ++#define __PICOLIBC_UNGETC_SIZE 2 ++#endif + +-# endif +-# endif ++#if __PICOLIBC_UNGETC_SIZE == 4 ++typedef uint32_t __ungetc_t; + #endif + +-#ifndef PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP +-typedef uint16_t __ungetc_store_t; ++#if __PICOLIBC_UNGETC_SIZE == 2 + typedef uint16_t __ungetc_t; + #endif + + struct __file { +- __ungetc_store_t unget; /* ungetc() buffer */ ++ __ungetc_t unget; /* ungetc() buffer */ + uint8_t flags; /* flags, see below */ + #define __SRD 0x0001 /* OK to read */ + #define __SWR 0x0002 /* OK to write */ +diff --git a/newlib/libc/tinystdio/stdio_private.h b/newlib/libc/tinystdio/stdio_private.h +index b8ec66864..1a8b77dc9 100644 +--- a/newlib/libc/tinystdio/stdio_private.h ++++ b/newlib/libc/tinystdio/stdio_private.h +@@ -141,7 +141,7 @@ float + __atof_engine(uint32_t m10, int e10); + + static inline uint16_t +-__non_atomic_exchange_ungetc(__ungetc_store_t *p, __ungetc_t v) ++__non_atomic_exchange_ungetc(__ungetc_t *p, __ungetc_t v) + { + __ungetc_t e = *p; + *p = v; +@@ -159,28 +159,38 @@ __non_atomic_compare_exchange_ungetc(__ungetc_t *p, __ungetc_t d, __ungetc_t v) + + #ifdef ATOMIC_UNGETC + ++#if __PICOLIBC_UNGETC_SIZE == 4 && defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) ++#define PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP ++#endif ++ ++#if __PICOLIBC_UNGETC_SIZE == 2 && defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) ++#define PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP ++#endif ++ + #ifdef PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP + + /* Use built-in atomic functions if they exist */ + #include <stdatomic.h> + static inline bool +-__atomic_compare_exchange_ungetc(__ungetc_store_t *p, __ungetc_t d, __ungetc_t v) ++__atomic_compare_exchange_ungetc(__ungetc_t *p, __ungetc_t d, __ungetc_t v) + { +- return atomic_compare_exchange_weak(p, &d, v); ++ _Atomic __ungetc_t *pa = (_Atomic __ungetc_t *) p; ++ return atomic_compare_exchange_weak(pa, &d, v); + } + static inline __ungetc_t +-__atomic_exchange_ungetc(__ungetc_store_t *p, __ungetc_t v) ++__atomic_exchange_ungetc(__ungetc_t *p, __ungetc_t v) + { +- return atomic_exchange_explicit(p, v, memory_order_relaxed); ++ _Atomic __ungetc_t *pa = (_Atomic __ungetc_t *) p; ++ return atomic_exchange_explicit(pa, v, memory_order_relaxed); + } + + #else + + bool +-__atomic_compare_exchange_ungetc(__ungetc_store_t *p, __ungetc_t d, __ungetc_t v); ++__atomic_compare_exchange_ungetc(__ungetc_t *p, __ungetc_t d, __ungetc_t v); + + __ungetc_t +-__atomic_exchange_ungetc(__ungetc_store_t *p, __ungetc_t v); ++__atomic_exchange_ungetc(__ungetc_t *p, __ungetc_t v); + + #endif /* PICOLIBC_HAVE_SYNC_COMPARE_AND_SWAP */ + +-- +2.29.1 + diff --git a/packages/picolibc/1.4.7/0002-Add-ARM-exception-information-to-link-rules.patch b/packages/picolibc/1.4.7/0002-Add-ARM-exception-information-to-link-rules.patch new file mode 100644 index 00000000..7fd254d5 --- /dev/null +++ b/packages/picolibc/1.4.7/0002-Add-ARM-exception-information-to-link-rules.patch @@ -0,0 +1,36 @@ +From 9c39c93d4897c9ee1659dd6df7433d097a84be4a Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +Date: Wed, 4 Nov 2020 17:36:14 -0800 +Subject: [PATCH] Add ARM exception information to link rules + +Place any ARM exeception information in ROM for C++ support. + +Signed-off-by: Keith Packard <keithp@keithp.com> +--- + picolibc.ld | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/picolibc.ld b/picolibc.ld +index 6d14b396f..ff60fe3a3 100644 +--- a/picolibc.ld ++++ b/picolibc.ld +@@ -94,6 +94,16 @@ SECTIONS + *(.got .got.*) + } >flash AT>flash :text + ++ .ARM.extab : { ++ *(.ARM.extab* .gnu.linkonce.armextab.*) ++ } >flash AT>flash :text ++ ++ PROVIDE (__exidx_start = .); ++ .ARM.exidx : { ++ *(.ARM.exidx*) ++ } >flash AT>flash :text ++ PROVIDE(__exidx_end = .); ++ + . = ALIGN(8); + + .preinit_array : { +-- +2.28.0 + diff --git a/packages/picolibc/1.4.7/0003-Add-picolibc-include-directory-to-cc1plus-spec.patch b/packages/picolibc/1.4.7/0003-Add-picolibc-include-directory-to-cc1plus-spec.patch new file mode 100644 index 00000000..885c0c7e --- /dev/null +++ b/packages/picolibc/1.4.7/0003-Add-picolibc-include-directory-to-cc1plus-spec.patch @@ -0,0 +1,31 @@ +From 1f6b3ddcbba7432a5b2f1061f24297989d6ce791 Mon Sep 17 00:00:00 2001 +From: Keith Packard <keithp@keithp.com> +Date: Mon, 9 Nov 2020 13:02:44 -0800 +Subject: [PATCH] Add picolibc include directory to cc1plus spec + +G++ doesn't use the cpp spec to add include directories, so we need to +add the picolibc include directory to the cc1plus spec element as well +as the cpp one. To make sure the libstdc++ headers can use +GCC-provided header directories, so use -idirafter instead of -isystem. + +Signed-off-by: Keith Packard <keithp@keithp.com> +--- + picolibc.specs.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/picolibc.specs.in b/picolibc.specs.in +index c1f916a6f..133e65db9 100644 +--- a/picolibc.specs.in ++++ b/picolibc.specs.in +@@ -10,7 +10,7 @@ + @TLSMODEL@ %(picolibc_cc1) @CC1_SPEC@ + + *cc1plus: +-@TLSMODEL@ %(picolibc_cc1plus) @CC1_SPEC@ @CC1PLUS_SPEC@ ++-idirafter @INCLUDEDIR@ @TLSMODEL@ %(picolibc_cc1plus) @CC1_SPEC@ @CC1PLUS_SPEC@ + + *link: + @SPECS_PRINTF@ -L@LIBDIR@/%M -L@LIBDIR@ %{!T:-Tpicolibc.ld} %(picolibc_link) --gc-sections @LINK_SPEC@ +-- +2.28.0 + diff --git a/packages/picolibc/1.4.7/chksum b/packages/picolibc/1.4.7/chksum index 9dc793de..c4f720fc 100644 --- a/packages/picolibc/1.4.7/chksum +++ b/packages/picolibc/1.4.7/chksum @@ -1,4 +1,4 @@ -md5 1.4.7.tar.gz a70f6b9690ca5e8ea4af4ed5c10e73c2 -sha1 1.4.7.tar.gz 9bff47dce0a1f01ff7f1a16669dc0851bcc76d11 -sha256 1.4.7.tar.gz c46d37bbdea6eb1eb658f67d05c8c37f2b7e768e54f4d0b4312da9326c0cd92e -sha512 1.4.7.tar.gz 882e1ce682b084044efa5d2775498168fb0aa49bf5d5a76bc4b47a29ffcc03371e2602ed892e80e8801c2a6a4de340c1ddf0bc963f7b5c53d8c4c4e4a477d9c7 +md5 picolibc-1.4.7.tar.xz 4df52b4441c2936b58c450be9235f8e9 +sha1 picolibc-1.4.7.tar.xz 22577e9006e605490e6e46c10635d64b7fe20225 +sha256 picolibc-1.4.7.tar.xz 6413815591733e0cf04fb8d8eb9c9652984f65f81b4fb2888d3ab988b5f24b91 +sha512 picolibc-1.4.7.tar.xz e6a249b3e6910f94aca1d235926fc2804a3e8460ebce460a3e116b07709b70db698eaff40ce9aaeaaaa3b9f2e7ad923b74d4f87fa80993b3252415f80e7988ec diff --git a/packages/picolibc/1.5/chksum b/packages/picolibc/1.5/chksum new file mode 100644 index 00000000..c5240fb0 --- /dev/null +++ b/packages/picolibc/1.5/chksum @@ -0,0 +1,4 @@ +md5 picolibc-1.5.tar.xz f883ccdb907f13bd79ccecb6b677cc99 +sha1 picolibc-1.5.tar.xz 549b03479feab74042c58ca5903f2a5fd63dca65 +sha256 picolibc-1.5.tar.xz 88bd1b6e050145e285cb61c8cf4ce75714a8eb5d80cf89d0d0edc4f3fa067db1 +sha512 picolibc-1.5.tar.xz 7f50bc4bc7d8dbfb6feba09eee896918f5ac8b57d27c2d8158f17dc7d6778b80798c87edee92cf20d27b1dd2b3d1bfb157cfd9084019fdb7a6173ef959f03a92 diff --git a/packages/picolibc/1.5/version.desc b/packages/picolibc/1.5/version.desc new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/packages/picolibc/1.5/version.desc diff --git a/packages/picolibc/package.desc b/packages/picolibc/package.desc index 6b3ec29a..00b3ee0a 100644 --- a/packages/picolibc/package.desc +++ b/packages/picolibc/package.desc @@ -1,7 +1,6 @@ origin='keithp.com' -repository='git https://github.com/keith-packard/picolibc.git' +repository='git https://github.com/picolibc/picolibc.git' milestones='1.4.7' -archive_filename='@{version}' relevantpattern='*.*|.*. *.*|.' -archive_formats='.tar.gz' -mirrors='https://github.com/keith-packard/picolibc/archive' +archive_formats='.tar.xz' +mirrors='https://github.com/picolibc/picolibc/releases/download/${CT_PICOLIBC_VERSION}' |