[PATCH 0/2] Support libc with stdio-only I/O in libstdc++

2020-12-07 Thread Keith Packard via Gcc
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

[PATCH 2/2] Regenerate libstdc++-v3 autoconf files

2020-12-07 Thread Keith Packard via Gcc
These are the changes to autoconf files for the pure-stdio patch Signed-off-by: Keith Packard --- libstdc++-v3/config.h.in | 3 +++ libstdc++-v3/configure | 23 +++ 2 files changed, 26 insertions(+) diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 72

[PATCH 1/2] libstdc++: Add --enable-pure-stdio-libstdcxx option

2020-12-07 Thread Keith Packard via Gcc
This option directs the library to only use simple stdio APIs instead of using fileno to get the file descriptor for use with POSIX APIs. Signed-off-by: Keith Packard --- libstdc++-v3/ChangeLog | 13 ++ libstdc++-v3/acinclude.m4 | 13 ++ libstdc++-v3/

[PATCH] Add -fopt-builtin optimization option

2021-10-31 Thread Keith Packard via Gcc
This option (enabled by default) controls optimizations which convert a sequence of operations into an equivalent sequence that includes calls to builtin functions. Typical cases here are code which matches memcpy, calloc, sincos. The -ftree-loop-distribute-patterns flag only covers converting loo

Re: [PATCH] Add -fopt-builtin optimization option

2021-11-02 Thread Keith Packard via Gcc
Richard Biener writes: > I don't think it reliably works the way you implement it. It's also having > more side-effects than what you document, in particular Yeah, I made a 'minimal' patch that had the effect I needed, but it's clearly in the wrong place as it disables the matching of builtins

[PATCH] Add 'no_builtin' function attribute

2021-11-02 Thread Keith Packard via Gcc
This attribute controls optimizations which make assumptions about the semantics of builtin functions. Typical cases here are code which match memcpy, calloc, sincos, or which call builtins like free. This extends on things like the -ftree-loop-distribute-patterns flag. That flag only covers conve

Re: [PATCH] Add 'no_builtin' function attribute

2021-11-03 Thread Keith Packard via Gcc
Martin Sebor writes: > Can this option be used in attribute optimize? If yes, what's > the advantage of also providing an atttribute? Compatibility with the clang attribute. > It seems to me that as a matter of QOI, GCC should be able to > disable the expansion of built-ins to calls to themsel

[PATCH 2/3] picolibc: Add newlib and picolibc as default C library choices

2022-08-24 Thread Keith Packard via Gcc
Signed-off-by: Keith Packard --- gcc/config.gcc | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index f8b6da4f4e7..0aa4bd6c3dd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -639,7 +639,7 @@ case ${target} in esac # Common C libr

[PATCH 1/3] picolibc: Allow default libc to be specified to configure

2022-08-24 Thread Keith Packard via Gcc
The default C library is normally computed based on the target triplet. However, for embedded systems, it can be useful to leave the triplet alone while changing which C library is used by default. Other C libraries may still be available on the system so the compiler and can be used by specifying

[PATCH 3/3] picolibc: Add '--oslib=' option when default C library is picolibc

2022-08-24 Thread Keith Packard via Gcc
This option allows targets to insert an OS library after the C library in the LIB_PATH spec file fragment. This library maps a few POSIX APIs used by picolibc to underlying system capabilities. For example, picolibc provides 'libsemihost' on various targets which maps these APIs to semihosting cap

[PATCH 0/3] picolibc: Add picolibc linking help

2022-08-24 Thread Keith Packard via Gcc
Picolibc is a C library for embedded systems based on code from newlib and avr libc. To connect some system-dependent picolibc functions (like stdio) to an underlying platform, the platform may provide an OS library. This OS library must follow the C library in the link command line. In current pi

Re: [PATCH 0/3] picolibc: Add picolibc linking help

2022-09-02 Thread Keith Packard via Gcc
Richard Sandiford writes: Thanks much for reviewing this series. I really appreciate it. > should there be a default case that raises an error for unrecognised > libcs? Command-line checking for configure isn't very tight, but we > do raise similar errors for things like invalid --enable-