From owner-freebsd-chat Sun Dec 31 8:24:22 2000 From owner-freebsd-chat@FreeBSD.ORG Sun Dec 31 08:24:19 2000 Return-Path: Delivered-To: freebsd-chat@freebsd.org Received: from goliath.siemens.de (goliath.siemens.de [194.138.37.131]) by hub.freebsd.org (Postfix) with ESMTP id 53BA337B400 for ; Sun, 31 Dec 2000 08:24:18 -0800 (PST) X-Envelope-Sender-Is: andre.albsmeier@mchp.siemens.de (at relayer goliath.siemens.de) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.11.0/8.11.0) with ESMTP id eBVGO7H24650; Sun, 31 Dec 2000 17:24:07 +0100 (MET) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) by mail3.siemens.de (8.11.1/8.11.1) with ESMTP id eBVGO6V14024706; Sun, 31 Dec 2000 17:24:06 +0100 (MET) Received: (from localhost) by curry.mchp.siemens.de (8.11.1/8.11.1) id eBVGO6046118; Date: Sun, 31 Dec 2000 17:24:05 +0100 From: Andre Albsmeier To: Andre Albsmeier Cc: Greg Lehey , "G. Adam Stanislav" , chat@FreeBSD.ORG Subject: Re: Removing GNU from kernel Message-ID: <20001231172405.A5383@curry.mchp.siemens.de> References: <20001230122630.A247@whizkidtech.net> <20001231121623.D3496@wantadilla.lemis.com> <20001231124556.A99615@curry.mchp.siemens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001231124556.A99615@curry.mchp.siemens.de>; from andre.albsmeier@mchp.siemens.de on Sun, Dec 31, 2000 at 12:45:56PM +0100 X-Echelon: BND CIA NSA Mossad KGB MI6 IRA detonator nuclear assault strike Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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