Before starting, I want to denote that it's my first post here so if I made any mistake that violates forum rules, apologizes.
Well, I need to handle a very simple task yet my lack of knowledge about assembly programming prevents me to achieve. But I need to solve and understand this to continue to learning so here it is.
I got a c code without main, but only a function definition.
#include <stdio.h>
extern void hello_world();
void hello_world(){
printf("Hello World!");
}
And I need to call it within assembly. There'r many examples around web including here like
this. But I wont take any arguments I just need to call it and see it working. I coded this which is not working
section .data
section .text
global _start
global main
extern hello_world
_start :
call main
mov eax,1
int 80h
main :
;push ebp
;mov ebp, esp
call hello_world
;pop ebp
ret
My terminal commands are
gcc -c callee.c
nasm -f elf caller.asm
ld -s -o call callee.o caller.o -lc -I/lib/ld-linux.so.2
./call
All works without error but nothing happens. I'm trying to understand concept so I would come up with more questions
Thanks in advance.