【发布时间】:2018-11-13 23:47:32
【问题描述】:
我正在尝试使用 GCC gnu 编译器为项目编译一些 GAS 代码。这是我的编译方式:
gcc -c boot.s -o boot.o -fPIC
使用-fPIC 参数编译我的kernel.c 文件后,我尝试将其与以下命令链接:
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 编译我的 GAS 代码。我该如何解决这个问题?
【问题讨论】:
标签: gcc assembly gnu-assembler position-independent-code