Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Dec 2000 17:24:05 +0100
From:      Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
To:        Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
Cc:        Greg Lehey <grog@lemis.com>, "G. Adam Stanislav" <adam@whizkidtech.net>, chat@FreeBSD.ORG
Subject:   Re: Removing GNU from kernel
Message-ID:  <20001231172405.A5383@curry.mchp.siemens.de>
In-Reply-To: <20001231124556.A99615@curry.mchp.siemens.de>; from andre.albsmeier@mchp.siemens.de on Sun, Dec 31, 2000 at 12:45:56PM %2B0100
References:  <20001230122630.A247@whizkidtech.net> <20001231121623.D3496@wantadilla.lemis.com> <20001231124556.A99615@curry.mchp.siemens.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Hmm, I have looked around in the gcc sources where the

[ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)

line is generated. Interestingly, the generation can be
switched off by using -fno-ident as a compiler flag.

Just for curiosity, I put -fno-ident in /etc/make.conf and
did a make world and built all my kernels. The disk usage
of /usr/obj was reduced from 539527 KB to 532649 KB. This
is about 7MB.

Maybe the compiler gurus can tell if it is a bad idea
to use -fno-ident. I haven't seen bad side effects so far.

	-Andre


> On Sun, 31-Dec-2000 at 12:16:23 +1030, Greg Lehey wrote:
> > On Saturday, 30 December 2000 at 12:26:30 -0600, G. Adam Stanislav wrote:
> > > Several weeks ago, I mentioned how I built my own kernel for the first
> > > time, and how happy I was with the result.
> > >
> > > Still, I noticed the string "GCC: (GNU) 2.7.2.1" appearing in my kernel
> > > several hundred times. I decided to try to get rid of it. As root, I typed:
> > >
> > >  # strip -R .comment kernel
> > >
> > > Sure enough, my kernel was reduced from 1,225,217 bytes to 994,864 bytes.
> > > The GNU strings are gone. The kernel still boots just as before.
> > 
> > This is puzzling for a number of reasons.  First, the kernel is very
> > small by modern standards, even before the stripping.  I've just
> > checked my last 3.x kernel, and I find:
> > 
> > -rwxr-xr-x  1 grog  lemis  9954685 Jun  8  2000 kernel.debug
> > -rwxr-xr-x  1 root  lemis  1778344 Dec 31 12:13 kernel
> > -rwxr-xr-x  1 root  lemis  1770936 Dec 31 12:13 kernel.stripped
> > 
> > The file kernel is kernel.debug stripped normally.  And yes, it has a
> > few lines of the form GCC: (GNU) 2.7.2.3 in it.  The third file is the
> > result of stripping the comments; I saved rather over 7 kB.
> > Definitely worth doing, so much in fact that we have already done it.
> > Here's the some thing on a 5.x kernel; 4.x looks the same:
> > 
> >   $ strings -a kernel.debug | grep GNU
> >   $
> 
> What does a 
> 
> strings -a kernel.debug | grep GCC
> 
> say? I get here (on 4.2):
> 
> $ strings -a kernel.debug | grep GCC | head
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> [ASM_FILE_END]GCC: (c) 2.95.2 19991024 (release)
> $
> 
> And I can do:
> 
> $ strings -a kernel.debug | grep GCC | wc
>      381    1905   18669
> $
> 
> 
> Some thoughts:
> 
> $ rm kernel
> $ make
> objcopy --strip-debug kernel.debug kernel
> $ ls -l kernel*
> -rwxr-xr-x  1 root  wheel  2218267 Dec 31 12:40 kernel
> -rwxr-xr-x  1 root  wheel  8499829 Dec 31 11:33 kernel.debug
> $ objcopy --strip-debug -R .comment kernel.debug kernel
> $ ls -l kernel*                                        
> -rwxr-xr-x  1 root  wheel  2199151 Dec 31 12:41 kernel
> -rwxr-xr-x  1 root  wheel  8499829 Dec 31 11:33 kernel.debug
> $ strings -a kernel | grep GCC
> $
> 
> 
> 	-Andre
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-chat" in the body of the message

-- 
Note: No Microsoft programs were used in the creation or distribution
      of this message. If you are using a Microsoft program to view
      or forward this message, be forewarned that I am not responsible
      for any harm you may encounter as a result.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001231172405.A5383>