我尝试用汇编语言创建函数并将它们放在动态库中,因此我使用此命令创建带有.S的.o
nasm -f elf64 hello.S -o hello.o
但是当我想用gcc创建lib时:
gcc -fPIC -shared hello.o -o libasm.so
它会显示以下错误:
/usr/bin/ld: hello.o: relocation R_X86_64_PC32 against undefined symbol printf@@GLIBC_2.2.5 can not be used when making a shared object; recompile with -fPIC