This is the mail archive of the
mailing list for the binutils project.
Huge .eh_frame section with C++ exceptions, --gc-sections discards too much
- From: "R. Diez" <rdiezmail-binutils at yahoo dot de>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 23 Jan 2013 10:36:57 +0000 (GMT)
- Subject: Huge .eh_frame section with C++ exceptions, --gc-sections discards too much
- Reply-to: "R. Diez" <rdiezmail-binutils at yahoo dot de>
I have built a GCC 4.7.2 cross-compiler for an embedded PowerPC target with EABI and -msdata=sysv, I am using binutils 2.23.1.
I would like to use C++ exceptions, but I have noticed that the code gets much bigger then. Section .gcc_except_table seems to have a reasonable size, but section .eh_frame is huge.
If I mark .gcc_except_table as KEEP in the linker script file, C++ exception seem to work. However, if I remove the KEEP, the linker throws most of it away, only 4 bytes remain, and afterwards C++ exceptions do not work in the final executable (it crashes on throw/catch).
I suspect there is room for improvement in the way .gcc_except_table is managed, as most of it is probably unused and could be discarded or at least merged somehow.
I found a long discussion about this in the context of eCos around 7 years ago:
I am not sure what the status nowadays is. Can anybody help? Is there any way to prevent such a big growth when turning C++ exceptions on, especially in section .gcc_except_table ?
Please copy me on the answer, as I'm not subscribed to this mailing list.
Thanks in advance,
? R. Diez