Hot to test for _FORTIFY_SOURCE with Autoconf

Segher Boessenkool
Thu Mar 19 00:06:26 GMT 2020

On Wed, Mar 18, 2020 at 03:17:27PM -0700, Jim Wilson wrote:
> On Tue, Mar 17, 2020 at 5:16 PM Jeffrey Walton via Gcc-help
> <> wrote:
> > When _FORTIFY_SOURCE=2 is used, *_chk functions are used when the
> > compiler can determine the destination buffer size. Effectively the
> > compiler inserts those Microsoft safer functions that the libc folks
> > rejected.
> Then that is how you test for it in a configure script.  Just write a
> trivial program that will generate a call to a *_chk function if
> _FORTIFY_SOURCE=2 is supported, compile it, and then check for that,
> either by greping the assembly source or running nm on the object
> file.

glibc itself uses



More information about the Gcc-help mailing list