I’ve written assembler for embedded systems (years ago) but I’m unfamiliar with building from asm on linux.
I’ve been trying to build the codechef sample solution for “TEST” in cygwin before trying anything of my own to make sure I’ll be able to test my own code when I write it.
With the sample code I’m getting an apparently clean build with no assembly or linking errors… but a segmentation fault at runtime.
my environment…
Jon D@JonD-PC ~
$ uname -a
CYGWIN_NT-6.1-WOW64 JonD-PC 1.7.11(0.260/5/3) 2012-02-24 14:05 i686 Cygwin
Jon D@JonD-PC ~
$ nasm -v
NASM version 2.08.02 compiled on Jul 12 2010
Jon D@JonD-PC ~
$ ld -v
GNU ld (GNU Binutils) 2.22.51.20111013
Jon D@JonD-PC ~
$ file /usr/bin/nasm
/usr/bin/nasm: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
What I’m doing…
Jon D@JonD-PC ~/prog/assembly/codechef
$ cat test.asm
---copy and pasted sample solution to TEST is in here---
---not repeated so I obey the rule about posting code---
Jon D@JonD-PC ~/prog/assembly/codechef
$ nasm -fwin32 test.asm -o test.o
Jon D@JonD-PC ~/prog/assembly/codechef
$ ld test.o -otest.exe
Jon D@JonD-PC ~/prog/assembly/codechef
$ file test.exe
test.exe: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows
Jon D@JonD-PC ~/prog/assembly/codechef
$ ./test
Segmentation fault
can anyone suggest a way of testing asm entries on windows or tell me how the judge is building the asm entries?