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.
Showing
- libstdc++-v3/acinclude.m4 13 additions, 7 deletionslibstdc++-v3/acinclude.m4
- libstdc++-v3/config.h.in 3 additions, 0 deletionslibstdc++-v3/config.h.in
- libstdc++-v3/config/io/basic_file_stdio.cc 41 additions, 5 deletionslibstdc++-v3/config/io/basic_file_stdio.cc
- libstdc++-v3/configure 12 additions, 5 deletionslibstdc++-v3/configure
Loading
Please register or sign in to comment