Here is my issue, I try to create an assembly function library and use it with a C program. I run into an undefined reference error.
I use xubuntu on a vm, provided by school for this project (so I guess everything is well setup...)
Assembly file (ft_function.s)
section .text
global _ft_function
_ft_function:
mov rax, 42
ret
C file (main.c)
extern int ft_function(char const *str);
int main()
{
return (ft_function("abc"));
}
For now as the issue persists I don't create the library, to reduce everything the most simple situation, so I generate the object files, then link them with clang.
nasm -f elf64 ft_function.s -o ft_function.o
clang -c main.c
clang ft_function.o main.o
main.o: In function `main':
main.c:(.text+0x1a): undefined reference to `ft_function'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks for your help ! Cheers !