S
Sir Auron
Routinier
Hi!
Also ich habe folgenden Assembler code:
Ich assembliere ihn:
Doch nun kommt das Komische, Ich linke ihn:
Was mache ich falsch? Warum kann ich das Programm nicht per ld linken?
Danke
Sir Auron
Also ich habe folgenden Assembler code:
Code:
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello
SECTION .TEXT
GLOBAL main
main:
; Write 'Hello world!' to the screen
mov eax,4 ; 'write' system call
mov ebx,1 ; file descriptor 1 = screen
mov ecx,hello ; string to write
mov edx,helloLen ; length of string to write
int 80h ; call the kernel
; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ; call the kernel
Ich assembliere ihn:
Code:
nasm -f elf hello.asm
Doch nun kommt das Komische, Ich linke ihn:
Code:
ld -s -o hello hello.o
./hello
Speicherzugriffsfehler
Code:
gcc hello.o -o hello
./hello
Hello world!
Was mache ich falsch? Warum kann ich das Programm nicht per ld linken?
Danke
Sir Auron