[习题29]解决:relocation R_X86_64_32
作者:
AkuRinbu | 来源:发表于
2018-12-28 20:00 被阅读33次
问题解决
$ cc -shared -o libex29.so libex29.o
/usr/bin/ld: libex29.o: relocation R_X86_64_32 against `.rodata'
can not be used when making a shared object;
recompile with -fPIC
libex29.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
$ cc -fPIC -c libex29.c -o libex29.o
$ cc -shared -o libex29.so libex29.o
$ ls
dbg.h ex29.c libex29.c libex29.o libex29.so
参考资料
本文标题:[习题29]解决:relocation R_X86_64_32
本文链接:https://www.haomeiwen.com/subject/dgwelqtx.html
网友评论