Limiting code size with -g2 with c++ template lib
Benoît Jacob
jacob@math.jussieu.fr
Sun Jun 8 15:26:00 GMT 2008
Hi List,
I am developing a C++ pure-template-library, with a lot of meta-programming
(expression templates).
With the default debugging level (-g2), the produced executable has a huge
size. Like, 300 kb for a simple program.
With -g1, the executable size is much more reasonable -- less than 150% of the
size obtained with -g0.
I believe that the main difference between -g1 and -g2 is that -g2 enables
source-code-line-number information. Also, "nm" tells me that there are very
few symbols (function names) in my executables.
I would like to do either of the following:
1) tell gcc to only emit line-number info for these lines of code that
actually produce code in the executable, after optimization.
2) tell gcc to just not emit any line-number info for the code inside my
template lib. Something like (I know that Pragma doesn't exist!):
_Pragma("dont_emit_line_number_info");
#include<MyTemplateLib/Headers>
_Pragma("end_of_dont_emit_line_number_info");
Is any of that possible? Do you see anything else that might help limit the
size of code generated by -g2?
Of course the users of my lib want to use -g2 not -g1 when compiling their own
app!
Thanks a lot in advance for any help,
Benoit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20080608/7dda9278/attachment.sig>
More information about the Gcc-help
mailing list