armcc中.arm.extab条目的结构是什么? [英] What's the structure of .arm.extab entry in armcc?

查看:897
本文介绍了armcc中.arm.extab条目的结构是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图确切地了解异常表(.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.

让我感到困惑的是第二个单词-它似乎被分成2个短裤,第二个短裤与投掷功能开始时有一定距离,但是我不确定到底是什么(第一个短裤也不是什么)确实).

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.pdf http://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.

extabexidx是由AAPCS(较新的ARM ABI)添加的部分.

extab and exidx are sections added by the AAPCS which is a newer ARM ABI.

对于较旧的APCS,帧指针或fp是活动例程回到主例程(或_start)的链接的根.使用AAPCS可以创建记录并将其放置在exidxextab部分中.当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,

  1. 通用(或C ++)
  2. 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-pop r4-r6
  • b0 h-完成
  • 1000b for the leading nibble, so this is compact.
  • 0000b for the index. Su16—Short
  • 03h - pop 16 bytes, some locals or padding.
  • aah - pop r4-r6
  • b0h - finish

表4,ARM定义的帧展开指令给出了每个字节的展开数据.

Table 4, ARM-defined frame-unwinding instructions gives the unwinding data of each byte.

下一个是0x002c002a,它是通用人格常规的偏移量.接下来的四个值应该是 8.2数据结构,该大小是大小并且应该为零...接下来是跨步,然后是四个字节的对象类型信息.偏移量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 ++代码都打算使用此 Generic 方法.其他方法适用于不同的语言和 NOT 编译器.

I think all C++ code is intended to use this Generic method. Other methods are for different languages and NOT compilers.

相关的问与答和链接:

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆