Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp942003ybk; Wed, 20 May 2020 16:25:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL6I+bNDbjYgpdzK248A9ow6FyKpxAV8BFpf9kyKebct/ujCYneOon8OT9HVcjqLdKP1P3 X-Received: by 2002:aa7:d3d6:: with SMTP id o22mr5430561edr.310.1590017131137; Wed, 20 May 2020 16:25:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590017131; cv=none; d=google.com; s=arc-20160816; b=xpsg7fHw2In7594N+NZ7kt8LLh0+deFZBK2C4xIyECGyUfMbyNmTI99epiQHJ1sgMI YvQ0hOl4NEMPca/cGFdD/G7dS3omKqtEqitjRmgeg3r18fr7ztg/JRFSO7o57wE5bkcP cC7GER5fgPkD09+AH//PPMVAWGPGBQZBCWonPJsfblNC9aoeKTHNpASUt1g8yhaE37OI QJ3jxSFTQ+Si4ZbBceRu/sRW9un/Hk/d/+kwL6EMKn6voqJfbwY3fTplgRpbMIJkCaPs tzL/ANQQnmRHXo59+k6MAx79ZrRuVRRUiQjhJpkf76JxHCrWJ3SWFEX7qrsM4F3j1V57 9gmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8g3Dac+0vDO5MefIu70MRuqaKQAyM6L5XLCOcEhaZOY=; b=gPs0Fl2jlXJUJBFMSTIM9qCtPvoOOG8YvGWt9NIy/KVyQEl+Fx2iQOgDBTKri+UtTM fMHV43pVW3FpwLb5V/skSR9xtO7PNvEM7i8nVaM0neiUTCbikh4fknzdCry1CpXgOKZ0 ex9iCI5Xcd6LL22p8F+UoG/XcUugPDlkgxl5G7tcWnMlETvOIGV3pH5+uSseB3gWQXDe veLK7bfQ7D1Ow4srlIHf70kZX5Sz/oqSfrv4QcFPFznQLAFBOo0BMtxCaj7qcXTsOi3f XeiSRBADHRHPs8D9OGnw7MHES1QX6HDu6Ppu48qDGRkDmwR6M1/EiRTIvHeIhYmf8Dxp Yedw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lLOeQzkh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si2475205ejs.548.2020.05.20.16.25.08; Wed, 20 May 2020 16:25:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lLOeQzkh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728683AbgETXWI (ORCPT + 99 others); Wed, 20 May 2020 19:22:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:49320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728754AbgETXWE (ORCPT ); Wed, 20 May 2020 19:22:04 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56BB52070A; Wed, 20 May 2020 23:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590016922; bh=AsSVm6NLAAijnxZcRLGgoFhfjji3z54uqps3wBlWm/Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lLOeQzkh+QC8uwlwZLPY1lfaxSrGob0cJXqpDGWwnj6ZI10Lk4vmWj7uTli2UBhgc 1AxRyHJwQfkIb3BFg90Pn2rNvQn5c1Z0x9FrQ+oRTz8gg/n71dkcUfIcVtn/XZqELr rVWygvDl1iHE14aCtpzhZ4w3LZ8ao8D+y9B7N4go= Date: Wed, 20 May 2020 16:22:01 -0700 From: Andrew Morton To: Nick Desaulniers Cc: Masahiro Yamada , Sedat Dilek , Fangrui Song , Nick Clifton , David Blaikie , Michal Marek , Changbin Du , Randy Dunlap , Stephen Rothwell , Mauro Carvalho Chehab , Anshuman Khandual , Krzysztof Kozlowski , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH v2] Makefile: support compressed debug info Message-Id: <20200520162201.0d18667c12c144c09112cdfc@linux-foundation.org> In-Reply-To: <20200520193637.6015-1-ndesaulniers@google.com> References: <10f4fb0b-1012-b0e6-af05-0aa5a906de21@redhat.com> <20200520193637.6015-1-ndesaulniers@google.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 May 2020 12:36:36 -0700 Nick Desaulniers wrote: > As debug information gets larger and larger, it helps significantly save > the size of vmlinux images to compress the information in the debug > information sections. Note: this debug info is typically split off from > the final compressed kernel image, which is why vmlinux is what's used > in conjunction with GDB. Minimizing the debug info size should have no > impact on boot times, or final compressed kernel image size. > > All of the debug sections will have a `C` flag set. > $ readelf -S > > $ bloaty vmlinux.gcc75.compressed.dwarf4 -- \ > vmlinux.gcc75.uncompressed.dwarf4 > > FILE SIZE VM SIZE > -------------- -------------- > +0.0% +18 [ = ] 0 [Unmapped] > -73.3% -114Ki [ = ] 0 .debug_aranges > -76.2% -2.01Mi [ = ] 0 .debug_frame > -73.6% -2.89Mi [ = ] 0 .debug_str > -80.7% -4.66Mi [ = ] 0 .debug_abbrev > -82.9% -4.88Mi [ = ] 0 .debug_ranges > -70.5% -9.04Mi [ = ] 0 .debug_line > -79.3% -10.9Mi [ = ] 0 .debug_loc > -39.5% -88.6Mi [ = ] 0 .debug_info > -18.2% -123Mi [ = ] 0 TOTAL > > $ bloaty vmlinux.clang11.compressed.dwarf4 -- \ > vmlinux.clang11.uncompressed.dwarf4 > > FILE SIZE VM SIZE > -------------- -------------- > +0.0% +23 [ = ] 0 [Unmapped] > -65.6% -871 [ = ] 0 .debug_aranges > -77.4% -1.84Mi [ = ] 0 .debug_frame > -82.9% -2.33Mi [ = ] 0 .debug_abbrev > -73.1% -2.43Mi [ = ] 0 .debug_str > -84.8% -3.07Mi [ = ] 0 .debug_ranges > -65.9% -8.62Mi [ = ] 0 .debug_line > -86.2% -40.0Mi [ = ] 0 .debug_loc > -42.0% -64.1Mi [ = ] 0 .debug_info > -22.1% -122Mi [ = ] 0 TOTAL > > For x86_64 defconfig + LLVM=1 (before): > Elapsed (wall clock) time (h:mm:ss or m:ss): 3:22.03 > Maximum resident set size (kbytes): 43856 > > For x86_64 defconfig + LLVM=1 (after): > Elapsed (wall clock) time (h:mm:ss or m:ss): 3:32.52 > Maximum resident set size (kbytes): 1566776 I'm not sure who we're expecting to merge this, but I like shiny things ;) > --- a/Makefile > +++ b/Makefile > @@ -822,6 +822,12 @@ DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ > $(call cc-option,-fno-var-tracking) > endif > > +ifdef CONFIG_DEBUG_INFO_COMPRESSED > +DEBUG_CFLAGS += -gz=zlib > +KBUILD_AFLAGS += -Wa,--compress-debug-sections=zlib > +KBUILD_LDFLAGS += --compress-debug-sections=zlib > +endif > + > KBUILD_CFLAGS += $(DEBUG_CFLAGS) > export DEBUG_CFLAGS > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index b8f023e054b9..5a423cbfaea4 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -225,6 +225,21 @@ config DEBUG_INFO_REDUCED > DEBUG_INFO build and compile times are reduced too. > Only works with newer gcc versions. > > +config DEBUG_INFO_COMPRESSED > + bool "Compressed debugging information" > + depends on DEBUG_INFO > + depends on $(cc-option,-gz=zlib) > + depends on $(as-option,-Wa,--compress-debug-sections=zlib) > + depends on $(ld-option,--compress-debug-sections=zlib) huh, I didn't know kbuild/kconfig could do this. Does it all work as expected when cross-compiling? > + help > + Compress the debug information using zlib. Requires GCC 5.0+ or Clang > + 5.0+, binutils 2.26+, and zlib. > + > + Users of dpkg-deb via scripts/package/builddeb may > + wish to set the $KDEB_COMPRESS env var to "none" to avoid recompressing > + the debug info again with a different compression scheme, which can > + result in larger binaries. > +