Hallo,
ich möchte von Asm aus auf C-Funktionen zurückgreifen. Ich kann den Asm-Code auch arfolgreich assemblieren und linken - nur beim ausführen bekomme ich eine illegal hardware instruction. GDB gibt folgende Fehlermeldung aus:
Program received signal SIGILL, Illegal instruction.
0x00007ffff77eec16 in fprintf () from /lib/libc.so.6
Das GAS-Asm Programm (64-Bit):
.section .data
text: .ascii "Hello World!\n\0"
.section .text
.globl _start
_start:
pushq $text
call printf
addq $4, %rsp
pushq $0
call exit
Assemblieren und Linken:
as helloworld.s -o helloworld.o
ld --dynamic-linker /lib/ld-2.12.so `pkg-config --libs glib-2.0` helloworld.o -o helloworld
Kann mir jemand sagen warum das Programm nicht korrekt funktioniert?