relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP
生活随笔
收集整理的這篇文章主要介紹了
relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
linux下編譯匯編語(yǔ)言報(bào)錯(cuò):
relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIE代碼如下:
test.asm
global mainmain:mov ebx, 1mov ecx, 2add ebx, ecxmov [sui_bian_xie], ebxmov eax, [sui_bian_xie]retsection .data sui_bian_xie dw 0 dontla@dontla-virtual-machine:~/桌面/test$ nasm -f elf64 test.asm -o test.o dontla@dontla-virtual-machine:~/桌面/test$ gcc -m64 test.o -o test /usr/bin/ld: test.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit status解決辦法:
添加-no-pie指令
結(jié)果:
參考文章:relocation R_X86_64_32S against `.data’ can not be used when making a shared object; recompile with -fPIC with gcc
總結(jié)
以上是生活随笔為你收集整理的relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Linux进程地址空间与进程内存布局详解
- 下一篇: C语言函数调用过程的汇编分析(停更)