how can I build/test asm entries on win32 system?

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)

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?

This forum is mainly concerned with topics related to competitive programming. I would suggest you post it on some other relevant forum

Please explain why asking a question about making a competition entry to codechef is not relevant on the codechef forum.

I don’t see any significant difference between my question and most of the ones on here other than it being about assembly.

if you don’t know the answer - leave it open in case someone who knows more than you is able to help.

1 Like