LLVM(arm none eabi目标)正在为基于C的代码(?)生成arm.exidx部分

LLVM(arm none eabi目标)正在为基于C的代码(?)生成arm.exidx部分,arm,clang,llvm,bare-metal,Arm,Clang,Llvm,Bare Metal,使用Clang/LLVM(arm-none-eabi-target)编译一个简单的HelloWorld.c会产生一个重定位节'.rel.arm.exidx',但使用arm-gcc不会。这些LLVM生成的展开表条目被正确标记为canunwind。但是,为什么它们根本就不需要,只是在AXF中的每个C函数都有一个条目时导致膨胀呢 readelf edxidx from HelloWorld.o Relocation section '.rel.ARM.exidx' at offset 0x580 c

使用Clang/LLVM(arm-none-eabi-target)编译一个简单的HelloWorld.c会产生一个重定位节'.rel.arm.exidx',但使用arm-gcc不会。这些LLVM生成的展开表条目被正确标记为canunwind。但是,为什么它们根本就不需要,只是在AXF中的每个C函数都有一个条目时导致膨胀呢

readelf edxidx from HelloWorld.o 
Relocation section '.rel.ARM.exidx' at offset 0x580 contains 2 entries:
Offset     Info    Type            Sym.Value  Sym. Name
00000000  00000b2a R_ARM_PREL31      00000000   .text
00000008  00000b2a R_ARM_PREL31      00000000   .text
Unwind table index '.ARM.exidx' at offset 0xcc contains 2 entries:
0x0 <print_uart0>: 0x1 [cantunwind]
0x54 <c_entry>: 0x1 [cantunwind]
HelloWorld.o中的readelf-edxidx
偏移量0x580处的重新定位节“.rel.ARM.exidx”包含2个条目:
偏移信息类型符号。值符号。名称
00000000 00000b2a R_ARM_PREL31 00000000。文本
0000000 8 00000 B2A R_ARM_PREL31 00000000。文本
在偏移量0xcc处展开表索引“.ARM.exidx”包含2个条目:
0x0:0x1[无法展开]
0x54:0x1[无法展开]
在测试Clang默认值时:如果我将“-funwind tables”传递给Clang以强制对C函数展开,那么我得到了我在编写时所期望的结果。cpp函数和“-fno unwind tables”的结果与上面相同

Relocation section '.rel.ARM.exidx' at offset 0x5a4 contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000000  00000b2a R_ARM_PREL31      00000000   .text
00000000  00001600 R_ARM_NONE        00000000   __aeabi_unwind_cpp_pr0
00000008  00000b2a R_ARM_PREL31      00000000   .text
00000008  00001600 R_ARM_NONE        00000000   __aeabi_unwind_cpp_pr0
Unwind table index '.ARM.exidx' at offset 0xcc contains 2 entries:
0x0 <print_uart0>: 0x8001b0b0
  Compact model index: 0
  0x01      vsp = vsp + 8
  0xb0      finish
  0xb0      finish
0x54 <c_entry>: 0x809b8480
  Compact model index: 0
  0x9b      vsp = r11
  0x84 0x80 pop {r11, r14}
偏移量0x5a4处的“
relation section”.rel.ARM.exidx”包含4个条目:
偏移信息类型符号。值符号。名称
00000000 00000b2a R_ARM_PREL31 00000000。文本
00000000 000011600 R_臂_无00000000_aeabi_展开_cpp_pr0
0000000 8 00000 B2A R_ARM_PREL31 00000000。文本
0000000 8 000011600 R_臂_无00000000_aeabi_展开_cpp_pr0
在偏移量0xcc处展开表索引“.ARM.exidx”包含2个条目:
0x0:0x8001B0
紧凑型模型索引:0
0x01 vsp=vsp+8
0xb0完成
0xb0完成
0x54:0x809b8480
紧凑型模型索引:0
0x9b vsp=r11
0x84 0x80 pop{r11,r14}
1) 当只使用C函数时,是否仍然可以关闭.ARM.exidx部分,因为它们将始终标记为“cantundwind”

2) 是否在链接过程中删除此部分?(由于这些表格条目引用了正在使用的函数,gc部分将不工作)

3) 为什么arm gcc不创建此部分(如果您使用新的lib、nano等,它会创建此部分,但我使用并链接没有std libs)

我将回答(2),因为我就是这么做的。添加到链接器脚本:

/DISCARD/ :
{
    *(.ARM.exidx)
}

我也很想把这个压扁-慷慨!这就像这里的蟋蟀……如果能用a-fno例外来抑制它,那就太好了