Re: Is there a way to distinguish binary files compiled with -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/7/21 9:28 PM, Peng Yu via Gcc-help wrote:
https://gcc.gnu.org/legacy-ml/gcc-patches/2004-09/msg02055.html

When I compile a .c file with -D_FORTIFY_SOURCE=1 and
-D_FORTIFY_SOURCE=2, the binary files both contain symbols like
..._chk@...

So I can not tell whether _FORTIFY_SOURCE is 1 or 2 just by whether
symbols have ..._chk@....

Is there a way to tell the difference only from the binary file?


_FORTIFY_SOURCE is a Glibc macro so the libc list is probably a better
source of information than this one.  I don't know of a GCC mechanism
to determine what level was used.  The macro and its definition might
be in the debug section in the .o file when compiling with -g3.

Martin



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux