ARM Technical Support Knowledge Articles

What compiler/linker options make a GNU-stack executable?

Applies to: DS-5, RealView Development Suite (RVDS)

Scenario

Since RVCT 4.0 build 697, a new feature for supporting GNU-stack has been added to the compiler, assembler and linker.

Answer

The compiler undocumented option --[no_]execstack causes the compiler to generate or not generate the .note.GNU-stack ELF section, marking the stack as executable or non-executable. If this option is not used then the .note section is not generated. Also --arm_linux implies --no_execstack.

The linker will derive executable status of the stack from the .note.GNU-stack sections in input objects, including library objects. For backwards compatibility, objects without the .note.GNU-stack are considered as needing executable stack, unless all input objects do not have this section. So if linking the following objects:

then armlink will set the FP_X flag for the PT_GNU_STACK segment in the resultant image, indicating an executable GNU-stack.
The above linker behaviour can be verified with the "--info execstack" option, for example:

Executable Stack Usage Information.

Some input objects have no executable stack information, assumed to require executable stack:
    main.o

To override the choice made by the linker, use:

More information about PT_GNU_STACK can be found at: http://sourceware.org/ml/binutils/2003-05/msg00741.html

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential