为什么 "strip" 不删除这些调试符号?

Why doesn't "strip" remove these debug symbols?

我有一个简单的汇编文件main.s,其中包含:

mysymbol1=1234

我assemble使用以下命令将其放入目标文件中:

$ arm-none-eabi-as main.s -o main.o

现在我检查符号table

$ arm-none-eabi-objdump -t main.o

main.o:     file format elf32-littlearm

SYMBOL TABLE:
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
000004d2 l       *ABS*  00000000 mysymbol1
00000000 l    d  .ARM.attributes    00000000 .ARM.attributes

我注意到 d 表示包含调试符号,所以我 运行:

$ arm-none-eabi-strip --strip-debug main.o

Re-运行ning objdump 显示调试符号没有被删除,尽管它们已经被重新排序:

$ arm-none-eabi-objdump -t main.o

main.o:     file format elf32-littlearm

SYMBOL TABLE:
000004d2 l       *ABS*  00000000 mysymbol1
00000000 l    d  .text  00000000 .text
00000000 l    d  .data  00000000 .data
00000000 l    d  .bss   00000000 .bss
00000000 l    d  .ARM.attributes    00000000 .ARM.attributes

为什么不删除调试符号?

.text.data.bss 不是调试符号 - 它们是内核用来正确执行它的文件段。 mysymbol1 来自静态符号 table,因此不是 debuginfo 的一部分,因此它也不会在 --strip-debug 下被剥离。