【发布时间】:2014-02-23 12:17:24
【问题描述】:
使用 Clang/LLVM(arm-none-eabi 目标)编译简单的 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]
在测试 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}
1) 仅使用 C 函数时,是否仍要关闭 .ARM.exidx 部分,因为它们将始终被标记为“cantunwind”。
2) 无论如何要在链接期间剥离这部分? (gc 部分当然不起作用,因为这些表条目引用了正在使用的函数)
3) 为什么 arm-gcc 不创建此部分(嗯,如果您使用新的 lib、nano 等...但我使用和链接没有 std 库)
【问题讨论】:
-
我也很想把这个压扁 - 赏金!
-
这里就像蟋蟀...
标签: arm clang llvm bare-metal