To support non-executable stacks, the linker generates the
appropriate PT_GNU_STACK
program header when
you specify either:
--sysv
--arm_linux
, because this option implies--sysv
.
The linker derives the executable status of the stack from
the presence of the .note.GNU-stack
section in
input objects:
If any of the input objects does not contain a
.note.GNU-stack
section, the linker assumes the final image requires an executable stack.If no input object has a
.note.GNU-stack
section then the linker does not generate a PT_GNU_STACK program header.If at least one object has a
.note.GNU-stack
then the linker generates a PT_GNU_STACK program header. It is marked non-executable if all input objects have a.note.GNU-stack
section that is non-executable. In all other cases the program header is marked executable.
To override the choice made by the linker, use:
--execstack
to force the use of an executable stack--no_execstack
to force the use of a non-executable stack.
- Reference