Use of .eh_frame_hdr, .eh_frame & .gcc_except_table in Linker Script.
PRASANTH RAJAGOPAL
prasanthris@gmail.com
Wed Jul 6 20:15:00 GMT 2011
Thanks Ian - that's a lot of detailed explanation..
If I understand correctly - I will need it only for C++ exception
handling cases and it is irrespective of whether Standalone or Linux
toolchain. Please correct me if I am wrong...If I were to write a C
code, I would not need those sections?
Thanks
On Thu, Jul 7, 2011 at 1:05 AM, Ian Lance Taylor <iant@google.com> wrote:
> PRASANTH RAJAGOPAL <prasanthris@gmail.com> writes:
>
>> I am trying to explore GCC Linker Script as much as possible. I do not
>> know anything about ELF , DWARF or STAB (newbie to all that). Now, I
>> have a default Linker script for Bare Metal ELF toolchain, where I am
>> trying to understand the usage of the below sections:
>>
>>
>> .eh_frame_hdr : { *(.eh_frame_hdr) } >MEM_L1_DATA_A
>> .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A
>> .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
>> .gcc_except_table.*) } >MEM_L1_DATA_A
>> /* Adjust the address for the data segment. We want to adjust up to
>> the same address within the page on the next page up. */
>> . = ALIGN(0x1000) + (. & (0x1000 - 1));
>> /* Exception handling */
>> .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } >MEM_L1_DATA_A
>> .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table
>> .gcc_except_table.*) } >MEM_L1_DATA_A
>>
>>
>> What is the importance of eh_frame_hdr , eh_frame sections,
>> .gcc_except_table and why are they written with different Read / Write
>> properties. Again my toolchain is pure bare metal, so do I really need
>> those?
>> Where can I find a high level explanation of what they mean and their use?
>
> Coincidentally, I just posted that.
>
> http://www.airs.com/blog/archives/460
> http://www.airs.com/blog/archives/462
> http://www.airs.com/blog/archives/464
>
> The different handling for read/write has to do with whether the
> sections must be writable at runtime or not. If they need not be
> writable, they can go in the text segment or the relro area; if they
> need to be writable (which is normally not the case) they must go in the
> data segment.
>
> Ian
>
More information about the Gcc-help
mailing list