If you create Linux executables the "regular way", you shouldn't have to use chmod - ld should create the file with the correct permissions.
nasm -f elf myfile.asm
ld -o myfile myfile.o
Add the "-g" switch to Nasm if you want "debug info" in the executable - helps gdb or ald to be a little "friendlier". If you *don't* want debug info, adding the "-s" switch to ld will produce a smaller file. You probably don't want to worry about "small" at this point - get it working first!
It's possible to use Nasm's "-f bin" output format to create an ELF executable directly, without use of a linker. You'll need to build the "elf header" by hand. Macros are available to assist with this - grab the "asmutils" package from
http://www.linuxassembly.org (other useful info available there, too!) In this case, you *will* need to use "chmod a+x" to make the file executable. Possible to do this for dos MZ and Windows PE files too, but it isn't a very "flexible" method. I'd suggest using a linker.
Source code intended for dos (or Windows) is unlikely to work under Linux, even if you get it to assemble and link - different interrupts! I'll post a simple-minded "hello world" to get you started. More examples at linuxassembly.org, in the "test" directory if you have the Nasm source, and at
http://groups.yahoo.com/group/linux-nasm-users in the "files" section...
Ignore the irate squawking from the Penguin :)
Best,
Frank
;---------------------
global _start ; inform linker
section .text
_start ; default entrypoint known to ld
nop ; parking space for gdb - not required
; but gdb likes to see a one-byte
; instruction first
mov eax,4 ; sys_write
mov ebx,1 ; STDOUT
mov ecx,msg ; buffer
mov edx,msg_len ; number of bytes to write
int 80h
mov eax,1 ; sys_exit
int 80h
section .data
msg db 'Hello, world',0Ah
msg_len equ $ - msg
;-------------------------------