我正在尝试使用 GCC gnu 编译器为项目编译一些 GAS 代码。这是我的编译方式:
gcc -c boot.s -o boot.o -fPIC
使用参数编译 kernel.c 文件后-fPIC
,我尝试将其与以下命令链接:
gcc -N -T linker.ld -o Slack\ Berry.bin -ffreestanding -nostdlib kernel.o boot.o -lgcc
它提出了:
/usr/bin/ld: boot.o: relocation R_X86_64_32 against '.multiboot' can not be used when making a PIE object; recompile with -fPIC
这让我认为它没有使用-fPIC
. 我怎样才能解决这个问题?