armcc中.arm.extab条目的结构是什么? [英] What's the structure of .arm.extab entry in armcc?
问题描述
我正在尝试准确了解异常表 (.arm.extab) 的工作原理.我知道这取决于编译器,因此我将自己限制在 armcc(因为我使用的是 Keil).
I'm trying to understand exactly how the exception table (.arm.extab) works. I'm aware that this is compiler dependent, so i'll restrict myself to armcc (as i'm using Keil).
表中的典型条目如下所示:b0aa0380 2a002c00 01000000 00000000
A typical entry in the table looks something like: b0aa0380 2a002c00 01000000 00000000
据我所知,第一个字为个性例程编码指令,而第三个字是将 R_ARM_PREL31 重定位到 catch 块的开头.
To my understanding, the first word encodes instructions for the personality routine, while the third word is a R_ARM_PREL31 relocation to the start of the catch block.
让我感到困惑的是第二个词——它似乎被分成了两条短裤,第二条距离投掷功能的开始有一段距离,但我不确定到底是什么(也不确定第一条短裤是什么是).
What baffles me is the second word - it appears to be split into 2 shorts, the second of which measures some distance from the start of the throwing function, but i'm not sure exactly to what (nor what the first short does).
是否有任何地方记录了这些条目的结构?
Is there any place where the structure of these entries is documented?
我找到了 2 个相关文档,但据我所知,它们没有与编译器相关的信息,因此它们还不够:http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdfhttp://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
Iv'e found 2 relevant documents, but as far as I can see they have no compiler-dependent information, so they're not sufficient: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
推荐答案
如果您碰巧错过了字节顺序,则以下适用.即使原始示例中的字节顺序正确,某些信息也可能有用.
If you happen to have the byte ordering missed up, the below applies. Some information is probably useful even if the byte-order is correct in your original example.
extab
和 exidx
是 AAPCS 添加的部分,它是一个较新的 ARM ABI.
extab
and exidx
are sections added by the AAPCS which is a newer ARM ABI.
对于较旧的 APCS,帧指针或 fp
是活动例程链接回主例程(或 _start)的根.使用 AAPCS 创建记录并将其放置在 exidx
和 extab
部分.当 fp
用作通用寄存器时,需要这些来展开堆栈(和资源).
For the older APCS, the frame pointer or fp
is a root of a linked of the active routine back to the main routine (or _start). With AAPCS records are created and placed in the exidx
and extab
sections. These are needed to unwind stacks (and resources) when the fp
is used as a generic register.
exidx
是例程起始地址和extab
索引(或无法展开)的有序表.一个PC
(程序计数器)可以通过表格进行检查和搜索,以找到相应的extab
条目.
The exidx
is an ordered table of routine start addresses and an extab
index (or can't unwind). A PC
(program counter) can be examined and search via the table to find the corresponding extab
entry.
ARM EHABI 文档有关于异常处理表条目的第 6 节.这些是 extab
条目,您至少可以从那里开始以了解更多信息.有两个定义,
The ARM EHABI documentation has a section 6 on Exception-handling Table entries. These are extab
entries and you can at least start from there to learn more. There are two defined,
- 通用(或 C++)
- ARM 紧凑型
compact 模型将用于大多数C"代码.与 C++ 一样,堆栈上没有要销毁的对象.十六进制 8003aab0
给出,
The compact model will be used for most 'C' code. There are no objects to be destroyed on the stack as with C++. The hex 8003aab0
gives,
1000
b 用于前导半字节,所以这是紧凑的.0000
b 为索引.Su16——简短03
h - 弹出 16 个字节,一些局部或填充.aa
h - 弹出 r4-r6b0
h - 完成
1000
b for the leading nibble, so this is compact.0000
b for the index. Su16—Short03
h - pop 16 bytes, some locals or padding.aa
h - pop r4-r6b0
h - finish
表4,ARM定义的帧展开指令给出了每个字节的展开数据.
Table 4, ARM-defined frame-unwinding instructions gives the unwinding data of each byte.
下一个是0x002c002a
,它是通用个性例程的偏移量.接下来的四个值应该是 8.2 Data Structures,它们是一个大小并且应该为零......接下来是步幅,然后是一个四字节的对象类型信息.偏移量 0x2c002a 将调用对象析构函数或某种包装器来执行此操作.
The next is 0x002c002a
which is an offset to the generic personality routine. The next four values should be the 8.2 Data Structures, which are a size and should be zero... Next would be stride and then a four byte object type info. The offset 0x2c002a would be to call the objects destructor or some sort of wrapper to do this.
我认为所有 C++ 代码都打算使用这种通用方法.其他方法适用于不同的语言和不是编译器.
I think all C++ code is intended to use this Generic method. Other methods are for different languages and NOT compilers.
相关问答和链接:
- Arm exidx - 关于 exidx.
- ARM 链接和帧指针 - 旧版 APCS 和许多 AAPCS 的情况功能.
- Linux ARM Unwind - 'C' 的示例展开代码.
- prel31 - 上面 Linux 代码中关于 prel31 的问答.
- 在 ARM gnu 汇编程序中生成展开
- gas ARM 指令 请参阅:
.cantunwind
、.vsave
等
- Arm exidx - about the exidx.
- ARM link and frame pointer - situation for older APCS and many AAPCS functions.
- Linux ARM Unwind - sample unwinding code for 'C'.
- prel31 - SO Q/A on prel31 in Linux code above.
- Generating unwind in ARM gnu assembler
- gas ARM directives See:
.cantunwind
,.vsave
, etc.
这篇关于armcc中.arm.extab条目的结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!