문제

Hello I have a linker script in which i found this code "__exidx_start = .;" which sets label value to the value of location counter ".". This label isn't used anywhere within the same linker script.

There is a similar label defined couple of lines below the first one and it is defined the same way "__exidx_end = .;".

These two labels are boundries of .text and .rodata sections, but i don't know why would anyone define those two if they aren't used in the linker script?

도움이 되었습니까?

해결책

These symbols are used internally by call-chain unwinding mechanism in GCC that takes control during exception handling phase. For instance, there is an example in unwind-arm-common.inc:104 where the boundaries of exception-handling table are obtained as pointers to these symbols.

As for .ARM.exidx*-entries that the symbols enclose, they form an exception-handling index table, which is a part of ARM Exception Handling ABI (in sect. 4.4.1) for C++.


Update 20.05.2020

Answering the question by @pixelou:
These sections are not related to debugging, but form a basis of exception unwinding mechanism. Stripping the the *.exidx* sections causes disability to clean the mess up forcing program to abort (fail completly) instead of accurate handling of invalid states on stack. Without that unwinding information a program behaves like if it's built with -fno-exceptions option.

다른 팁

They're not used in the linker script, but they are declared as extern variables and used in the gcc library. Take them out, and this is what happens:

.../gcc/config/arm/unwind-arm.c:614: undefined reference to `__exidx_start'
.../gcc/config/arm/unwind-arm.c:614: undefined reference to `__exidx_end'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top