c - What is the -z option for in this gcc compiler command? -
the command:
gcc -fno-stack-protector -z execstack -o exitcode exitcode.c
i know need include-z execstack
code work, , have idea execstack
, allows me do. don't know -z
option doing here. i've looked , grep
'd @ gcc
, execstack
man pages , used --help
on both without finding straight answer. guessing enabling addition of execstack
functionality...?
in case -z execstack
-z passed directly on linker along keyword execstack.
source: https://gcc.gnu.org/onlinedocs/gcc/link-options.html#index-z-1241
about execstack
linux has in past allowed execution of instructions on stack , there lots of binaries , shared libraries assuming behaviour. furthermore, gcc trampoline code e.g. nested functions requires executable stack on many architectures. avoid breaking binaries , shared libraries need executable stack, elf binaries , shared libraries can marked requiring executable stack or not requiring it. marking done through p_flags field in pt_gnu_stack program header entry. if marking missing, kernel or dynamic linker need assume might need executable stack. marking done automatically recent gcc versions (objects using trampolines on stack marked requiring executable stack, other newly built objects marked not requiring it) , linker collects these markings marking of whole binary or shared library. user can override @ assembly time (through --execstack or --noexecstack assembler options), @ link time (through -z execstack or -z noexecstack linker options) , using execstack tool on linker binary or shared library. tool useful third party shared libraries known don't need executable stack or testing proves it.
source: http://linux.die.net/man/8/execstack
hope helps.
Comments
Post a Comment