When is .ARM.exidx is used

╄→гoц情女王★ 提交于 2019-11-28 13:24:11

.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.

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

Adding to tangrs' response, if you gcc -v, you can dump the default options used during compilation.

All options (implicit & explicit) options of GCC are passed to cc1 program of GCC.

This feature is used in 'C'. The ARM APCS uses only a frame pointer to restore a stack. The newer AAPCS uses tables on occasion. Stack unwinding, signal handlers and other asynchronous 'C' features use these mechanism. For a bare metal embedded device it can be used to trace a stack. For instance, Linux's unwind.c uses both exidx and extab sections to do a stack trace.

Briefly the exidx is a sorted table of routine start addresses and an extab table index. A binary search through the exidx will find the corresponding extab entry. The extab entry has details about the stack in this routineNote1. It gives details about what the routine is storing on the stack.

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???

When you have the statement *r++ = (comp)tmp;, the compiler can not hold all the variables in registers and needs to use the stack (or at least fp). This causes it to emit and exidx and extab data.


There are some solutions. It is fine to discard both exidx and extab if you don't need stack tracing or asynchronous functionality. Simpler stack unwinding can be done with gnu tools/gcc using -mapcs-frame; then fp will always be used to store the previous stack frame (which stores its callers fp, etc). The actual tables are not that big and the routines to unwind are fairly simple. It maybe <3% overhead to have the tables which don't pollute the normal program path or use a register like -mapcs-frame. Desirable on Cortex-A cpus with cache and usually more memory.

Reference: ATPCS Link and frame pointer explained

Note1: This is after the prologue makes an adjustment to the stack.
Note2: The ex is for exception, but it is not solely for C++ exceptions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!