Re: -fno-builtin not preventing __builtin___snprintf_chk in gcc 11.2.0-19ubuntu1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday, August 21, 2022, Xi Ruoyao <xry111@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> School of Aerospace Science and Technology, Xidian University
>
>

-- 
Regards,

Reid Wahl (He/Him)
Senior Software Engineer, Red Hat
RHEL High Availability - Pacemaker



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux