Why the cplusplus doesn't support -D_FORTIFY_SOURCE
Yingchun Li via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CADkvYHG7_nbdR23Smm8JrBtCT2a=sMhhZ0FPN60y3Y-OMyMOgg@mail.gmail.com> |
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