You copied the Doc URL to your clipboard.

--execstack, --no_execstack

Forces the linker to use either an executable stack or a non-executable stack.


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.

Related reference