Stipping away locale support
Loren James Rittle
rittle@latour.rsch.comm.mot.com
Fri Aug 15 20:55:00 GMT 2003
>> ---------------------------------------------------------------------
>> // no headers at all!
>> int main()
>> {
>> char *c = new char[20];
>> }
>> text data bss dec hex filename
>> 193751 70600 4896 269247 41bbf hello.gdb
>> ---------------------------------------------------------------------
> That's strange. On Cygwin this last example is much smaller
> than the previous one. This should require only the definitions
> of operator new[](size_t), exception and bad_alloc (thrown if
> operator new[] fails) and terminate (called if the exception is
> thrown since there is no catch handler) [1]; the linker should
> discard the object files containing the rest of the library.
Yow! That is the problem. Empty main() is 10K text when linked
against static libstdc++-v3. As shown above, ~300K text when linked
against static libstdc++-v3. It is ~30K text with g++32.
This was clearly an unintended consequence of using a C++ demangler
IMHO since the following command is suppose to compile and link
without error when you only use the core C++ language features:
$ gcc -static -O2 t.C -lsupc++
/usr/local/beta-gcc/lib/gcc/i386-unknown-freebsd4.8/3.4/../../../libsupc++.a(vterminate.o)(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x36): In function `__gnu_cxx::__verbose_terminate_handler()':
libstdc++-v3/libsupc++/vterminate.cc:66: undefined reference to `__cxa_demangle'
collect2: ld returned 1 exit status
Granted, people that care, can follow the advice in (although anything
that requires a library rebuild seems wrong):
libstdc++-v3/libsupc++/eh_term_handler.cc
It seems that we should only install __verbose_terminate_handler when
we link against libstdc++ but not when we only link against libsupc++.
Regards,
Loren
More information about the Libstdc++
mailing list