使用gcc编译print.s时,我收到以下错误提示:
/usr/bin/ld: /tmp/cc45uyZj.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
我在另一个Linux发行版中尝试了相同的操作,它完美地运行了。
添加
-fPIC
也没有帮助。apt-get update也不行。如果你想看代码:https://github.com/NEGU93/Compilation.git 在Practice > Part1目录下。当我使用gcc编译所有.s文件时,都会出现类似的错误(顺便说一下,print.s是其中之一)。
我猜Kali发行版中缺少某些东西,但我不知道是什么。