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 - nasm-2.09 changed __OUTPUT_FORMAT__ derivation
Summary: nasm-2.09 changed __OUTPUT_FORMAT__ derivation
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 1.2
Hardware: x86 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-24 09:36 UTC by Petr Pisar
Modified: 2011-02-24 09:41 UTC (History)
0 users

See Also:


Attachments
Fix (2.60 KB, patch)
2011-02-24 09:37 UTC, Petr Pisar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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