global variables?

Nic Reveles nreveles4 at hotmail.com
Fri May 26 23:08:40 PDT 2006


I'm not sure if this counts as a bug or not... I am very new to assembly.

hello_world.asm
---------------------------------
section .data
        string db "Hello World!", 10
        length equ $-string

section .text
global _start

_start:

        ; print out our string
        mov eax, 4                      ; "write" system call
        mov ebx, 1                      ; 1 = to the screen
        mov ecx, string                 ; string to print out
        mov edx, length                 ; length of string
        int 80h                         ; give all of this to the kernel

        ; terminate the program
        mov eax, 1                      ; "exit" system call
        mov ebx, 0                      ; return 0 (error code)
        int 80h
------------------------------------------------------------

I copied this from a website teaching Unix assembly in comparison with dos 
assembly.

yasm -m amd64 -o hello_world hello_world.asm
hello_world.asm:8: warning: binary object format does not support global 
variables

It will compile if I remove the "global _start" line, but then when I 
execute it:

$ ./hello_world
./hello_world: 1: Syntax error: word unexpected (expecting ")")


I'm having trouble finding examples, so I appologize if this is not a bug, 
but just a stupid mistake.

Nic

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the bug-yasm mailing list