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 > <gcc-help@xxxxxxxxxxx> 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 #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 1 Segher