Why the cplusplus doesn't support -D_FORTIFY_SOURCE

Yingchun Li sword.l.dragon@gmail.com
Mon Aug 24 07:14:40 GMT 2020


Sorry, My previous post
https://sourceware.org/pipermail/newlib/2020/017909.html
shows the  wrong format, sorry for that.
Now post it again.

In the sys/features.h, the "__SSP_FORTIFY_LEVEL" will not be defined when
the source file is cplusplus.
#if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__)
&& \   (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4,
1)
#  if _FORTIFY_SOURCE > 1
#    define __SSP_FORTIFY_LEVEL 2#  else#    define __SSP_FORTIFY_LEVEL 1
#  endif
#else
#  define __SSP_FORTIFY_LEVEL 0
#endif
So, if defined cplusplus, the __SPP_FORTIFY_LEVEL is always 0.My question is why
disable this feature,  if enable this feature forcely, is there any
possible issue?

Br,Yingchun


More information about the Newlib mailing list