public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: [PATCH alternative] newlib: ignore _FORTIFY_SOURCE when building newlib
Date: Fri, 12 Nov 2021 11:28:51 +0100	[thread overview]
Message-ID: <YY5B4w5OZFi3fyaE@calimero.vinschen.de> (raw)
In-Reply-To: <20211109025906.26204-1-vapier@gentoo.org>

On Nov  8 21:59, Mike Frysinger wrote:
> Some distros enable _FORTIFY_SOURCE by default which upsets building
> newlib which itself implements the logic for this define.  For example,
> building gets.c fails because the includes set up a gets() macro which
> expands in the definition.
> 
> Since newlib isn't prepared to build itself with _FORTIFY_SOURCE, and
> it's not clear if it's even useful, ignore it when building the code.
> This also matches what glibc is doing.
> ---
> NB: This is an alternative approach instead of passing -U_FORTIFY_SOURCE.
> I think the -U approach is better, but throwing this up for discussion.
> 
>  newlib/libc/include/sys/features.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
> index 2188071785f6..6b4999e83482 100644
> --- a/newlib/libc/include/sys/features.h
> +++ b/newlib/libc/include/sys/features.h
> @@ -320,7 +320,8 @@ extern "C" {
>  #endif
>  
>  #if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \
> -   (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1)
> +   (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1) && \
> +   !defined(_COMPILING_NEWLIB)
>  #  if _FORTIFY_SOURCE > 1
>  #    define __SSP_FORTIFY_LEVEL 2
>  #  else
> -- 
> 2.33.0

I like this one more.  Most people have no problems to look into
source, but many shy away from the convoluted build system.


Thanks,
Corinna


  reply	other threads:[~2021-11-12 10:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  2:56 [PATCH] newlib: undefine _FORTIFY_SOURCE Mike Frysinger
2021-11-09  2:59 ` [PATCH alternative] newlib: ignore _FORTIFY_SOURCE when building newlib Mike Frysinger
2021-11-12 10:28   ` Corinna Vinschen [this message]
2021-11-09  3:15 ` [PATCH] newlib: undefine _FORTIFY_SOURCE Keith Packard
2021-11-09 11:41   ` Corinna Vinschen
2021-11-10  2:07   ` Mike Frysinger

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=YY5B4w5OZFi3fyaE@calimero.vinschen.de \
    --to=vinschen@redhat.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).