Huge .eh_frame section with C++ exceptions, --gc-sections discards too much
R. Diez
rdiezmail-binutils@yahoo.de
Wed Jan 23 10:37:00 GMT 2013
Hi all:
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:
http://sourceware.org/ml/binutils/2005-06/msg00209.html
http://sourceware.org/ml/binutils/2005-06/msg00221.html
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
More information about the Binutils
mailing list