public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Joel Sherrill <joel@rtems.org>
To: C Howland <cc1964t@gmail.com>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h
Date: Fri, 27 Aug 2021 11:16:56 -0500	[thread overview]
Message-ID: <CAF9ehCXAbkk0LB5dRuO3umL9t2wikYzyBHuG5pXX19Jq0uYk6A@mail.gmail.com> (raw)
In-Reply-To: <CANk6obSFWTmMV1N72vVSnYyDdJdL7r6b0P-rzNXb0-bQ7TqS5A@mail.gmail.com>

On Fri, Aug 27, 2021, 10:12 AM C Howland <cc1964t@gmail.com> wrote:

> >
> >
> > ------------------------------
> > *From:* Newlib <newlib-bounces+craig.howland=caci.com@sourceware.org> on
> > behalf of Joel Sherrill <joel@rtems.org>
> > *Sent:* Friday, August 27, 2021 9:47 AM
> > *To:* Newlib <newlib@sourceware.org>
> > *Subject:* Re: Fw: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h
> >
> >
> > On Fri, Aug 27, 2021 at 5:16 AM Corinna Vinschen <vinschen@redhat.com>
> > wrote:
> > >
> > > On Aug 26 18:28, Joel Sherrill wrote:
> > > > We recently added this to sys/signal.h:
> > > >
> > > > #if __STDINT_EXP(INT_MAX) > 0x7fff
> > > > #define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)
> > > > #else
> > > > #define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("65535") - 1)
> > > > #endif
> > > >
> > > > And -ffreestanding breaks that. I see two solutions:
> > > >
> > > > (1) Add __STDINT_EXP to gcc's stdint-gcc.h
> > > > (2) Switch that #if to something else
> > > >
> > > > I think something like this is an OK substitute works equivalently:
> > > >
> > > > #if __SIZEOF_INT__ > 2
> > >
> > > or even __SIZEOF_INT__ >= 4 to be extra *extra* paranoid, but yeah,
> > > sure, go ahead.  The commmit message should just briefly explain the
> > > freestanding implementation issue.
> >
> > Patch posted. Hopefully the commit message is clear enough.
> >
> > This one definitely is in the land of subtle small things.
> >
> > Thanks for the feedback and push to look for a deeper explanation.
> >
> > --joel
> >
> > >
> > > Corinna
> >
>
>  Just to close out the details on this more-esoteric subject:
> -ffreestanding is improper for using Newlib, so we don't need to account
> for it in general.  (A freestanding implementation may only use a subset of
> the library, and stdint.h is not one of that list--which in C11 is
> <float.h>, <iso646.h>, <limits.h>, <stdalign.h>, <stdarg.h>, <stdbool.h>,
> <stddef.h>, <stdint.h>,and <stdnoreturn.h>.)


You have stdint.h in the allowed list. :)

So the original is fine, but
> so is the tweak.
>

Better to avoid any dependency on something newlib specific in favor of
something gcc provides.

FWIW the freestanding option is used to compile the FreeBSD kernel code
RTEMS uses for tcpip, USB, etc. We are currently using about 4000 files
from them between the kernel and commands. I don't know the origin of using
that compile option but do know the FreeBSD kernel is guilty of using names
like malloc with different signatures.

--joel

Craig
>

  reply	other threads:[~2021-08-27 16:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25 19:12 Joel Sherrill
2021-08-25 19:12 ` [PATCH newlib 1/1] sys/signal.h: <sys/_intsup.h> is needed for __STDINT_EXP Joel Sherrill
     [not found] ` <DM3P110MB052286CA15662F2A669975A29AC69@DM3P110MB0522.NAMP110.PROD.OUTLOOK.COM>
2021-08-25 19:48   ` Fw: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h C Howland
2021-08-26 23:28     ` Joel Sherrill
2021-08-27 10:15       ` Corinna Vinschen
2021-08-27 13:47         ` Joel Sherrill
     [not found]           ` <DM3P110MB05221A305E6DAF45A77CCCAA9AC89@DM3P110MB0522.NAMP110.PROD.OUTLOOK.COM>
2021-08-27 15:12             ` C Howland
2021-08-27 16:16               ` Joel Sherrill [this message]
2021-08-27 17:52                 ` C Howland

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=CAF9ehCXAbkk0LB5dRuO3umL9t2wikYzyBHuG5pXX19Jq0uYk6A@mail.gmail.com \
    --to=joel@rtems.org \
    --cc=cc1964t@gmail.com \
    --cc=newlib@sourceware.org \
    /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).