From: "Oleg Verych" <olecom@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: 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: Sat, 14 Jun 2008 11:27:02 +0100 [thread overview]
Message-ID: <8499950a0806140327l267186c5h621bec0ea3995842@mail.gmail.com> (raw)
In-Reply-To: <1213437917.26255.335.camel@pmac.infradead.org>
> _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.
Afaik in the kernel global static variables are not appreciated much. In any
case file scope can be easily added by s/// to its name in text compile
stage.
There are much more problems with conditional includes and other source
configuration crutches.
> The compiler will do the right thing there., while naïve concatenation
> of C files will not.
That was an example, of course there must be pre-cc text processing stage.
> Of course, it's _possible_ to have external text processing cope with
> this case somehow -- you'd probably feed it through the preprocessor,
> then look at the output of the preprocessor and make the variable names
> unique, perhaps?
Even before cpp. But twisted includes/ifdef's cannot be handled without it.
> And then move on to the next case which is already handled in gcc...
To gain size reduction, some register-wide static variables (ints), which are
usually for some state-handling, can be glued together, if whole picture
permits: all flags fit in limited bit range, needed shift is added textually.
Again developer doing clear/documented semantics, text-based
transformations is needed. Can it be done by GCC optimizing stages?
(However Rusty may try to do that with cpp :)
> But really, I'd rather just leave it to the compiler. And it's not
> because I have some masochistic fascination with makefiles :)
--
sed 'sed && sh + olecom = love' << ''
-o--=O`C
#oo'L O
<___=E M
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-06-14 10:27 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 [this message]
2008-06-15 16:00 ` Jamie Lokier
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=8499950a0806140327l267186c5h621bec0ea3995842@mail.gmail.com \
--to=olecom@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--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).