.note.GNU-stack section syntax

Peter Johnson peter at tortall.net
Mon Dec 18 09:03:10 PST 2006


On Mon, 18 Dec 2006, Charles Bailey wrote:
> In asm files designed to make elf object files I've come across use of a
> section such as:
>   section .note.GNU-stack
> I believe it is used to prevent an executable stack.
> This syntax works for nasm but not for yasm, for which this works:
>   section ".note.GNU-stack"
> Unfortunately, for nasm, this causes the quotes to appear in the section
> name in the output object file.

You're right, this is a compatibility bug.  I'll work on fixing this for 
the next Yasm release, but in the meantime you could use the preprocessor 
to detect which assembler is being used (from looking for the 
assembler-specific version defines) and change between the forms, e.g.

%ifdef __NASM_MAJOR__
section .note.GNU-stack
%else
section ".note.GNU-stack"
%endif

(or alternatively check for one of the Yasm defines such as 
__YASM_MAJOR__)

Peter


More information about the yasm-devel mailing list