LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Using JWASM and /usr/bin/LD in ubuntu 10.10 (https://www.linuxquestions.org/questions/programming-9/using-jwasm-and-usr-bin-ld-in-ubuntu-10-10-a-841667/)

centurion-21 10-31-2010 02:09 PM

Using JWASM and /usr/bin/LD in ubuntu 10.10
 
Dear People using JWASM,
I got the same error as above unable to find _start when I called the linker and it was caused by putting an underscore on the definition of the start label i.e. using _start: instead of using start:
Quote:

;Helloworld.asm date 31 Oct 2010
;jwasm -elf -Fo helloworld.o helloworld.asm
;/usr/bin/ld -o ./helloworld ./helloworld.o

.486
.model flat,c
option casemap:none
public start
;include ./include/jwasm.inc
stdout equ 1
SYS_EXIT equ 1
SYS_WRITE equ 4
.data

string db "Hello, world!",10

.code
start:

call main

mov eax, SYS_EXIT
int 80h
ret
main proc
mov ecx, offset string
mov edx, sizeof string
mov ebx, stdout
mov eax, SYS_WRITE
int 80h
ret
main endp

end start

END
The above is the sample code for helloworld.asm
try it out with the jwasm compiler for linux and ld which is in /usr/bin/ld

I found the error by looking at the object table with the command

objdump -hrt helloworld.o and that showed that start was being given an underscore at some point by the assembler when producing the object file helloworld.o


All times are GMT -5. The time now is 02:29 PM.