public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Keith Packard <keithp@keithp.com>
Cc: Andrew Pinski <pinskia@gmail.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 0/3] picolibc: Add picolibc linking help
Date: Thu, 25 Aug 2022 15:16:58 +0800	[thread overview]
Message-ID: <CA+yXCZCzx=M_Ei8-BDA1Z4nnHLkqKzPMpntVLVy=xwRmHtqnhQ@mail.gmail.com> (raw)
In-Reply-To: <87a67ta14r.fsf@keithp.com>

I am thinking that maybe we should add
-mlibc=[newlib|newlib-nano|picolibc|unknown] option to bare-matel
toolchain, one reason is having an unify interface to select libc
implementation between clang/LLVM, spec file is a GCC specific stuff,
that cause very bad compatibility between GCC and clang/LLVM, and
having option to control that would be better since clang/LLVM don't
have those configure time option.

For linux toolchain, it uses -mbionic, -muclibc, -mglibc and -mmusl,
maybe we could also use an unify -mlibc= option for that?



On Thu, Aug 25, 2022 at 3:32 AM Keith Packard via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Andrew Pinski <pinskia@gmail.com> writes:
>
> (removing gcc@ as not appropriate for patch discussions)
>
> Thanks for reviewing my patches; I appreciate the time you have taken to
> think about this.
>
> > Why do you need to change the specs to support picolibc? Why not have
> > the library supply the specs file instead, like what is done for
> > newlib and libgloss?
>
> Several architectures do include support for newlib's libgloss in their
> gcc configuration today (i386, m32r, microblaze, nds32, pru, riscv and
> sh), so I wondered if it made sense to add support for picolibc's
> target-specific libraries as well.
>
> Picolibc does deliver a spec file fragment which implements this
> functionality, but that requires the addition of --specs=picolibc.specs
> to the gcc command line instead of being built-in to gcc itself. When
> creating an integrated toolchain using picolibc, it seems a bit odd to
> require an option for the toolchain to work.
>
> > What OS libraries are not included in libc? I trying to figure out why
> > this needs to be special cased here.
>
> As a general-purpose embedded C library, picolibc doesn't include any
> OS-specific code. Instead, it defines a limited subset of POSIX
> interfaces which are to be supplied by the target platform.
>
> Picolibc itself supplies sample implementations of these ABIs that can
> run on top of bare metal systems with semihosting support which are used
> while testing picolibc itself.
>
> This is similar to newlib's libgloss: the C library is built atop
> another library which needs to follow it in the linker command line for
> symbol resolution to work correctly. Making this work requires a change
> in the *lib spec file fragment.
>
> Adjusting the *lib fragment can either be done in an externally provided
> specs file, or built-in to gcc. Both of these mechanisms are present in
> the gcc ecosystem today, leading me to wonder whether the gcc community
> would be interested in having an integrated option available.
>
> --
> -keith

  reply	other threads:[~2022-08-25  7:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 18:04 Keith Packard
2022-08-24 18:04 ` [PATCH 1/3] picolibc: Allow default libc to be specified to configure Keith Packard
2022-08-24 18:04   ` [PATCH 2/3] picolibc: Add newlib and picolibc as default C library choices Keith Packard
2022-08-24 18:04     ` [PATCH 3/3] picolibc: Add '--oslib=' option when default C library is picolibc Keith Packard
2022-08-24 18:24 ` [PATCH 0/3] picolibc: Add picolibc linking help Andrew Pinski
2022-08-24 19:32   ` Keith Packard
2022-08-25  7:16     ` Kito Cheng [this message]
2022-08-25 17:38       ` Keith Packard
2022-09-02 12:36 ` Richard Sandiford
2022-09-03  6:02   ` Keith Packard
2022-09-03  6:07 ` Keith Packard
2022-09-03  6:07   ` [PATCH 1/3] Allow default libc to be specified to configure Keith Packard
2022-09-03  6:07   ` [PATCH 2/3] Add newlib and picolibc as default C library choices Keith Packard
2022-09-03  6:07   ` [PATCH 3/3] Add '--oslib=' option when default C library is picolibc Keith Packard
2022-11-21  7:11     ` Sebastian Huber
2023-02-05  7:10   ` [PATCH 0/3] picolibc: Add picolibc linking help (v3) Keith Packard
2023-02-05  7:10     ` [PATCH 1/3] Allow default libc to be specified to configure Keith Packard
2023-02-05  7:10     ` [PATCH 2/3] Add newlib and picolibc as default C library choices Keith Packard
2023-02-05  7:10     ` [PATCH 3/3] Add '--oslib=' option when default C library is picolibc Keith Packard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+yXCZCzx=M_Ei8-BDA1Z4nnHLkqKzPMpntVLVy=xwRmHtqnhQ@mail.gmail.com' \
    --to=kito.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=keithp@keithp.com \
    --cc=pinskia@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).