This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
-ffunction-sections -fdata-sections results, for fun
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: -ffunction-sections -fdata-sections results, for fun
- From: Benjamin Kosnik <bkoz at cygnus dot com>
- Date: Thu, 13 Apr 2000 23:11:55 -0700
Trying to get back into the swing of things, I was updating my TODO
list and thought I'd see if a long standing bug with
-ffunction-sections was fixed:
9) linker research
- -ffunction-sections -fvtable-gc -Wl,--gc-sections
- http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00879.html
To my delight, this version of gcc sails through the test case:
cvs -d:ext:bkoz@egcs.cygnus.com:/cvs/gcc co -P -D'April 11, 2000 12:00am' egcs
I then modified src/Makefile in my build directory so that
OPTIMIZE_CXXFLAGS = -ffunction-sections -fdata-sections
and re-built the library. (-fvtable-gc seems to kill the compiler in
code for complex, sigh.)
Here are the testsuite results: the real savings appear for the
iostreams code, as the string member functions are already in separate
sections thanks to the stringXXX.cc files. (An interesting thought:
perhaps adding these flags by default could replace that approach...?)
The text sections appear to be consistently 10% smaller with the flags
enabled, while the total binary size for the static objects is a
whopping 50% smaller. (Although still huge.) Hmmmmmmmmmm. Check it
out:
// 1 baseline
host: Linux 2.3.48 #2 Sun Feb 27 01:12:10 PST 2000 i586
compiler: 2.96
compiler flags: -static
date: 20000413
pass/fail results: 69/0, WIN WIN
p == pass/fail execution test
ctime == time to compile and link
etime == time for executable to run (take with salt)
text == size of the executable text section
data == size of the executable data section
total == size of the executable
p ctime etime text data total name
+ 3 0.000 160300 29770 875444 17_intro/header_ciso646.cc
+ 10 0.000 160204 29770 875400 17_intro/header_fstream.cc
+ 7 0.000 160204 29770 875348 17_intro/header_iomanip.cc
+ 4 0.000 160204 29770 875348 17_intro/header_ios.cc
+ 2 0.000 160204 29770 875348 17_intro/header_iosfwd.cc
+ 7 0.000 491605 39141 3170490 17_intro/header_iostream.cc
+ 5 0.000 160204 29770 875348 17_intro/header_istream.cc
+ 4 0.000 160204 29770 875348 17_intro/header_ostream.cc
+ 4 0.000 160204 29770 875348 17_intro/header_sstream.cc
+ 4 0.000 160204 29770 875348 17_intro/header_streambuf.cc
+ 16 0.000 491605 39141 3170490 17_intro/headers.cc
+ 2 0.000 180325 30133 983714 18_support/numeric_limits.cc
+ 7 0.000 204645 31061 1254167 21_strings/append.cc
+ 7 0.000 201285 30517 1096645 21_strings/capacity.cc
+ 4 0.000 185637 30357 1076673 21_strings/char_traits.cc
+ 5 0.000 189733 30421 1082206 21_strings/compare.cc
+ 5 0.000 191253 30485 1084618 21_strings/ctor_copy_dtor.cc
+ 4 0.010 186389 30517 1078197 21_strings/element_access.cc
+ 6 0.000 203717 30677 1251435 21_strings/find.cc
+ 6 0.000 193173 30965 1087086 21_strings/insert.cc
+ 13 0.000 493957 40197 3091437 21_strings/inserters_extractors.cc
+ 6 0.000 194005 30549 1087314 21_strings/invariants.cc
+ 7 0.000 199093 30517 1093158 21_strings/nonmember.cc
+ 4 0.000 187653 30389 1079729 21_strings/operations.cc
+ 5 0.000 193013 30453 1086262 21_strings/replace.cc
+ 4 0.000 187749 30453 1080078 21_strings/substr.cc
+ 8 0.000 492501 39301 3171195 22_locale/ctype.cc
+ 8 0.000 493477 39333 3172032 22_locale/ctype_char_members.cc
+ 7 0.000 192901 30581 1086846 23_containers/bitset_ctor.cc
+ 10 0.000 205605 30421 1105049 23_containers/bitset_shift.cc
+ 9 0.000 498629 39141 3179246 23_containers/multiset.cc
+ 3 0.000 187477 30165 995223 23_containers/vector_capacity.cc
+ 10 0.000 520517 39141 3206715 23_containers/vector_ctor.cc
+ 5 0.000 192917 30165 1002479 23_containers/vector_modifiers.cc
+ 9 0.000 498725 39589 3180183 24_iterators/istreambuf_iterator.cc
+ 11 0.010 210997 30357 1108361 24_iterators/iterator.cc
+ 2 0.000 160617 29770 875833 25_algorithms/min_max.cc
+ 11 0.000 496181 39141 3176486 26_numerics/binary_closure.cc
+ 2 0.000 160617 29770 875873 26_numerics/buggy_complex.cc
+ 2 0.000 168187 31915 901269 26_numerics/c_math.cc
+ 10 0.000 513781 39813 3248056 26_numerics/complex_inserters_extractors.cc
+ 6 0.000 180293 30165 986958 26_numerics/valarray.cc
+ 10 0.000 502485 39589 3182847 27_io/filebuf.cc
+ 4 0.000 162150 29770 877510 27_io/fpos.cc
+ 9 0.000 495957 39525 3177215 27_io/ios_base_callbacks.cc
+ 8 0.010 494709 39397 3175118 27_io/ios_base_members_static.cc
+ 8 0.000 496341 39429 3176942 27_io/ios_ctor.cc
+ 12 777.000 486037 39333 3060666 27_io/ios_manip_basefield.cc
+ 10 0.000 497093 39301 3178117 27_io/ios_manip_fmtflags.cc
+ 7 0.000 495221 39333 3175185 27_io/ios_members.cc
+ 15 0.000 492597 39493 3172066 27_io/iostream_objects.cc
+ 1 0.000 160204 29770 875348 27_io/istream.cc
+ 12 0.000 504229 40389 3189310 27_io/istream_extractor_arith.cc
+ 9 0.000 501285 39717 3183303 27_io/istream_extractor_char.cc
+ 11 0.000 501157 39685 3183886 27_io/istream_extractor_other.cc
+ 9 0.010 497189 39749 3189673 27_io/istream_manip.cc
+ 8 0.010 494789 39493 3175446 27_io/istream_sentry.cc
+ 13 0.000 503877 40101 3079954 27_io/istream_unformatted.cc
+ 9 0.000 495605 39653 3177127 27_io/istringstream_members.cc
+ 1 0.010 160204 29770 875348 27_io/ostream.cc
+ 15 1.200 499189 41509 3083174 27_io/ostream_inserter_arith.cc
+ 12 0.000 492053 39877 3071346 27_io/ostream_inserter_char.cc
+ 11 0.010 496949 40005 3178710 27_io/ostream_inserter_other.cc
+ 9 0.020 495525 39589 3177506 27_io/ostream_manip.cc
+ 8 0.000 494005 39621 3174570 27_io/ostream_unformatted.cc
+ 9 0.000 501605 39653 3183939 27_io/streambuf.cc
+ 10 0.000 510389 39589 3193632 27_io/stringbuf.cc
+ 10 0.000 498101 40069 3181579 27_io/stringstream.cc
+ 11 0.000 491605 39301 3170650 ext/headers.cc
// 2 -ffunction-sections -fdata-sections
host: Linux 2.3.48 #2 Sun Feb 27 01:12:10 PST 2000 i586
compiler: 2.96
compiler flags: -DDEBUG_ASSERT -ffunction-sections -fdata-sections -static
date: 20000413
pass/fail results: 69/0, WIN WIN
p == pass/fail execution test
ctime == time to compile and link
etime == time for executable to run (take with salt)
text == size of the executable text section
data == size of the executable data section
total == size of the executable
p ctime etime text data total name
+ 5 0.000 160329 29833 877487 17_intro/header_ciso646.cc
+ 7 0.000 160202 29780 875408 17_intro/header_fstream.cc
+ 5 0.000 160202 29780 875356 17_intro/header_iomanip.cc
+ 4 0.010 160202 29780 875356 17_intro/header_ios.cc
+ 1 0.010 160202 29770 875346 17_intro/header_iosfwd.cc
+ 7 0.000 447493 39173 1442833 17_intro/header_iostream.cc
+ 4 0.000 160202 29780 875356 17_intro/header_istream.cc
+ 6 0.000 160202 29780 875356 17_intro/header_ostream.cc
+ 6 0.000 160202 29780 875356 17_intro/header_sstream.cc
+ 4 0.010 160202 29780 875356 17_intro/header_streambuf.cc
+ 20 0.000 447493 39173 1,442,833 17_intro/headers.cc
+ 1 0.000 180341 30202 984923 18_support/numeric_limits.cc
+ 7 0.000 208325 31124 1027341 21_strings/append.cc
+ 9 0.000 202485 30604 1016195 21_strings/capacity.cc
+ 7 0.000 186965 30476 996351 21_strings/char_traits.cc
+ 6 0.000 191029 30548 1001860 21_strings/compare.cc
+ 5 0.000 192581 30584 1004276 21_strings/ctor_copy_dtor.cc
+ 5 0.000 187685 30604 997811 21_strings/element_access.cc
+ 5 0.000 209413 30740 1026625 21_strings/find.cc
+ 7 0.000 194485 31020 1006684 21_strings/insert.cc
+ 16 0.010 444421 40421 1441739 21_strings/inserters_extractors.cc
+ 6 0.000 195221 30588 1006800 21_strings/invariants.cc
+ 9 0.000 200389 30540 1012708 21_strings/nonmember.cc
+ 6 0.000 188805 30516 998115 21_strings/operations.cc
+ 7 0.000 194293 30540 1005860 21_strings/replace.cc
+ 5 0.000 189061 30508 999676 21_strings/substr.cc
+ 9 0.000 448389 39333 1444341 22_locale/ctype.cc
+ 9 0.000 449205 39493 1445065 22_locale/ctype_char_members.cc
+ 9 0.000 193813 30668 1006052 23_containers/bitset_ctor.cc
+ 10 0.000 206501 30512 1024255 23_containers/bitset_shift.cc
+ 9 0.000 454053 39173 1451125 23_containers/multiset.cc
+ 4 0.000 187493 30240 996438 23_containers/vector_capacity.cc
+ 10 0.000 476133 39301 1479793 23_containers/vector_ctor.cc
+ 5 0.010 192933 30240 1003694 23_containers/vector_modifiers.cc
+ 11 0.000 451813 39781 1450593 24_iterators/istreambuf_iterator.cc
+ 13 0.000 212181 30456 1027879 24_iterators/iterator.cc
+ 3 0.000 160633 29828 877858 25_algorithms/min_max.cc
+ 13 0.000 452037 39173 1448797 26_numerics/binary_closure.cc
+ 1 0.000 160633 29770 875889 26_numerics/buggy_complex.cc
+ 2 0.000 168187 31898 901252 26_numerics/c_math.cc
+ 10 0.000 461541 40741 1466124 26_numerics/complex_inserters_extractors.cc
+ 6 0.000 180293 30176 986969 26_numerics/valarray.cc
+ 10 0.010 457701 39685 1454897 27_io/filebuf.cc
+ 4 0.000 162230 29824 879595 27_io/fpos.cc
+ 10 0.000 448357 39685 1446937 27_io/ios_base_callbacks.cc
+ 14 0.000 448245 39557 1446025 27_io/ios_base_members_static.cc
+ 9 0.000 449813 39557 1447785 27_io/ios_ctor.cc
+ 11 777.000 437013 39461 1430104 27_io/ios_manip_basefield.cc
+ 10 0.000 451109 39461 1449429 27_io/ios_manip_fmtflags.cc
+ 8 0.000 449221 39493 1446421 27_io/ios_members.cc
+ 16 0.000 448213 39525 1444137 27_io/iostream_objects.cc
+ 1 0.000 160202 29770 875346 27_io/istream.cc
+ 12 0.000 458597 40613 1461177 27_io/istream_extractor_arith.cc
+ 10 0.000 454277 39877 1453617 27_io/istream_extractor_char.cc
+ 11 0.000 453701 39845 1453313 27_io/istream_extractor_other.cc
+ 9 0.000 450053 39877 1449378 27_io/istream_manip.cc
+ 8 0.000 448517 39621 1446545 27_io/istream_sentry.cc
+ 13 0.000 454677 40293 1449220 27_io/istream_unformatted.cc
+ 9 0.000 448533 39813 1447345 27_io/istringstream_members.cc
+ 0 0.010 160202 29770 875346 27_io/ostream.cc
+ 14 1.200 448245 41541 1448341 27_io/ostream_inserter_arith.cc
+ 12 0.000 442677 40101 1438273 27_io/ostream_inserter_char.cc
+ 11 0.000 450373 40165 1449505 27_io/ostream_inserter_other.cc
+ 9 0.000 449557 39717 1448877 27_io/ostream_manip.cc
+ 9 0.000 448069 39781 1446005 27_io/ostream_unformatted.cc
+ 10 0.000 453413 39845 1453101 27_io/streambuf.cc
+ 12 0.000 462757 39749 1463549 27_io/stringbuf.cc
+ 11 0.000 451925 40165 1452629 27_io/stringstream.cc
+ 12 0.000 447493 39301 1442961 ext/headers.cc