I have a problem, I can't compile my strdup while calling malloc. When I don't call malloc, it compiles my shared library perfectly, so if someone could help me that would be great !
here is my code:
BITS 64
DEFAULT REL
global my_strdup:function
extern malloc
my_strdup:
[...]
call malloc
I compile with this:
$> nasm -f elf64 my_strdup.S
$> gcc -shared -o libmy.so my_strdup.o
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: my_strdup.o: relocation R_X86_64_PC32 against undefined symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status
I have this error. I don't understand it ! I have a 64bit computer. It is the first time I try Assembly.
Thanks !