[0/3] picolibc: Add picolibc linking help (v3)

Message ID cover.1675579641.git.keithp@keithp.com
Headers
Series picolibc: Add picolibc linking help (v3) |

Message

Keith Packard Feb. 5, 2023, 7:10 a.m. UTC
  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 picolibc, that is done by providing an alternate .specs file
which can rewrite the *lib spec to insert the OS library in the right
spot.

This patch series adds the ability to specify the OS library on the
gcc command line when GCC is configured to us picolibc as the default
C library.

The second version of this series includes the following updates:

 1. Add a check for unrecognized C library passed to the
    --with-default-libc to catch errors. Suggested by Richard Sandiford.

The third version of this series includes the following updates:

 1. Replace the various target-specific hacks with a new file,
    gcc/config/picolibc.h which adjusts the LIB_SPEC, STARTFILE_SPEC
    and ENDFILE_SPEC values. Suggested by Sebastian Huber.

Keith Packard (3):
  Allow default libc to be specified to configure
  Add newlib and picolibc as default C library choices
  Add '--oslib=' option when default C library is picolibc

 gcc/config.gcc          | 66 +++++++++++++++++++++++++++++++++++------
 gcc/config/picolibc.h   | 32 ++++++++++++++++++++
 gcc/config/picolibc.opt | 26 ++++++++++++++++
 gcc/configure.ac        |  4 +++
 4 files changed, 119 insertions(+), 9 deletions(-)
 create mode 100644 gcc/config/picolibc.h
 create mode 100644 gcc/config/picolibc.opt