mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-31 08:25:32 +00:00
Merge branches 'elijahr-dtc-1.6.0', 'elijahr-readme-typo', 'foss-for-synopsys-dwc-arc-processors-abrodkin-libgmp-for-mac' and 'keith-packard-picolibc-companion'
This commit is contained in:
commit
e64318656c
@ -90,7 +90,7 @@ git checkout -b fix_out_of_date_patch origin/1.22
|
||||
```
|
||||
Then when you get to this pull request screen change the base branch from `master` to `1.22`
|
||||
|
||||
- By creating a pull request, the PR is entered into the [backlog](https://waffle.io/crosstool-ng/crosstool-ng). A [travis-ci](https://travis-ci.org/crosstool-ng/crosstool-ng/builds) job will run to test your changes against a select set of samples. As they start to get worked, they should be placed in the `Ready` state. PRs that are being worked are `In Progress`. If a questions come up about the commit that might envolve changes to the commit then the PR is placed in `Waiting For Response`, you have two options:
|
||||
- By creating a pull request, the PR is entered into the [backlog](https://waffle.io/crosstool-ng/crosstool-ng). A [travis-ci](https://travis-ci.org/crosstool-ng/crosstool-ng/builds) job will run to test your changes against a select set of samples. As they start to get worked, they should be placed in the `Ready` state. PRs that are being worked are `In Progress`. If a questions come up about the commit that might involve changes to the commit then the PR is placed in `Waiting For Response`, you have two options:
|
||||
1. Fix the issue with the commit by adding a new commit in the topic branch that fixes the code review. Then push your changes to your branch. This option keeps the comments in the PR, and allows for further code review. I personally dislike this, because people are lazy and fix reviews with `fix more review issues`. Please make good commit messages! All rules about commits from above apply! **THIS IS PREFERED**
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# GCC options
|
||||
|
||||
## select CC_SUPPORT_CXX if !LIBC_NONE
|
||||
## select CC_SUPPORT_CXX
|
||||
## select CC_SUPPORT_FORTRAN
|
||||
## select CC_SUPPORT_JAVA if !GCC_7_or_later && OBSOLETE
|
||||
## select CC_SUPPORT_ADA
|
||||
|
@ -1,19 +1,26 @@
|
||||
# picolibc options
|
||||
|
||||
## depends on BARE_METAL && CONFIGURE_has_meson && CONFIGURE_has_ninja
|
||||
## select LIBC_SUPPORT_THREADS_NATIVE
|
||||
|
||||
## select CC_CORE_PASSES_NEEDED if CANADIAN
|
||||
## select CC_CORE_PASS_2_NEEDED if ! CANADIAN
|
||||
|
||||
## help This option adds Picolibc to an existing configuration which may have
|
||||
## help a C library, allowing you to install both and select between them
|
||||
## help when compiling applications using the toolchain
|
||||
## help
|
||||
## help Picolibc is a C library intended for use on embedded systems. It is a
|
||||
## help conglomeration of several library parts, all under BSD-compatible software
|
||||
## help licenses that make them easily usable on embedded products. Picolibc
|
||||
## help is only available in source form. It can be compiled for a wide
|
||||
## help array of processors, and will usually work on any architecture with
|
||||
## help the addition of a few low-level routines.
|
||||
## help licenses that make them easily usable on embedded products.
|
||||
|
||||
config PICOLIBC_CXA_ATEXIT
|
||||
config LIBC_PICOLIBC_GCC_LIBSTDCXX
|
||||
bool
|
||||
prompt "Compile libstdc++ picolibc variant"
|
||||
default y
|
||||
depends on CC_LANG_CXX
|
||||
help
|
||||
This option compiles an additional target libstdc++ for use with
|
||||
picolibc. This version is linked when "--specs=picolibcpp.specs"
|
||||
is specified.
|
||||
|
||||
config LIBC_PICOLIBC_CXA_ATEXIT
|
||||
def_bool y
|
||||
select LIBC_PROVIDES_CXA_ATEXIT
|
||||
|
||||
@ -75,6 +82,7 @@ config LIBC_PICOLIBC_MULTITHREAD
|
||||
config LIBC_PICOLIBC_RETARGETABLE_LOCKING
|
||||
bool
|
||||
prompt "Enable retargetable locking"
|
||||
default y
|
||||
help
|
||||
Enable retargetable locking to allow the operating system to override
|
||||
the dummy lock functions defined within picolibc.
|
8
packages/dtc/1.6.0/chksum
vendored
Normal file
8
packages/dtc/1.6.0/chksum
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
md5 dtc-1.6.0.tar.xz 1556ba93648bf70d7aa034252e278751
|
||||
sha1 dtc-1.6.0.tar.xz 3e6ab5121dcfe5ff9f8b0503becfcf687d5d4434
|
||||
sha256 dtc-1.6.0.tar.xz 10503b0217e1b07933e29e8d347a00015b2431bea5f59afe0bed3af30340c82d
|
||||
sha512 dtc-1.6.0.tar.xz 15433b24f1d6b7ed1f8066d050bd1bcbf988731aa38147564e3dd04b5f69af8d69e03befdc621a768526c620425a9bdd24aad4f9ff135930d6a1eeb0625f7de3
|
||||
md5 dtc-1.6.0.tar.gz b87b7aee4a01535ef1f9c53d5f6cd178
|
||||
sha1 dtc-1.6.0.tar.gz ef037f4599b7b1e883c9bb588b24d289dc9cd1f2
|
||||
sha256 dtc-1.6.0.tar.gz 9fbe07223a98f2d7088a340b5505d4dfe682d77580e788d08cfcc1b61d8be237
|
||||
sha512 dtc-1.6.0.tar.gz 8ca3f9e06a60144d3f476c251d911f2daa16afb82daa101c61050bfab226dbb330f8a75a3715fe0c2b46b2a64f3794eb3ce0816aef434ab64e1feb1ba08be574
|
0
packages/dtc/1.6.0/version.desc
vendored
Normal file
0
packages/dtc/1.6.0/version.desc
vendored
Normal file
275
packages/gcc/10.2.0/0019-libstdcxx-pure-stdio.patch
vendored
Normal file
275
packages/gcc/10.2.0/0019-libstdcxx-pure-stdio.patch
vendored
Normal file
@ -0,0 +1,275 @@
|
||||
From ce06ad6901b1d24abb90d6baba5fe01c750ffb4e Mon Sep 17 00:00:00 2001
|
||||
From: Keith Packard <keithp@keithp.com>
|
||||
Date: Tue, 15 Dec 2020 17:39:24 +0000
|
||||
Subject: [PATCH] libstdc++: Support libc with stdio-only I/O in libstdc++
|
||||
|
||||
The current libstdc++ basic_file_stdio.cc code assumes a POSIX API
|
||||
underneath the stdio implementation provided by the host libc. This
|
||||
means that the host must provide a fairly broad POSIX file API,
|
||||
including read, write, open, close, lseek and ioctl.
|
||||
|
||||
This patch changes basic_file_stdio.cc to only use basic ANSI-C stdio
|
||||
functions, allowing it to be used with libc implementations like
|
||||
picolibc which may not have a POSIX operating system underneath.
|
||||
|
||||
This is enabled by a new --enable-cstdio=stdio_pure configure option.
|
||||
|
||||
Aided-by: Jonathan Wakely <jwakely@redhat.com>
|
||||
Signed-off-by: Keith Packard <keithp@keithp.com>
|
||||
|
||||
libstdc++-v3/ChangeLog:
|
||||
|
||||
* acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Allow "stdio_pure"
|
||||
option and define _GLIBCXX_USE_PURE_STDIO when it is used. Also
|
||||
add "stdio_posix" option as an alias for "stdio".
|
||||
* config/io/basic_file_stdio.cc [_GLIBCXX_USE_PURE_STDIO]: Only
|
||||
use defined stdio entry points for all I/O operations, without
|
||||
direct calls to underlying POSIX functions.
|
||||
* config.h.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
---
|
||||
libstdc++-v3/acinclude.m4 | 20 ++++++----
|
||||
libstdc++-v3/config.h.in | 3 ++
|
||||
libstdc++-v3/config/io/basic_file_stdio.cc | 46 +++++++++++++++++++---
|
||||
libstdc++-v3/configure | 17 +++++---
|
||||
4 files changed, 69 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
|
||||
index ee5e0336f2c..9604533c306 100644
|
||||
--- a/libstdc++-v3/acinclude.m4
|
||||
+++ b/libstdc++-v3/acinclude.m4
|
||||
@@ -2826,24 +2826,30 @@ AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
|
||||
|
||||
|
||||
dnl
|
||||
-dnl Check for which I/O library to use: stdio, or something specific.
|
||||
+dnl Check for which I/O library to use: stdio and POSIX, or pure stdio.
|
||||
dnl
|
||||
-dnl Default is stdio.
|
||||
+dnl Default is stdio_posix.
|
||||
dnl
|
||||
AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
|
||||
AC_MSG_CHECKING([for underlying I/O to use])
|
||||
GLIBCXX_ENABLE(cstdio,stdio,[[[=PACKAGE]]],
|
||||
- [use target-specific I/O package], [permit stdio])
|
||||
+ [use target-specific I/O package], [permit stdio|stdio_posix|stdio_pure])
|
||||
|
||||
- # Now that libio has been removed, you can have any color you want as long
|
||||
- # as it's black. This is one big no-op until other packages are added, but
|
||||
- # showing the framework never hurts.
|
||||
+ # The only available I/O model is based on stdio, via basic_file_stdio.
|
||||
+ # The default "stdio" is actually "stdio + POSIX" because it uses fdopen(3)
|
||||
+ # to get a file descriptor and then uses read(3) and write(3) with it.
|
||||
+ # The "stdio_pure" model doesn't use fdopen and only uses FILE* for I/O.
|
||||
case ${enable_cstdio} in
|
||||
- stdio)
|
||||
+ stdio*)
|
||||
CSTDIO_H=config/io/c_io_stdio.h
|
||||
BASIC_FILE_H=config/io/basic_file_stdio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_stdio.cc
|
||||
AC_MSG_RESULT(stdio)
|
||||
+
|
||||
+ if test "x$enable_cstdio" = "xstdio_pure" ; then
|
||||
+ AC_DEFINE(_GLIBCXX_USE_STDIO_PURE, 1,
|
||||
+ [Define to restrict std::__basic_file<> to stdio APIs.])
|
||||
+ fi
|
||||
;;
|
||||
esac
|
||||
|
||||
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
|
||||
index 8940e0c7acd..eabcf18b52b 100644
|
||||
--- a/libstdc++-v3/config.h.in
|
||||
+++ b/libstdc++-v3/config.h.in
|
||||
@@ -1031,6 +1031,9 @@
|
||||
/* Define if sendfile is available in <sys/sendfile.h>. */
|
||||
#undef _GLIBCXX_USE_SENDFILE
|
||||
|
||||
+/* Define to restrict std::__basic_file<> to stdio APIs. */
|
||||
+#undef _GLIBCXX_USE_STDIO_PURE
|
||||
+
|
||||
/* Define if struct stat has timespec members. */
|
||||
#undef _GLIBCXX_USE_ST_MTIM
|
||||
|
||||
diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
|
||||
index ba830fb9e97..eedffb017b6 100644
|
||||
--- a/libstdc++-v3/config/io/basic_file_stdio.cc
|
||||
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
|
||||
@@ -111,13 +111,21 @@ namespace
|
||||
|
||||
// Wrapper handling partial write.
|
||||
static std::streamsize
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ xwrite(FILE *__file, const char* __s, std::streamsize __n)
|
||||
+#else
|
||||
xwrite(int __fd, const char* __s, std::streamsize __n)
|
||||
+#endif
|
||||
{
|
||||
std::streamsize __nleft = __n;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ const std::streamsize __ret = fwrite(__file, 1, __nleft, __file);
|
||||
+#else
|
||||
const std::streamsize __ret = write(__fd, __s, __nleft);
|
||||
+#endif
|
||||
if (__ret == -1L && errno == EINTR)
|
||||
continue;
|
||||
if (__ret == -1L)
|
||||
@@ -133,7 +141,7 @@ namespace
|
||||
return __n - __nleft;
|
||||
}
|
||||
|
||||
-#ifdef _GLIBCXX_HAVE_WRITEV
|
||||
+#if defined(_GLIBCXX_HAVE_WRITEV) && !defined(_GLIBCXX_USE_STDIO_PURE)
|
||||
// Wrapper handling partial writev.
|
||||
static std::streamsize
|
||||
xwritev(int __fd, const char* __s1, std::streamsize __n1,
|
||||
@@ -286,9 +294,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
__basic_file<char>::is_open() const throw ()
|
||||
{ return _M_cfile != 0; }
|
||||
|
||||
+#ifndef _GLIBCCXX_USE_STDIO_PURE
|
||||
int
|
||||
__basic_file<char>::fd() throw ()
|
||||
{ return fileno(_M_cfile); }
|
||||
+#endif
|
||||
|
||||
__c_file*
|
||||
__basic_file<char>::file() throw ()
|
||||
@@ -315,28 +325,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
{
|
||||
streamsize __ret;
|
||||
do
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ __ret = fread(__s, 1, __n, this->file());
|
||||
+#else
|
||||
__ret = read(this->fd(), __s, __n);
|
||||
+#endif
|
||||
while (__ret == -1L && errno == EINTR);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n)
|
||||
- { return xwrite(this->fd(), __s, __n); }
|
||||
+ {
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ return xwrite(this->file(), __s, __n);
|
||||
+#else
|
||||
+ return xwrite(this->fd(), __s, __n);
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsputn_2(const char* __s1, streamsize __n1,
|
||||
const char* __s2, streamsize __n2)
|
||||
{
|
||||
streamsize __ret = 0;
|
||||
-#ifdef _GLIBCXX_HAVE_WRITEV
|
||||
+#if defined(_GLIBCXX_HAVE_WRITEV) && !defined(_GLIBCXX_USE_STDIO_PURE)
|
||||
__ret = xwritev(this->fd(), __s1, __n1, __s2, __n2);
|
||||
#else
|
||||
if (__n1)
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ __ret = xwrite(this->file(), __s1, __n1);
|
||||
+#else
|
||||
__ret = xwrite(this->fd(), __s1, __n1);
|
||||
+#endif
|
||||
|
||||
if (__ret == __n1)
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ __ret += xwrite(this->file(), __s2, __n2);
|
||||
+#else
|
||||
__ret += xwrite(this->fd(), __s2, __n2);
|
||||
+#endif
|
||||
#endif
|
||||
return __ret;
|
||||
}
|
||||
@@ -350,7 +378,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
if (__off > numeric_limits<off_t>::max()
|
||||
|| __off < numeric_limits<off_t>::min())
|
||||
return -1L;
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ return fseek(this->file(), __off, __way);
|
||||
+#else
|
||||
return lseek(this->fd(), __off, __way);
|
||||
+#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -361,7 +393,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
streamsize
|
||||
__basic_file<char>::showmanyc()
|
||||
{
|
||||
-#ifndef _GLIBCXX_NO_IOCTL
|
||||
+#if !defined(_GLIBCXX_NO_IOCTL) && !defined(_GLIBCXX_USE_STDIO_PURE)
|
||||
#ifdef FIONREAD
|
||||
// Pipes and sockets.
|
||||
int __num = 0;
|
||||
@@ -371,7 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
#endif
|
||||
#endif
|
||||
|
||||
-#ifdef _GLIBCXX_HAVE_POLL
|
||||
+#if defined(_GLIBCXX_HAVE_POLL) && !defined(_GLIBCXX_USE_STDIO_PURE)
|
||||
// Cheap test.
|
||||
struct pollfd __pfd[1];
|
||||
__pfd[0].fd = this->fd();
|
||||
@@ -395,8 +427,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
struct stat __buffer;
|
||||
const int __err = fstat(this->fd(), &__buffer);
|
||||
if (!__err && _GLIBCXX_ISREG(__buffer.st_mode))
|
||||
+#ifdef _GLIBCXX_USE_STDIO_PURE
|
||||
+ return __buffer.st_size - fseek(this->file(), 0, ios_base::cur);
|
||||
+#else
|
||||
return __buffer.st_size - lseek(this->fd(), 0, ios_base::cur);
|
||||
#endif
|
||||
+#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
|
||||
index 9f9c5a2419a..50c8f00a41c 100755
|
||||
--- a/libstdc++-v3/configure
|
||||
+++ b/libstdc++-v3/configure
|
||||
@@ -16299,7 +16299,7 @@ $as_echo_n "checking for underlying I/O to use... " >&6; }
|
||||
if test "${enable_cstdio+set}" = set; then :
|
||||
enableval=$enable_cstdio;
|
||||
case "$enableval" in
|
||||
- stdio) ;;
|
||||
+ stdio|stdio_posix|stdio_pure) ;;
|
||||
*) as_fn_error $? "Unknown argument to enable/disable cstdio" "$LINENO" 5 ;;
|
||||
esac
|
||||
|
||||
@@ -16309,16 +16309,23 @@ fi
|
||||
|
||||
|
||||
|
||||
- # Now that libio has been removed, you can have any color you want as long
|
||||
- # as it's black. This is one big no-op until other packages are added, but
|
||||
- # showing the framework never hurts.
|
||||
+ # The only available I/O model is based on stdio, via basic_file_stdio.
|
||||
+ # The default "stdio" is actually "stdio + POSIX" because it uses fdopen(3)
|
||||
+ # to get a file descriptor and then uses read(3) and write(3) with it.
|
||||
+ # The "stdio_pure" model doesn't use fdopen and only uses FILE* for I/O.
|
||||
case ${enable_cstdio} in
|
||||
- stdio)
|
||||
+ stdio*)
|
||||
CSTDIO_H=config/io/c_io_stdio.h
|
||||
BASIC_FILE_H=config/io/basic_file_stdio.h
|
||||
BASIC_FILE_CC=config/io/basic_file_stdio.cc
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: stdio" >&5
|
||||
$as_echo "stdio" >&6; }
|
||||
+
|
||||
+ if test "x$enable_cstdio" = "xstdio_pure" ; then
|
||||
+
|
||||
+$as_echo "#define _GLIBCXX_USE_STDIO_PURE 1" >>confdefs.h
|
||||
+
|
||||
+ fi
|
||||
;;
|
||||
esac
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
159
packages/picolibc/1.4.7/0001-tinystdio-Make-ungetc-buffer-type-purely-architectur.patch
vendored
Normal file
159
packages/picolibc/1.4.7/0001-tinystdio-Make-ungetc-buffer-type-purely-architectur.patch
vendored
Normal file
@ -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
|
||||
|
36
packages/picolibc/1.4.7/0002-Add-ARM-exception-information-to-link-rules.patch
vendored
Normal file
36
packages/picolibc/1.4.7/0002-Add-ARM-exception-information-to-link-rules.patch
vendored
Normal file
@ -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
|
||||
|
31
packages/picolibc/1.4.7/0003-Add-picolibc-include-directory-to-cc1plus-spec.patch
vendored
Normal file
31
packages/picolibc/1.4.7/0003-Add-picolibc-include-directory-to-cc1plus-spec.patch
vendored
Normal file
@ -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
|
||||
|
8
packages/picolibc/1.4.7/chksum
vendored
8
packages/picolibc/1.4.7/chksum
vendored
@ -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
|
||||
|
4
packages/picolibc/1.5/chksum
vendored
Normal file
4
packages/picolibc/1.5/chksum
vendored
Normal file
@ -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
|
0
packages/picolibc/1.5/version.desc
vendored
Normal file
0
packages/picolibc/1.5/version.desc
vendored
Normal file
@ -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}'
|
||||
|
@ -3,10 +3,9 @@ CT_ARCH_ARM=y
|
||||
CT_MULTILIB=y
|
||||
CT_ARCH_FLOAT_SW=y
|
||||
CT_TARGET_VENDOR="picolibc"
|
||||
CT_CC_LANG_CXX=n
|
||||
CT_LIBC="picolibc"
|
||||
CT_LIBC_NEWLIB=n
|
||||
CT_LIBC_PICOLIBC=y
|
||||
CT_LIBC_NONE=y
|
||||
CT_CC_GCC_CONFIG_TLS=y
|
||||
CT_TARGET_CFLAGS="-ftls-model=local-exec"
|
||||
CT_CC_GCC_MULTILIB_LIST="rmprofile"
|
||||
CT_COMP_LIBS_PICOLIBC=y
|
||||
CT_CC_LANG_CXX=y
|
||||
|
@ -6,3 +6,5 @@ CT_LIBC_NEWLIB_IO_LL=y
|
||||
CT_LIBC_NEWLIB_IO_FLOAT=y
|
||||
CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS=y
|
||||
CT_CC_LANG_CXX=y
|
||||
CT_COMP_LIBS_PICOLIBC=y
|
||||
CT_TARGET_CFLAGS="-ftls-model=local-exec"
|
||||
|
@ -279,7 +279,8 @@ do_cc_core_pass_2() {
|
||||
# build_manuals : whether to build manuals or not : bool : no
|
||||
# cflags : cflags to use : string : (empty)
|
||||
# ldflags : ldflags to use : string : (empty)
|
||||
# build_step : build step 'core1', 'core2', 'gcc_build'
|
||||
# build_step : build step 'core1', 'core2', 'gcc_build',
|
||||
# 'libstdcxx'
|
||||
# or 'gcc_host' : string : (none)
|
||||
# Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no]
|
||||
do_gcc_core_backend() {
|
||||
@ -291,6 +292,7 @@ do_gcc_core_backend() {
|
||||
local build_manuals=no
|
||||
local host
|
||||
local prefix
|
||||
local enable_optspace
|
||||
local complibs
|
||||
local lang_list
|
||||
local cflags cflags_for_build cflags_for_target
|
||||
@ -298,6 +300,9 @@ do_gcc_core_backend() {
|
||||
local build_step
|
||||
local log_txt
|
||||
local tmp
|
||||
local exec_prefix
|
||||
local header_dir
|
||||
local libstdcxx_name
|
||||
local -a host_libstdcxx_flags
|
||||
local -a extra_config
|
||||
local -a core_LDFLAGS
|
||||
@ -327,11 +332,30 @@ do_gcc_core_backend() {
|
||||
# to inhibit the libiberty and libgcc tricks later on
|
||||
build_libgcc=no
|
||||
;;
|
||||
libstdcxx)
|
||||
CT_DoLog EXTRA "Configuring libstdc++ for ${libstdcxx_name}"
|
||||
if [ "${header_dir}" = "" ]; then
|
||||
header_dir="${CT_PREFIX_DIR}/${libstdcxx_name}/include"
|
||||
fi
|
||||
if [ "${exec_prefix}" = "" ]; then
|
||||
exec_prefix="${CT_PREFIX_DIR}/${libstdcxx_name}"
|
||||
fi
|
||||
extra_config+=( "${CT_CC_SYSROOT_ARG[@]}" )
|
||||
extra_config+=( "--with-headers=${header_dir}" )
|
||||
extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
|
||||
log_txt="libstdc++ ${libstdcxx_name} library"
|
||||
# to inhibit the libiberty and libgcc tricks later on
|
||||
build_libgcc=no
|
||||
;;
|
||||
*)
|
||||
CT_Abort "Internal Error: 'build_step' must be one of: 'core1', 'core2', 'gcc_build' or 'gcc_host', not '${build_step:-(empty)}'"
|
||||
CT_Abort "Internal Error: 'build_step' must be one of: 'core1', 'core2', 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${exec_prefix}" = "" ]; then
|
||||
exec_prefix="${prefix}"
|
||||
fi
|
||||
|
||||
case "${mode}" in
|
||||
static)
|
||||
extra_config+=("--with-newlib")
|
||||
@ -394,6 +418,10 @@ do_gcc_core_backend() {
|
||||
extra_config+=(--disable-libquadmath-support)
|
||||
fi
|
||||
|
||||
if [ "${build_libstdcxx}" = "no" ]; then
|
||||
extra_config+=(--disable-libstdcxx)
|
||||
fi
|
||||
|
||||
core_LDFLAGS+=("${ldflags}")
|
||||
|
||||
# *** WARNING ! ***
|
||||
@ -452,7 +480,8 @@ do_gcc_core_backend() {
|
||||
extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}")
|
||||
fi
|
||||
|
||||
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
|
||||
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ] || \
|
||||
[ "${enable_optspace}" = "yes" ]; then
|
||||
extra_config+=("--enable-target-optspace")
|
||||
fi
|
||||
if [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ]; then
|
||||
@ -600,6 +629,7 @@ do_gcc_core_backend() {
|
||||
--host=${host} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix="${prefix}" \
|
||||
--exec_prefix="${exec_prefix}" \
|
||||
--with-local-prefix="${CT_SYSROOT_DIR}" \
|
||||
"${extra_config[@]}" \
|
||||
--enable-languages="${lang_list}" \
|
||||
@ -683,6 +713,11 @@ do_gcc_core_backend() {
|
||||
core_targets_all=all
|
||||
core_targets_install=install
|
||||
;;
|
||||
libstdcxx)
|
||||
core_targets=( target-libstdc++-v3 )
|
||||
core_targets_all="${core_targets[@]/#/all-}"
|
||||
core_targets_install="${core_targets[@]/#/install-}"
|
||||
;;
|
||||
esac
|
||||
|
||||
CT_DoLog EXTRA "Building ${log_txt}"
|
||||
@ -759,7 +794,9 @@ do_cc_for_build() {
|
||||
# lack of such a compiler, but better safe than sorry...
|
||||
build_final_opts+=( "mode=baremetal" )
|
||||
build_final_opts+=( "build_libgcc=yes" )
|
||||
build_final_opts+=( "build_libstdcxx=yes" )
|
||||
if [ "${CT_LIBC_NONE}" != "y" ]; then
|
||||
build_final_opts+=( "build_libstdcxx=yes" )
|
||||
fi
|
||||
build_final_opts+=( "build_libgfortran=yes" )
|
||||
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
|
||||
build_final_opts+=( "build_staticlinked=yes" )
|
||||
@ -848,7 +885,9 @@ do_cc_for_host() {
|
||||
if [ "${CT_BARE_METAL}" = "y" ]; then
|
||||
final_opts+=( "mode=baremetal" )
|
||||
final_opts+=( "build_libgcc=yes" )
|
||||
final_opts+=( "build_libstdcxx=yes" )
|
||||
if [ "${CT_LIBC_NONE}" != "y" ]; then
|
||||
final_opts+=( "build_libstdcxx=yes" )
|
||||
fi
|
||||
final_opts+=( "build_libgfortran=yes" )
|
||||
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
|
||||
final_opts+=( "build_staticlinked=yes" )
|
||||
@ -881,20 +920,27 @@ do_cc_for_host() {
|
||||
# Parameter : Definition : Type : Default
|
||||
# host : the host we run onto : tuple : (none)
|
||||
# prefix : the runtime prefix : dir : (none)
|
||||
# exec_prefix : prefix for executables : dir : (none)
|
||||
# complibs : the companion libraries prefix : dir : (none)
|
||||
# cflags : cflags to use : string : (empty)
|
||||
# ldflags : ldflags to use : string : (empty)
|
||||
# lang_list : the list of languages to build : string : (empty)
|
||||
# build_manuals : whether to build manuals or not : bool : no
|
||||
# build_step : build step 'gcc_build', 'gcc_host'
|
||||
# or 'libstdcxx' : string : (none)
|
||||
do_gcc_backend() {
|
||||
local host
|
||||
local prefix
|
||||
local exec_prefix
|
||||
local complibs
|
||||
local lang_list
|
||||
local cflags
|
||||
local cflags_for_build
|
||||
local ldflags
|
||||
local build_manuals
|
||||
local exec_prefix
|
||||
local header_dir
|
||||
local libstdcxx_name
|
||||
local -a host_libstdcxx_flags
|
||||
local -a extra_config
|
||||
local -a final_LDFLAGS
|
||||
@ -905,7 +951,24 @@ do_gcc_backend() {
|
||||
eval "${arg// /\\ }"
|
||||
done
|
||||
|
||||
CT_DoLog EXTRA "Configuring final gcc compiler"
|
||||
if [ "${exec_prefix}" = "" ]; then
|
||||
exec_prefix="${prefix}"
|
||||
fi
|
||||
|
||||
# This function gets called for final gcc and libstdcxx.
|
||||
case "${build_step}" in
|
||||
gcc_build|gcc_host)
|
||||
log_txt="final gcc compiler"
|
||||
;;
|
||||
libstdcxx)
|
||||
log_txt="libstdc++ library for ${libstdcxx_name}"
|
||||
;;
|
||||
*)
|
||||
CT_Abort "Internal Error: 'build_step' must be one of: 'gcc_build', 'gcc_host' or 'libstdcxx', not '${build_step:-(empty)}'"
|
||||
;;
|
||||
esac
|
||||
|
||||
CT_DoLog EXTRA "Configuring ${log_txt}"
|
||||
|
||||
# Enable selected languages
|
||||
extra_config+=("--enable-languages=${lang_list}")
|
||||
@ -979,6 +1042,10 @@ do_gcc_backend() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${build_libstdcxx}" = "no" ]; then
|
||||
extra_config+=(--disable-libstdcxx)
|
||||
fi
|
||||
|
||||
final_LDFLAGS+=("${ldflags}")
|
||||
|
||||
# *** WARNING ! ***
|
||||
@ -1048,9 +1115,11 @@ do_gcc_backend() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
|
||||
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ] || \
|
||||
[ "${enable_optspace}" = "yes" ]; then
|
||||
extra_config+=("--enable-target-optspace")
|
||||
fi
|
||||
|
||||
if [ "${CT_CC_GCC_DISABLE_PCH}" = "y" ]; then
|
||||
extra_config+=("--disable-libstdcxx-pch")
|
||||
fi
|
||||
@ -1166,6 +1235,7 @@ do_gcc_backend() {
|
||||
--host=${host} \
|
||||
--target=${CT_TARGET} \
|
||||
--prefix="${prefix}" \
|
||||
--exec_prefix="${exec_prefix}" \
|
||||
${CT_CC_SYSROOT_ARG} \
|
||||
"${extra_config[@]}" \
|
||||
--with-local-prefix="${CT_SYSROOT_DIR}" \
|
||||
|
@ -87,6 +87,15 @@ do_gmp_backend() {
|
||||
extra_config+=("--enable-mpbsd")
|
||||
fi
|
||||
|
||||
# To avoind “illegal text-relocation” linking error against
|
||||
# the static library, see:
|
||||
# https://github.com/Homebrew/homebrew-core/pull/25470
|
||||
case "${host}" in
|
||||
*darwin*)
|
||||
extra_config+=("--with-pic")
|
||||
;;
|
||||
esac
|
||||
|
||||
# FIXME: GMP's configure script doesn't respect the host parameter
|
||||
# when not cross-compiling, ie when build == host.
|
||||
CT_DoExecLog CFG \
|
||||
|
@ -5,22 +5,74 @@
|
||||
# Edited by Keith Packard <keithp@keithp.com>
|
||||
#
|
||||
|
||||
picolibc_start_files()
|
||||
{
|
||||
CT_DoStep INFO "Installing C library headers & start files"
|
||||
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/picolibc/newlib/libc/include/." \
|
||||
"${CT_HEADERS_DIR}"
|
||||
CT_EndStep
|
||||
do_picolibc_get() { :; }
|
||||
do_picolibc_extract() { :; }
|
||||
do_picolibc_for_build() { :; }
|
||||
do_picolibc_for_host() { :; }
|
||||
do_picolibc_for_target() { :; }
|
||||
|
||||
if [ "${CT_COMP_LIBS_PICOLIBC}" = "y" ]; then
|
||||
|
||||
# Download picolibc
|
||||
do_picolibc_get() {
|
||||
CT_Fetch PICOLIBC
|
||||
}
|
||||
|
||||
picolibc_main()
|
||||
do_picolibc_extract() {
|
||||
CT_ExtractPatch PICOLIBC
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Build an additional target libstdc++ with "-Os" (optimise for speed) option
|
||||
# flag for libstdc++ "picolibc" variant.
|
||||
do_cc_libstdcxx_picolibc()
|
||||
{
|
||||
local -a final_opts
|
||||
local final_backend
|
||||
|
||||
if [ "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX}" = "y" ]; then
|
||||
final_opts+=( "host=${CT_HOST}" )
|
||||
final_opts+=( "libstdcxx_name=picolibc" )
|
||||
final_opts+=( "prefix=${CT_PREFIX_DIR}" )
|
||||
final_opts+=( "complibs=${CT_HOST_COMPLIBS_DIR}" )
|
||||
final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
||||
final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
||||
final_opts+=( "lang_list=c,c++" )
|
||||
final_opts+=( "build_step=libstdcxx" )
|
||||
final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" )
|
||||
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
|
||||
final_opts+=( "enable_optspace=yes" )
|
||||
fi
|
||||
|
||||
if [ "${CT_BARE_METAL}" = "y" ]; then
|
||||
final_opts+=( "mode=baremetal" )
|
||||
final_opts+=( "build_libgcc=yes" )
|
||||
final_opts+=( "build_libstdcxx=yes" )
|
||||
final_opts+=( "build_libgfortran=yes" )
|
||||
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
|
||||
final_opts+=( "build_staticlinked=yes" )
|
||||
fi
|
||||
final_backend=do_gcc_core_backend
|
||||
else
|
||||
final_backend=do_gcc_backend
|
||||
fi
|
||||
|
||||
CT_DoStep INFO "Installing libstdc++ picolibc"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-libstdcxx-picolibc"
|
||||
"${final_backend}" "${final_opts[@]}"
|
||||
CT_Popd
|
||||
|
||||
CT_EndStep
|
||||
fi
|
||||
}
|
||||
|
||||
do_picolibc_for_target() {
|
||||
local -a picolibc_opts
|
||||
local cflags_for_target
|
||||
|
||||
CT_DoStep INFO "Installing C library"
|
||||
CT_DoStep INFO "Installing Picolibc library"
|
||||
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc"
|
||||
CT_mkdir_pushd "${CT_BUILD_DIR}/build-picolibc-build-${CT_BUILD}"
|
||||
|
||||
CT_DoLog EXTRA "Configuring Picolibc library"
|
||||
|
||||
@ -91,11 +143,14 @@ c_args = [ ${meson_cflags} '-nostdlib', '-fno-common', '-ftls-model=local-exec'
|
||||
needs_exe_wrapper = true
|
||||
skip_sanity_check = true
|
||||
EOF
|
||||
|
||||
CT_DoExecLog CFG \
|
||||
meson \
|
||||
--cross-file picolibc-cross.txt \
|
||||
--prefix=${CT_SYSROOT_DIR} \
|
||||
-Dspecsdir=${CT_SYSROOT_DIR}/lib \
|
||||
--prefix="${CT_PREFIX_DIR}" \
|
||||
-Dincludedir=picolibc/include \
|
||||
-Dlibdir=picolibc/${CT_TARGET}/lib \
|
||||
-Dspecsdir="${CT_SYSROOT_DIR}"/lib \
|
||||
"${CT_SRC_DIR}/picolibc" \
|
||||
"${picolibc_opts[@]}" \
|
||||
"${CT_LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY[@]}"
|
||||
@ -108,4 +163,8 @@ EOF
|
||||
|
||||
CT_Popd
|
||||
CT_EndStep
|
||||
|
||||
do_cc_libstdcxx_picolibc
|
||||
}
|
||||
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user