Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread Konstantin Belousov
On Tue, Sep 17, 2013 at 11:45:19PM +0200, Ed Schouten wrote: Hi Matthew, 2013/9/16 Matthew Fleming m...@freebsd.org: Would it be possible to enable this only for devd, init, and clang binaries? Or is it a matter of enabling it for library builds that are linked statically with the

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread Andrew Turner
On Sun, 15 Sep 2013 19:30:01 -0700 Tim Kientzle kient...@freebsd.org wrote: On Sep 15, 2013, at 2:24 PM, Ed Schouten e...@80386.nl wrote: GCC and Clang support the -ffunction-sections and -fdata-sections flags. Essentially, these flags force the compiler to put every function and

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread Jan Mikkelsen
(Copy for the list, wrong from address problem ...) On 18/09/2013, at 4:22 PM, Konstantin Belousov kostik...@gmail.com wrote: On Tue, Sep 17, 2013 at 11:45:19PM +0200, Ed Schouten wrote: [...] Honestly, I think we can assume we'll never reach the point where all the components listed above

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread Konstantin Belousov
On Wed, Sep 18, 2013 at 05:36:40PM +1000, Jan Mikkelsen wrote: On 18/09/2013, at 4:22 PM, Konstantin Belousov kostik...@gmail.com wrote: On Tue, Sep 17, 2013 at 11:45:19PM +0200, Ed Schouten wrote: [ ... ] Honestly, I think we can assume we'll never reach the point where all the

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread David Chisnall
On 18 Sep 2013, at 07:22, Konstantin Belousov kostik...@gmail.com wrote: I think this is a wrong direction. First, the split should be done at the source level, as it was usually done forever. Until we are all using toolchains that support LTO (which requires importing a new linker and will

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-18 Thread Jan Mikkelsen
On 18/09/2013, at 4:22 PM, Konstantin Belousov kostik...@gmail.com wrote: On Tue, Sep 17, 2013 at 11:45:19PM +0200, Ed Schouten wrote: [ ... ] 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

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Adrian Chadd
... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg, if there's malloc related functions that aren't used, maybe we should break malloc down into a directory full of functions. I'm not surprised libc++ is doing .. that. It's likely better on the

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Ed Schouten
Hi Matthew, 2013/9/16 Matthew Fleming m...@freebsd.org: Would it be possible to enable this only for devd, init, and clang binaries? Or is it a matter of enabling it for library builds that are linked statically with the mentioned binaries? For it to have effect, it has to be enabled for both

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread John-Mark Gurney
Adrian Chadd wrote this message on Tue, Sep 17, 2013 at 14:56 -0700: ... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg, if there's malloc related functions that aren't used, maybe we should break malloc down into a directory full of functions.

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Ian Lepore
On Tue, 2013-09-17 at 14:56 -0700, Adrian Chadd wrote: ... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg, if there's malloc related functions that aren't used, maybe we should break malloc down into a directory full of functions. Why is

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Adrian Chadd
On 17 September 2013 16:22, Ian Lepore i...@freebsd.org wrote: On Tue, 2013-09-17 at 14:56 -0700, Adrian Chadd wrote: ... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg, if there's malloc related functions that aren't used, maybe we should

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Justin Hibbits
On Sep 17, 2013 4:31 PM, Adrian Chadd adr...@freebsd.org wrote: On 17 September 2013 16:22, Ian Lepore i...@freebsd.org wrote: On Tue, 2013-09-17 at 14:56 -0700, Adrian Chadd wrote: ... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg,

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-17 Thread Ian Lepore
On Tue, 2013-09-17 at 16:31 -0700, Adrian Chadd wrote: On 17 September 2013 16:22, Ian Lepore i...@freebsd.org wrote: On Tue, 2013-09-17 at 14:56 -0700, Adrian Chadd wrote: ... I'd rather see if we can actually separate out things some more so these builds can shrink. Eg, if

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-16 Thread Poul-Henning Kamp
In message CAJOYFBBGY0GosPwG1B=1mkyapchetx-o97r2zhxpgs8o7wo...@mail.gmail.com , Ed Schouten writes: Thoughts? Jordan and I would have killed for that 19 years ago... -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@freebsd.org | TCP/IP since RFC 956 FreeBSD committer

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-16 Thread Dimitry Andric
On Sep 16, 2013, at 03:08, Adrian Chadd adr...@freebsd.org wrote: The results are interesting. On amd64: - devd suddenly becomes 500 KB in size, instead of a megabyte, - init's size drops from 900 KB to 600 KB, - clang becomes a megabyte smaller. .. so, I'd like to know specific

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-16 Thread David Chisnall
On 16 Sep 2013, at 07:52, Dimitry Andric d...@freebsd.org wrote: On Sep 16, 2013, at 03:08, Adrian Chadd adr...@freebsd.org wrote: The results are interesting. On amd64: - devd suddenly becomes 500 KB in size, instead of a megabyte, - init's size drops from 900 KB to 600 KB, - clang

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-15 Thread Matthew Fleming
On Sun, Sep 15, 2013 at 2:24 PM, Ed Schouten e...@80386.nl wrote: Hi all, Today I did a tiny experiment and I am not entirely sure what to do. Throw away the patch or eventually push it into the tree. GCC and Clang support the -ffunction-sections and -fdata-sections flags. Essentially,

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-15 Thread Adrian Chadd
The results are interesting. On amd64: - devd suddenly becomes 500 KB in size, instead of a megabyte, - init's size drops from 900 KB to 600 KB, - clang becomes a megabyte smaller. .. so, I'd like to know specific information as to why these three are now smaller. So what's going on?

Re: -ffunction-sections, -fdata-sections and -Wl,--gc-sections

2013-09-15 Thread Tim Kientzle
On Sep 15, 2013, at 2:24 PM, Ed Schouten e...@80386.nl wrote: GCC and Clang support the -ffunction-sections and -fdata-sections flags. Essentially, these flags force the compiler to put every function and variable in its own section. Though this will blow up the …. - devd suddenly becomes 500