From: Mike Hommey <mh@glandium.org>
To: Jeff King <peff@peff.net>
Cc: Alexander Kuleshov <kuleshovmail@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: [PATCH] Makefile: do not compile git with debugging symbols by default
Date: Fri, 23 Jan 2015 00:09:14 +0900 [thread overview]
Message-ID: <20150122150914.GA20135@glandium.org> (raw)
In-Reply-To: <20150122130036.GC19681@peff.net>
On Thu, Jan 22, 2015 at 08:00:36AM -0500, Jeff King wrote:
> On Thu, Jan 22, 2015 at 06:50:37PM +0600, Alexander Kuleshov wrote:
>
> > Standard user has no need in debugging information. This patch adds
> > DEBUG=1 option to compile git with debugging symbols and compile without
> > it by default.
>
> This explanation is missing why it is beneficial _not_ to have the
> debugging information.
>
> I expect the answer is "it makes the executable smaller". And that is
> true, but it gets smaller still if you run "strip" on the result:
>
> $ make CFLAGS= >/dev/null 2>&1 && wc -c <git
> 2424248
>
> $ make CFLAGS=-g >/dev/null 2>&1 && wc -c <git
> 4500816
>
> $ strip git && wc -c <git
> 2109200
>
> So I am not sure who this is helping. If you are size-conscious, you
> should use strip, in which case the "-g" flag does not matter (and we
> even have "make strip" to help you).
>
> Is there some other reason to avoid the debugging information?
Maybe this comes from the misconception that debugging information
changes the generated code, which, in fact, it doesn't.
$ make CFLAGS=-g LDFLAGS=-Wl,--build-id=none >/dev/null 2>&1 && wc -c <git
4432768
$ strip --strip-debug git && wc -c < git
2391120
$ cp git git_
$ make -j4 CFLAGS= LDFLAGS=-Wl,--build-id=none >/dev/null 2>&1 && wc -c <git
2400192
$ strip --strip-debug git && wc -c < git
2391120
$ diff -s git git_
Files git and git_ are identical
LDFLAGS=-Wl,--build-id=none just avoids creating a .note.gnu.build-id
section containing a uuid that varies between builds. The 9k difference
between unstripped vs stripped for the no-debug-info case comes from the
removal of the few symbols for source file names (all the symbols from
readelf -s git | grep ABS).
Mike
next prev parent reply other threads:[~2015-01-22 15:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 12:50 [PATCH] Makefile: do not compile git with debugging symbols by default Alexander Kuleshov
2015-01-22 13:00 ` Jeff King
2015-01-22 15:09 ` Mike Hommey [this message]
2015-01-22 16:51 ` Alexander Kuleshov
2015-01-22 16:53 ` Alexander Kuleshov
2015-01-22 17:36 ` Matthieu Moy
2015-01-22 18:35 ` Jeff King
2015-01-22 22:55 ` Mike Hommey
2015-01-27 8:43 ` David Aguilar
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=20150122150914.GA20135@glandium.org \
--to=mh@glandium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kuleshovmail@gmail.com \
--cc=peff@peff.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;
as well as URLs for NNTP newsgroup(s).