public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Indan Zupancic <indan@nul.nu>
Cc: Rob Landley <rob@landley.net>,
	linux-tiny@selenic.com,
	Michael Opdenacker <michael@free-electrons.com>,
	CE Linux Developers List <celinux-dev@tree.celinuxforum.org>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: [Announce] Linux-tiny project revival
Date: Fri, 21 Sep 2007 08:29:49 +0200	[thread overview]
Message-ID: <20070921062949.GA17131@uranus.ravnborg.org> (raw)
In-Reply-To: <38197.81.207.0.53.1190329581.squirrel@secure.samage.net>

On Fri, Sep 21, 2007 at 01:06:21AM +0200, Indan Zupancic wrote:
> On Fri, September 21, 2007 01:18, Rob Landley wrote:
> > On Thursday 20 September 2007 4:26:13 pm Indan Zupancic wrote:
> >> A quick scroll through a vmlinux binary shows that there are quite a
> >> lot areas consisting only of some repeated pattern. Mostly 0x00, but
> >> also 0x90 and ".GCC: (GNU) 4.2.1.". Getting rid of those would save
> >> something between 50 and 100KB.
> >
> > Worse, if you feed an absolute path to O= when you build the kernel out of
> > tree, then it uses absolute paths for all the __FILE__ strings and that makes
> > kernel BIIIIIG.  (Did that by accident a while back.)  Too bad there's no way
> > to keep the __FILE__ strings compressed at runtime and gunzip them as needed
> > like busybox does with help messages... :)
> 
> I suspect that can be fixed by changing the built system. How can using O=
> change the source file path anyway? That seems unnecessary.
Thats a bit unavoidable as the build system works.
__FILE__ is passed the filename supplied as argument to gcc.

Try:
echo "char *s = __FILE__;" > sam.c

gcc -E sam.c
This gives you:
# 1 "sam.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "sam.c"
char *s="sam.c";

gcc -E ~/sam.c
This gives you:
# 1 "/home/sam/sam.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/home/sam/sam.c"
char *s="/home/sam/sam.c";
 
So __FILE__ expand differently depending on the path on
the gcc command line.
I once posted a patch to fix up on this, especialy for BUG_ON and friends.
The solution was to let kbuild generate the filename and to use
this define in the source code.
But a quick grep for __FILE__ in the kernel source made me chicken out.
Simply too much chrunch at that time to justify it.

Googeling a bit I found it here: http://lkml.org/lkml/2006/7/8/22
The better approach would be to use at least the patch inside
the kernel.
This patch should be easy to update to latest kernel if anyone
is up to play with it.

I recall that there was some problems with the path used.
But I cannot remember the details.
Andrew had some inputs from his testing IIRC and google should
be able to tell the full story.

	Sam





> 
> It seems to be worse, full pathnames are also used when giving a relative path.
> (I'm using O=../obj/).
> 
> On the other hand, it doesn't seem to cause that much bloat here:
> 
> $ strings vmlinux | grep /home/ |wc
>     119     181    6400
> 
> CC'ing Sam Ravnborg, perhaps he has some ideas.
> 
> Greetings,
> 
> Indan
> 
> 

  reply	other threads:[~2007-09-21  6:28 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19 18:03 [Announce] Linux-tiny project revival Tim Bird
2007-09-19 18:47 ` Luis R. Rodriguez
2007-09-19 19:31   ` Tim Bird
2007-09-19 19:01 ` Christian MICHON
2007-09-19 19:28 ` Andi Kleen
2007-09-19 19:41   ` Tim Bird
2007-09-19 20:45     ` Valdis.Kletnieks
2007-09-19 21:29       ` Tim Bird
2007-09-19 22:29         ` Michael Opdenacker
2007-09-19 21:28 ` [Celinux-dev] " Andrew Morton
2007-09-19 21:41   ` Tim Bird
2007-09-19 22:38     ` Michael Opdenacker
2007-09-20  9:10       ` Andy Whitcroft
2007-09-20 17:10         ` Monster switch for small size (was Linux-tiny revival) Tim Bird
2007-09-20 21:41           ` Rob Landley
2007-09-20 20:50             ` Randy Dunlap
2007-09-21  6:35             ` Christian MICHON
2007-09-20 23:02   ` [Celinux-dev] [Announce] Linux-tiny project revival Rob Landley
2007-09-20 20:38 ` Rob Landley
2007-09-20 19:58   ` Alexey Dobriyan
2007-09-20 20:22     ` printk proposal - (was Linux-tiny project revival) Tim Bird
2007-09-21 19:07       ` Alexey Dobriyan
2007-09-21 20:53         ` Rob Landley
2007-09-20 22:02     ` [Announce] Linux-tiny project revival Rob Landley
2007-09-20 21:22       ` Jared Hulbert
2007-09-20 22:53         ` Rob Landley
2007-09-20 22:15       ` [Celinux-dev] " Gross, Mark
2007-09-21  0:57         ` Message codes (Re: [Announce] Linux-tiny project revival) Oleg Verych
2007-09-21 14:18           ` Gross, Mark
2007-09-21 21:15             ` Rob Landley
2007-09-21 22:12               ` Gross, Mark
2007-09-21 22:33                 ` Joe Perches
2007-09-21 22:39                   ` Gross, Mark
2007-09-22  1:55               ` Oleg Verych
2007-09-21 13:29       ` [Announce] Linux-tiny project revival Dick Streefland
2007-09-20 20:16   ` Joe Perches
2007-09-25 11:43     ` [Celinux-dev] " Geert Uytterhoeven
2007-09-20 21:26   ` Indan Zupancic
2007-09-20 23:18     ` Rob Landley
2007-09-20 23:06       ` Indan Zupancic
2007-09-21  6:29         ` Sam Ravnborg [this message]
2007-09-24 18:13           ` Adrian Bunk
2007-09-26  6:24             ` Rob Landley
2007-09-21 17:16       ` Valdis.Kletnieks
2007-09-21 17:45         ` Joe Perches
2007-09-21 23:05           ` Rob Landley
2007-09-21 23:08             ` Joe Perches
2007-09-21 21:34       ` Kyle Moffett
2007-09-21 22:05         ` Joe Perches
2007-09-21 22:57           ` Kyle Moffett
2007-09-20 21:58   ` Tim Bird
2007-09-20 22:14     ` Joe Perches
2007-09-21  0:28       ` Rob Landley
2007-09-21  0:03         ` Joe Perches
2007-09-20 23:11     ` Rob Landley
2007-09-21 12:27   ` Bill Davidsen
2007-09-27  7:00   ` Arnd Bergmann
2007-09-27 16:35     ` Indan Zupancic
2007-09-27 22:21       ` Arnd Bergmann
2007-09-28  8:39         ` Bernd Petrovitsch
2007-09-30 20:37           ` Jörn Engel
2007-09-28  0:06     ` Rob Landley
2007-09-28 14:36       ` Dick Streefland

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=20070921062949.GA17131@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=celinux-dev@tree.celinuxforum.org \
    --cc=indan@nul.nu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tiny@selenic.com \
    --cc=michael@free-electrons.com \
    --cc=rob@landley.net \
    /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