什么时候使用 .ARM.exidx [英] When is .ARM.exidx is used

查看:53
本文介绍了什么时候使用 .ARM.exidx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 mbxxx 目标开发 Contiki 2.7.在构建我的代码时,链接器抱怨 .ARM.exidx 和 .data 部分的重叠.在对链接器脚本 contiki-2.7/cpu/stm32w108/gnu-stm32w108.ld 进行了一些修补后,我通过替换解决了这个问题:

I am working on Contiki 2.7 with the mbxxx target. While building my code the linker complained about an overlap of .ARM.exidx and .data sections. After some tinkering around with the linker script contiki-2.7/cpu/stm32w108/gnu-stm32w108.ld I fixed the problem by replacing:

__exidx_start = .;
__exidx_end = .;

与:

.ARM.exidx : {
    __exidx_start = .;
    *(.ARM.exidx* .gnu.linkonce.armexidx.*)
    __exidx_end = .;
} >ROM_region

后来,当我尝试使用 objdump -h 查看其他一些示例应用程序的标头列表时,我没有找到这个特定的 .ARM.exidx 部分,但它存在于我的应用程序中.谷歌搜索 .ARM.exidx 使我发现它用于某些 c++ 异常处理.由于我的代码是纯 C 代码,为什么我的代码中会出现此部分?.ARM.exidx 一般什么时候出现在代码中,它的用途是什么?

Later when I tried to see the header listing of some other example applications by using objdump -h I did not find this particular .ARM.exidx section, while it is present in my application. Googling about .ARM.exidx led me to the fact that it is used for some c++ exception handling. Since my code is a pure C code, why is this section present on my code? When is generally .ARM.exidx present in a code and what is its utility?

====================================================================================

==================================================================================

不,我没有任何这样的编译器选项.我实际上正在使用 AxTLS api 并删除了证书处理代码并将其移植到 contiki.在进一步挖掘中,我发现 bigint 实现中有一个可疑的行为.简而言之……这里是 bigint.c 文件中的函数体:

Well no, I don't have any such compiler options. I am actually using the AxTLS api and ripped out the certificate handling code and ported it to contiki. On some further digging I found a fishy behaviour in the bigint implementation. To be brief... here is the body of a function from the bigint.c file:

static bigint *bi_int_multiply(BI_CTX *ctx, bigint *bia, comp b)
{
   int j = 0, n = bia->size;
   bigint *biR = alloc(ctx, n + 1);
   comp carry = 5;
   comp *r = biR->comps;
   comp *a = bia->comps;

   check(bia);

   /* clear things to start with */
   memset(r, 0, ((n+1)*COMP_BYTE_SIZE));


   do
   {
       long_comp tmp = *r + (long_comp)a[j]*b + carry;
   //    *r++ = (comp)tmp;              /* downsize */
       carry = (comp)(tmp >> COMP_BIT_SIZE);
   } while (++j < n);

  // *r = carry;
  bi_free(ctx, bia);

  return trim(biR);
}

如果注释掉的部分(r 变量赋值)未注释,则 .ARM.exidx 出现,否则不会出现!现在可以解释了吗???

if the commented out portions, (the r variable assignment) is uncommented, the .ARM.exidx thingy appears, otherwise it doesn't! Now can this be explained???

====================================================================================

==================================================================================

我没有发现在 alloc() 的实现中使用的任何异常.在代码的某个单独区域中使用了 2 个 alloca() 引用,我将其替换为 malloc()free(),但这也没有解决问题.alloc() 实现只调用 malloc()realloc()free()

I didn't find any thing out of the ordinary used in the implementation of alloc(). There were 2 references of alloca() used in some separate region of the code, which I replaced with malloc() and free(), but that didn't fix the problem either. alloc() implementation has only calls to malloc(),realloc() and free()

推荐答案

.ARM.exidx 是包含用于展开堆栈的信息的部分.如果您的 C 程序具有打印堆栈回溯的函数,则这些函数很可能取决于此部分是否存在.

.ARM.exidx is the section containing information for unwinding the stack. If your C program has functions that print out a stack backtrace, the functions will likely depend on this section being present.

也许可以在编译器选项中查找 -funwind-tables-fexceptions 标志.

Maybe look for a -funwind-tables or -fexceptions flag in your compiler options.

这篇关于什么时候使用 .ARM.exidx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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