We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1152

Summary: nasm-2.09 changed __OUTPUT_FORMAT__ derivation
Product: SDL Reporter: Petr Pisar <ppisar>
Component: buildAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: x86   
OS: Linux   
Attachments: Fix

Description Petr Pisar 2011-02-24 09:36:07 UTC
While compiling SDL-1.2.14 with newer nasm (Hermes library in x86 assembler is embedded), I found the GNU-stack notice is missing resulting in library marked as requiring executable stack.

I discovered nasm-2.09 changed a way how output format argument (nasm -f elf) becomes a __OUTPUT_FORMAT__ macro used to conditionalize the GNU-stack section:

  %ifidn __OUTPUT_FORMAT__,elf
  section .note.GNU-stack noalloc noexec nowrite progbits
  %endif

Olde nasm defined __OUTPUT_FORMAT__ as `elf'. Version 2.09 defines it as `elf32' on x86:

  Short aliases \c{win}, \c{elf} and \c{macho} for output formats are
  introduced.  Each stands for \c{win32}, \c{elf32} and \c{macho32}
  accordingly.


Thus SDL compiled with newer nasm misses the section and linker assumes the stack is executable.
Comment 1 Petr Pisar 2011-02-24 09:37:56 UTC
Created attachment 588 [details]
Fix

This patch changes the `elf' format to `elf32' (as the code is used on x86 only). It can be compiled with old and with new nasm successfully. Also I believe it still works with yasm, as it supports `elf32' format too.
Comment 2 Sam Lantinga 2011-02-24 09:41:47 UTC
This fix is in, thanks!
http://hg.libsdl.org/SDL/rev/30e4d724fe98