为什么链接符号的语法错误

Why the syntax of linking symbols is error

我使用了 arm-none-eabi-ld (GNU ld (2.34-4ubuntu1+13ubuntu1) 2.34) 和 --just-symbols=symbolfile 其中包括以下符号。

a =0x00000050;
b =0x00000054;
c =0x00000058;
d =0x00001000;
e =0x00001004;
f =0x00001008;
g =0x00000060;
h =0x00000064;
i =0x00000068;
j =0x0000100c;
k =0x00001010;
l =0x00001014;   <--- line 12
m =0x0000005c;

如果我加了符号"l",会输出如下错误。

arm-none-eabi-ld:mcu1_.symtab: file format not recognized; treating as linker script
arm-none-eabi-ld:mcu1_.symtab:12: syntax error

不过没关系,如果我用--defsym l=0x00001014

我应该添加任何前缀吗?

答案隐藏在 GNU ld 文档中。 Symbol Names says: Unquoted symbol names must not conflict with any keywords. Sadly, there's no list of keywords. But, Section MEMORY Command 节说:关键字 LENGTH可能缩写为lenl.(还有一个索引条目l =。)显然,l是一个关键字。所以你可以写e。 G。 "l" = 0x00001014;.