From: Reid Wahl <nwahl@redhat.com>
To: Xi Ruoyao <xry111@xry111.site>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: -fno-builtin not preventing __builtin___snprintf_chk in gcc 11.2.0-19ubuntu1
Date: Sun, 21 Aug 2022 21:07:38 -0700 [thread overview]
Message-ID: <CAPiuu98bCs2y3_B93mPhFZnicaW1D2CNfZ-y0oYO8RmHOeaVjQ@mail.gmail.com> (raw)
In-Reply-To: <2351f99b1bc5bb8f120e132354b2580b5163916a.camel@xry111.site>
On Sunday, August 21, 2022, Xi Ruoyao <xry111@xry111.site> wrote:
> On Sun, 2022-08-21 at 19:39 -0700, Reid Wahl via Gcc-help wrote:
>
> For the title: -fno-builtin only prevents gcc to convert foo() to
> __builtin_foo(). If you write __builtin_foo() directly built-in will be
> used with or without -fno-builtin.
Right. I was trying to keep the title short, but the issue was that
snprintf() was being essentially replaced by __builtin___snprintf_chk()
when I thought -fno-builtin should prevent any automatic replacements by
__builtin_ function calls.
>
> The remaining discussion is not related to GCC anyway. _FORTIFY_SOURCE
> is a Glibc (not GCC) feature, and it's just enabled by default because
> the distro is *too* smart... I completely agree to add -
> D_FORTIFY_SOURCE when they build their .deb packages, but hard wiring
> this into GCC is just puzzling new users and causing them to wrongly
> believe this was a "feature" of vanilla GCC. To make things worse, many
> people use Ubuntu as their first Linux distro...
I wasn't aware of _FORTIFY_SOURCE when I sent my first email. I read about
__builtin___snprintf_chk() in the GCC documentation:
https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html
And I agree with you. Especially since no other distro is doing that AFAIK,
it's just confusing until you figure out what's going on. Even Debian
doesn't do it. We have Debian systems in the same testbed and there are no
errors there.
>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University
>
>
--
Regards,
Reid Wahl (He/Him)
Senior Software Engineer, Red Hat
RHEL High Availability - Pacemaker
next prev parent reply other threads:[~2022-08-22 4:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 0:53 Reid Wahl
2022-08-22 2:39 ` Reid Wahl
2022-08-22 3:03 ` Xi Ruoyao
2022-08-22 4:07 ` Reid Wahl [this message]
2022-08-22 8:41 ` Florian Weimer
2022-08-22 8:54 ` Reid Wahl
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=CAPiuu98bCs2y3_B93mPhFZnicaW1D2CNfZ-y0oYO8RmHOeaVjQ@mail.gmail.com \
--to=nwahl@redhat.com \
--cc=gcc-help@gcc.gnu.org \
--cc=xry111@xry111.site \
/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).