From: Jamie Lokier <jamie@shareable.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Oleg Verych <olecom@gmail.com>,
linux-embedded <linux-embedded@vger.kernel.org>,
linux-kbuild@vger.kernel.org, segher@kernel.crashing.org
Subject: Re: about size optimizations (Re: Not as much ccache win as I expected)
Date: Sun, 15 Jun 2008 17:00:49 +0100 [thread overview]
Message-ID: <20080615160049.GA2991@shareable.org> (raw)
In-Reply-To: <1213437917.26255.335.camel@pmac.infradead.org>
David Woodhouse wrote:
> On Sat, 2008-06-14 at 10:56 +0100, Oleg Verych wrote:
> > I saw that. My point is pure text processing. But as it seems doing
> > `make` is a lot more fun than to do `sh` && `sed`.
>
> The problem is that it _isn't_ pure text processing. There's more to
> building with --combine than that, and we really do want the compiler to
> do it.
>
> _Sometimes_ you can just append C files together and they happen to
> work. But not always. A simple case where it fails would be when you
> have a static variable with the same name in two different files.
I suspect the simplest way to adapt an existing makefile is:
1. Replace each compile command "gcc args... file.c -o file.o"
with "gcc -E args... file.c -o file.o.i".
2. Replace each incremental link "ld -r -o foo.o files..." with
"cat `echo files... | sed 's/$/.i/'` > foo.o.i".
3. Similar replacement for each "ar" command making .a files.
4. Replace the main link "ld -o vmlinux files..." with
"gcc -o vmlinux --combine -fwhole-program `echo files... | sed 's/$/.i/'`".
You can do this without changin the Makefile, if you provide suitable
scripts on $PATH for the make.
-- Jamie
next prev parent reply other threads:[~2008-06-15 16:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 21:52 about size optimizations (Re: Not as much ccache win as I expected) Oleg Verych
2008-06-14 7:43 ` David Woodhouse
2008-06-14 9:48 ` Adrian Bunk
2008-06-14 9:56 ` Oleg Verych
2008-06-14 10:05 ` David Woodhouse
2008-06-14 10:27 ` Oleg Verych
2008-06-15 16:00 ` Jamie Lokier [this message]
2008-06-15 16:56 ` Oleg Verych
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080615160049.GA2991@shareable.org \
--to=jamie@shareable.org \
--cc=dwmw2@infradead.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=olecom@gmail.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).