Hi.
I'm trying to use assembly code in a C application on OpenBSD AMD64.
I've got a segmentation fault on the first instruction of my assembly function: push rbp.
Here is my code:
main.c
void test(void);
void main(void)
{
test();
return;
}
test.asm
bits 64
global test
section .code
test:
push rbp ;<-Crash here
pop rbp
ret
makefile.mak
coptions=-c -Wall -Wno-uninitialized -Wno-strict-aliasing -Wno-write-strings -Wno-unused-result -Wno-missing-braces -O0 -g
test: \
main.o \
test.o
gcc \
main.o \
test.o \
-lpthread \
-lstdc++ \
-lm \
-g -Wl,-s -Wl,-Map,test.map -o./test \
main.o: main.c
gcc $(coptions) main.c -o./main.o
test.o: test.asm
nasm -g -f elf64 -O3 -o ./test.o test.asm
Can someone help me?
Antoine Guillon