當前位置:
首頁 >
relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP
發布時間:2025/3/20
22
豆豆
生活随笔
收集整理的這篇文章主要介紹了
relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
linux下編譯匯編語言報錯:
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指令
結果:
參考文章:relocation R_X86_64_32S against `.data’ can not be used when making a shared object; recompile with -fPIC with gcc
總結
以上是生活随笔為你收集整理的relocation R_X86_64_32S against `.data‘ can not be used when making a PIE object; recompile with -fP的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux进程地址空间与进程内存布局详解
- 下一篇: C语言函数调用过程的汇编分析(停更)