我有一个汇编文件,如下所示。它只有几个函数,一旦编译,我只希望这些函数在二进制文件中。
#include <arm.h>
.section vectors
reset: ldr pc, =entry
undefined: b undefined
swi: b swi
prefetch_abort: b prefetch_abort
data_abort: b data_abort
reserved: b reserved
interrupt_request: b irq
fiq: b fiq
irq:
.text
entry: mov sp, #stack_address
bl init
.end
但是当我编译它时,NM 揭示了这一点。它有一些多余的变量。
00000000 t reset
00000004 t undefined
00000008 t swi
0000000c t prefetch_abort
00000010 t data_abort
00000014 t reserved
00000018 t interrupt_request
0000001c t fiq
00000020 t irq
0000002c T init
00000040 T main
00008024 t entry
00080000 N _stack
a0000000 D __data_start
a0000000 D a
a0000004 D b
a0000008 D __bss_end__
a0000008 D __bss_start
a0000008 D __bss_start__
a0000008 D __end__
a0000008 D _bss_end__
a0000008 D _edata
a0000008 D _end
为什么 gcc 会在我的代码中插入不必要的变量,例如data_start、__bss_end、__bss_start 等?