From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by sourceware.org (Postfix) with ESMTPS id 481A43858D34 for ; Fri, 27 Aug 2021 17:52:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 481A43858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x732.google.com with SMTP id m21so8002690qkm.13 for ; Fri, 27 Aug 2021 10:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=4PvzH+bG4voFKOUz95ilUOWxVFn+C0OxJ20XvHfqgo8=; b=Qeitc+AzDk4K2WEy4E4uG5B46iWG6vxuw4rlj9dp1V6m7VO1TmEwh1c6rxQqr2qmD5 tfd5NVA8HigX7qvh1fuTNyKmYKxmDHGu168V5Z25mrERrM3A7ritdXifzp+4RKbVmKUY O+to5sBj0O5GW4EkZWRmEXvlyKJlBmr6V8NyGfvId30hhaBJOCVKvjWwqaSFYz97NYU1 NCy5cqS/377KEc2eldtF9j2Viv5E5oNVyq0OxeTzQzZ03elw4FEiptbHKpBfxO+Cm62H qTIToV7W16ddKjHiUzgWJ4GrpFUJyCqsYqjnI+i6vWHc9WDYPt0+OiBFf1Ep9jjx7qUN Likw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=4PvzH+bG4voFKOUz95ilUOWxVFn+C0OxJ20XvHfqgo8=; b=I4e4Dr3MPFU51G/ORz8puzg2xTgJM8N6WSVvWkYcFMsVLxyBkLx50NlHyOlD6ydkqY xbQUTbJd5WNtE9A7fRZceO3w4ft1/WtyR37i4w11vqZ+V2J+NrIDbQ7gbPfLFJr2KYRf 2LYsaAbXc8kzguIQC/MLvtoGG5ZbwDqCT3aqM+Bh182qCroqC03U0AJTZ+gCBqgm6qWV bPvyF1DLIncjBJ3LX42HdBmM4caT6etyA1E6CM3h4JGVV2jPEudXlDD5Jnj0ThW+v5OU cJ68Wf7bY+rjibzUu0217SQqANEmzpUAaFXR2Xl+FucTy7nGrFNgxoMHrjTEnFOlNmS/ +ooA== X-Gm-Message-State: AOAM531OSKYMIyR1xT0kBWPITzp7RYMjlFXQPVXZY1cSGK1+jtf7Mqni zMVKg4ZU5RuDSGk0Ns+TRu2QbBqFiYZmEFV5Zg9RgC5rmQ== X-Google-Smtp-Source: ABdhPJyrblD5B/bqjZ6oYDTYfFPdhkPiO4tRQyh3FxuYVTsHmDXLaQEEyfwwv8fB+LCTDruPWIqYUsGCf7bIqzvJuAw= X-Received: by 2002:a05:620a:983:: with SMTP id x3mr10317974qkx.151.1630086753834; Fri, 27 Aug 2021 10:52:33 -0700 (PDT) MIME-Version: 1.0 References: <20210825191245.30049-1-joel@rtems.org> In-Reply-To: From: C Howland Date: Fri, 27 Aug 2021 13:52:22 -0400 Message-ID: Subject: Re: [PATCH newlib 0/1] sys/signal.h needs sys/_intsup.h To: newlib@sourceware.org X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2021 17:52:35 -0000 On Fri, 27 Aug 2021 at 12:17, Joel Sherrill wrote: > > > On Fri, Aug 27, 2021, 10:12 AM C Howland wrote: > >> > >> > >> > ------------------------------ >> > *From:* Newlib >> on >> > behalf of Joel Sherrill >> > *Sent:* Friday, August 27, 2021 9:47 AM >> > *To:* Newlib >> > *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 >> > 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 >> , , , , , , >> , ,and .) > > > You have stdint.h in the allowed list. :) > > Oops, typo, sorry about that: signal.h is not in the list. OK, granted, a subset being used for that special purpose with freestanding then does need to support that, so knowing that list I had included becomes of more interest. (The references for it are the C standard section 4, or several paragraphs in the GCC manuals-search for freestanding.) 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 >> >