Código
section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Hello, world!',0xa ;our dear string len equ $ - msg ;length of our dear string
Al compilar hago:
Código
debci@debci-laptop:~$ nasm -f elf test.asm debci@debci-laptop:~$ ld test.o -o test debci@debci-laptop:~$ gcc test.o -o test test.o: In function `_start': test.asm:(.text+0x0): multiple definition of `_start' /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o:/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:65: first defined here /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld devolvió el estado de salida 1 debci@debci-laptop:~$ ./test bash: ./test: No existe el fichero ó directorio debci@debci-laptop:~$ gcc test.o -o test test.o: In function `_start': test.asm:(.text+0x0): multiple definition of `_start' /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o:/build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:65: first defined here /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: ld devolvió el estado de salida 1 debci@debci-laptop:~$
Y no crea el ejecutable :s
Alguien sabe que me esta pasando?
Saludos