Hot to test for _FORTIFY_SOURCE with Autoconf
Wed Mar 18 22:21:00 GMT 2020
On Tue, Mar 17, 2020 at 6:49 PM Martin Sebor via Gcc-help
> > On Tue, Mar 17, 2020 at 8:11 PM Jonathan Wakely <firstname.lastname@example.org> wrote:
> > I think it is related to object size checking.
> In GCC 10 you can test __has_builtin (__builtin_object_size). In GCC
> versions that don't support __has_builtin using __builtin_object_size
> will either compile or not, depending on whether it's supported. It
> doesn't depend on any macros.
That is a good way to test if the compiler has object size checking
support, but it is no guarantee that the C library has FORTIFY_SOURCE
support. If it is fortify source support that you need, then you need
to explicitly check for that. If it is just the object size checking
support you need, then you can do the check this way.
More information about the Gcc-help