linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Sankar <nivedita@alum.mit.edu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Fangrui Song <maskray@google.com>,
	Rong Chen <rong.a.chen@intel.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	kernel test robot <lkp@intel.com>,
	kbuild-all@lists.01.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Makefile: Improve compressed debug info support detection
Date: Wed, 10 Jun 2020 15:11:06 -0400	[thread overview]
Message-ID: <20200610191106.2662548-1-nivedita@alum.mit.edu> (raw)
In-Reply-To: <20200610063715.v2qrqvwtegdxdwzl@google.com>

Commit
  10e68b02c861 ("Makefile: support compressed debug info")
added support for compressed debug sections.

Support is detected by checking
- does the compiler support -gz=zlib
- does the assembler support --compressed-debug-sections=zlib
- does the linker support --compressed-debug-sections=zlib

However, the gcc driver's support for this option is somewhat
convoluted. The driver's builtin specs are set based on the version of
binutils that it was configured with, and it reports an error only if
the assembler (or linker) is actually invoked.

The cc-option check in scripts/Kconfig.include does not invoke the
assembler, so the gcc driver reports success even if it does not support
the option being passed to the assembler. Combined with an installed
version of binutils that is more recent than the one the compiler was
built with, it is possible for all three tests to succeed, yet an actual
compilation with -gz=zlib to fail.

Moreover, it is unnecessary to explicitly pass
--compressed-debug-sections=zlib to the assembler via -Wa, since the
driver will do that automatically.

Convert the as-option to just -gz=zlib, simplifying it as well as
performing a better test of the gcc driver's capabilities.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 Makefile          | 2 +-
 lib/Kconfig.debug | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 839f9fee22cb..cb29e56f227a 100644
--- a/Makefile
+++ b/Makefile
@@ -842,7 +842,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO_COMPRESSED
 DEBUG_CFLAGS	+= -gz=zlib
-KBUILD_AFLAGS	+= -Wa,--compress-debug-sections=zlib
+KBUILD_AFLAGS	+= -gz=zlib
 KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
 endif
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cb98741601bd..94ce36be470c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -229,7 +229,7 @@ config DEBUG_INFO_COMPRESSED
 	bool "Compressed debugging information"
 	depends on DEBUG_INFO
 	depends on $(cc-option,-gz=zlib)
-	depends on $(as-option,-Wa$(comma)--compress-debug-sections=zlib)
+	depends on $(as-option,-gz=zlib)
 	depends on $(ld-option,--compress-debug-sections=zlib)
 	help
 	  Compress the debug information using zlib.  Requires GCC 5.0+ or Clang
-- 
2.26.2


  reply	other threads:[~2020-06-10 19:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 13:11 gcc-5: error: -gz is not supported in this configuration kernel test robot
2020-06-09 17:28 ` Nick Desaulniers
2020-06-09 17:49   ` Fangrui Song
2020-06-10  0:30     ` [kbuild-all] " Rong Chen
2020-06-10  0:58       ` Fangrui Song
2020-06-10  1:49         ` Rong Chen
2020-06-10  3:12           ` Arvind Sankar
2020-06-10  3:23             ` Arvind Sankar
2020-06-10  4:26               ` Arvind Sankar
2020-06-10  6:37                 ` Fangrui Song
2020-06-10 19:11                   ` Arvind Sankar [this message]
2020-06-10 21:27                     ` [PATCH] Makefile: Improve compressed debug info support detection Nick Desaulniers
2020-06-10 23:30                       ` Arvind Sankar
2020-06-10 23:39                         ` Arvind Sankar
2020-06-11 20:44                           ` Nick Desaulniers
2020-06-11 21:44                             ` Arvind Sankar
2020-06-11 21:09                         ` Nick Desaulniers
2020-06-11 21:52                           ` Arvind Sankar
2020-06-11 22:03                           ` [PATCH v2] " Arvind Sankar
2020-06-11 23:38                             ` Nick Desaulniers
2020-06-14  2:21                               ` Masahiro Yamada

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=20200610191106.2662548-1-nivedita@alum.mit.edu \
    --to=nivedita@alum.mit.edu \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=masahiroy@kernel.org \
    --cc=maskray@google.com \
    --cc=ndesaulniers@google.com \
    --cc=rong.a.chen@intel.com \
    /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).