On Fri, Dec 27, 2013 at 2:12 PM, Nico Weber <[email protected]> wrote:
> On Thu, Dec 26, 2013 at 10:04 PM, Chandler Carruth > <[email protected]>wrote: > >> >> On Fri, Dec 27, 2013 at 1:02 AM, Chandler Carruth >> <[email protected]>wrote: >> >>> Have you checked the other binary size reductions? I wonder why we >>> didn't do this sooner. >>> >> >> Oh, of course, you did this just for clang-format. >> >> Can we instead do this for all LLVM projects by default, and opt maybe >> 'clang', 'opt', 'llc', and 'bugpoint' out of it to support dlopen'ed passes >> and plugins? >> > > Something like the attached patch? (Make-only again, but now including the > linux bits. If folks like it, I can do the cmake part as a followup.) > > This adds -ffunction-sections -fdata-sections unconditionally, since most > tools have few source files anyways and mostly link in static libs. This > reduces the size of e.g. diagtool from 21 MB to 2.8 MB and clang-format > from 22 MB to 1.8 MB (these numbers are on Linux). libclang.so drops from > 29MB to 20MB, but from skimming through `vim -d <(nm old-libclang.so) <(nm > new-libclang.so)` only mangled symbols are getting dropped, and the > libclang makefile sets EXPORTED_SYMBOL_FILE, and tests pass, so hopefully > nothing necessary is getting dropped. > > The size of libclang.a grows from 1.6 MB to 2 MB, as you'd expect with > -ffunction-sections. The size of other .a files increases similarly: > libclangARCMigrate goes from 5.9 MB to 8.9 MB, libclangAST.a from 8.1 MB to > 11 MB, and so on. This is probably acceptable? > This seems very reasonable to me for the advantages it poses. I even expect link times to go *down* as a consequence. Rock! Feel free to submit, and submit the cmake variant whenever you have it. The bots can catch the fallout. =D
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
