On 3/17/20 6:16 PM, Jeffrey Walton via Gcc-help wrote:
On Tue, Mar 17, 2020 at 8:11 PM Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
On Tue, 17 Mar 2020 at 22:15, Jeffrey Walton via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
I'm trying to test for availability of _FORTIFY_SOURCE=2.
What does that mean?
I'm trying to determine if the compiler supports FORTIFY_SOURCE.
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.
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.
Martin