OS Linux compi 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Version nasm -v: NASM version 2.09.04 compiled on Feb 10 2011
---
When using nasm with the following construct
%if __BITS__ == 64
; 64 bit mode
%elif __BITS__ == 32
; 32 bit mode
%else
%fatal "#bits not supported"
%endif
everthing works fine for targets win(win32), win64, elf (elf32), elf64, meaning the correct number of bits is set, and the correct code is chosen (without any explicit BITS directive).
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -felf abc.asm
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -felf32 abc.asm
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -felf64 abc.asm
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -fwin abc.asm
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -fwin32 abc.asm
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -fwin64 abc.asm
However, when I try to do something like
user@compi /c/tmp
$ /c/opt/nasm/bin/nasm -M -fwin64 abc.asm
I get the error message
abc.asm:7: fatal: #bits not supported
Bug or feature?
In other words: how can I detect the number of bits, both in plain and in -M mode?
Thomas
test file
hmm, insteresting, thanks for report, will take a look as only get opportunity
Closed as being a feature
for some reason my prev comment gets lost. In short you need to pass -D__BITS__=32 (or 64) so nasm will know which mode you choose