Andreas Aardal Hanssen
Tue, 15 Jul 2003 01:13:42 -0700
On Tue, 15 Jul 2003, Adrian Urquhart wrote: >On Mon, 14 Jul 2003, Andreas Aardal Hanssen wrote: >> Hi Adrian, >> http://www.freebsd.org/cgi/cvsweb.cgi/ports/mail/bincimap/ >Well, I did the obvious thing and grabbed the source tarball then fired >up the compiler. All options left at default values. >I end up with a bincimapd binary which is 31,134,575 bytes in size! Even >after a strip it's 1,907,040 bytes. Surely this isn't right? I'm sure I >didn't ask for a static build... Binc IMAP 1.1.8 uses exceptions extensively (too much so, I'm afraid). gcc/g++ extensively bloats the binary code when exceptions is used, by adding loads of stuff to the data segment (so it's not shared either!). Although C++ code tends to be much larger in binary size than C code, this is way too much, and I have gotten reports about this before. :-/ Part of the refactoring that is currently going on is in completely removing the use of exceptions. I've gotten bincimapd down to 700k (!!) and bincimap-up is down to 250k. But this is not released yet. >I can see while compiling that optimisation is set to -O2 but -g is also >there so I guess I need to turn debugging off (aren't these two options >sort of mutually exclusive?) With gcc, you can debug optimized code. :-) >From info-gcc: Unlike most other C compilers, GCC allows you to use `-g' with `-O'. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops. Andy -- Andreas Aardal Hanssen | http://www.andreas.hanssen.name/gpg Author of Binc IMAP | "It is better not to do something | than to do it poorly."