Re: [PATCH] Makefile: do not compile git with debugging symbols by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]