【发布时间】:2021-01-02 09:34:26
【问题描述】:
我正在使用RISC-V compiler,我需要将我的链接描述文件“变量”连接到汇编文件指令,例如:
在我的链接器脚本 (.ld) 中有这一行:
ENTRY(_start)
_estack = 0x1FFFC; /* end of RAM */
...
因此,我需要在我的 start.S 文件中创建一个汇编指令,如下所示:
li sp, _estack
我尝试了很多东西,比如:
.word _estack
# - or -
.global _estack
li sp, _estack
但它们似乎都不起作用,它会发出以下消息:
App/src/start.S: Assembler messages:
App/src/start.S:59: Error: illegal operands `li sp,_estack'
make: *** [build/start.o] Error 1
关于上下文,这是我的 start.S 文件:
.global _start
.section .text.prologue, "ax"
.word _estack
# .global _estack
_start:
li sp, _estack
jal ra, main
j _exit
_exit: j _exit
【问题讨论】:
-
为什么是 0x1FFFC 而不是 0x20000?你是在为某事保留最后的记忆吗?
标签: assembly linker linker-errors riscv