Date: Wed, 18 Sep 2013 09:22:41 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Ed Schouten <ed@80386.nl> Cc: Matthew Fleming <mdf@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections Message-ID: <20130918062241.GW41229@kib.kiev.ua> In-Reply-To: <CAJOYFBBUT5v1E6L0JkdrAXFmJmR0W2tmyNrC71k8mahLiF5vWg@mail.gmail.com> References: <CAJOYFBBGY0GosPwG1B=1MKyapChEtX-O97r2zhXpGS8o7WO3gA@mail.gmail.com> <CAMBSHm_Qk13P=j1VOzuibYaeHFVF%2BCuXbTYL=q8ToDP6wL5X5w@mail.gmail.com> <CAJOYFBBUT5v1E6L0JkdrAXFmJmR0W2tmyNrC71k8mahLiF5vWg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--U23J1OQliU0BUf8i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 17, 2013 at 11:45:19PM +0200, Ed Schouten wrote: > Hi Matthew, >=20 > 2013/9/16 Matthew Fleming <mdf@freebsd.org>: > > Would it be possible to enable this only for devd, init, and clang bina= ries? > > Or is it a matter of enabling it for library builds that are linked > > statically with the mentioned binaries? >=20 > For it to have effect, it has to be enabled for both the libraries and > the binaries. The libraries need to be built with > -f{data,function}-sections. The binaries can also be built with those > flags, but it is actually more important to link with --gc-sections. >=20 > > Could init/devd be made smaller by > > finding out which functions they do/don't use and separating those into > > separate .c files? >=20 > Also trying to answer Tim and Adrian's questions at the same time. > I've just taken a look at init and devd to see why the difference in > size is so big: >=20 > init seems to pull in the following things: >=20 > - Sun RPC, > - XDR, > - YP, > - res_*, > - All of the jemalloc profiling/stats code, > - Some widechar functions, > - malloc-related utility functions that are not used (posix_memalign, > aligned_alloc), > - Some stdio bloat, > - All sorts of termios tc* functions. >=20 > devd seems to pull in these: >=20 > - A very big pile of C++ symbols, as libc++ places many functions in a > single file. > - jemalloc profiling/stats again, > - A big pile of pthread, > - Maybe *_l() functions, which are of course rarely used. >=20 > Honestly, I think we can assume we'll never reach the point where all > the components listed above will properly have all functions > partitioned over separate compilation units. >=20 > I suspect that it would make a lot of sense to at least enable these > build flags for our core libraries (libc, libc++, libpthread, > libcompiler_rt, libcxxrt, etc). We could also enable it on > INTERNALLIBs (libraries that are not installed into /usr/lib), as for > these libraries, it would of course not come at any cost. >=20 > Would that sound okay? I think this is a wrong direction. First, the split should be done at the source level, as it was usually done forever. One of the offender there was you, AFAIR. Second, I would rather see init and devd, and in fact all other statically linked binaries from our base system, to become dynamically linked. At least I added a knob for building toolchain dynamic, but avoided the fight of making this default. --U23J1OQliU0BUf8i Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (FreeBSD) iQIcBAEBAgAGBQJSOUawAAoJEJDCuSvBvK1BR8kP/2dMn8XmWawgDqJ5/8O6PlV9 PFswbjrKV6RJMl2bSWdnB5sxkliCbAVoe8/h2cAtALTDEwuNGSSA5MKitcIGt7ov tmbuR5P/svHOK1yqfSb21MnRDLOCdmcxX1IOot1hsGrmD5pdrkiskc3chj/nBja1 Z4L5688AwsBN7zDypL3ebn+sxngxZZQCyyKfu/ewPUSBcp+8crQQU8Q1HauL9PjL yuu5wkniS6uH9K4YL1Am13JvTQMrJi+1tSFVLeqvjwhoAJ83zaOcwcNM8zOEAJpt 3QNj3oxWJz3rShvuxGOmWC70jmPqGD1Skxe6HU5AgMpicXfBgyfo/cd8RR3rwcXB RBKkZNGm3GADXyNrcUWVeX7RAMKzHNmm0YcAzz+Z76f4xKoD1s8juI8l7nOcJcO8 lur8+BNyysfLpYXBpIeTZ++isZ/CdwSos9+gqv9Y9K7cmkpx+b4TdLtppgAsa2Bi R1mrMatKzlhDKMM1lK9DxLqMsmwpbBIy1ZQBBQXgtFLF/XGf3yAHb/ncO4GfIUlj QLMzSf5XViYT7f8LHFetnRLAvFBHoeIO/BMRdCA7hW0euPnKLDBEbvxipFT9nG73 ZqlV2P+vQGzqYGSM0lnywJvYcf1/2mWRNfSq0rwsPcLZZ+HqjzJjwa81QnOjMZOM 23ySmYvV9qAyEyONhr6k =ZnpO -----END PGP SIGNATURE----- --U23J1OQliU0BUf8i--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130918062241.GW41229>