Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp811591ybg; Wed, 10 Jun 2020 14:32:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP/FgNua98lORPBIxiVgxRB7MLhiao42k8PDaYfMwSbC+RO2C5Wr72F9DDpWoU6hxk/0NX X-Received: by 2002:aa7:c790:: with SMTP id n16mr4410978eds.54.1591824740905; Wed, 10 Jun 2020 14:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591824740; cv=none; d=google.com; s=arc-20160816; b=jLz44OnbxZ+7vc7L5yydDdh/bslKCwFeNuSW9FhWQCY26VfMC3xvdw8ofpwH5J/m0V UfNTmbF0nideGPE2Ft54xfZwEorHPU3VVXQ4DcqgQLYMbegGpm9f/uEnWgnZZviyGw3i NaSUjbWMfvM8vX1yiPPlgY+D5C0wDDqpCWqVyLhphfA4LSTkSLKTKz3tx2cBA7vox6lq 4ADjGXxh4PDRSb5T3/IlynqE1K3dTl3+7xdtFvdmgCbWIisxJKjfZ/s0qjHMvezHt+q9 pny3dsuP9tUTu31YvcMTHsan3AjwGUbQ+wNtC4c2EeiEVJouoNumWtnXwa+v9lp5omje BVpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gwps3c311yg/MfAkhuFrXNzWVeR3Kl/1PpIlzVubD9w=; b=Y5U9xpgFrSQc2+jEg5tH2WAW7b2/7guOcd48tKrRbInWLgyRNwN9hYpBNwDpOwIq/Z NLPEaOUoeBYdTDA4A5K2NC4c8Or6U3S88p0Ma6wFCg0rN/iN5NJPMWrd8gw1J/JXaAHe ifiAda7ZTUo+lQuDZpDby7IkJsyp2j8GutSIdTjDNVxSgK1Xyl+fAW04/bckdcTJOJDd RlBPX0HM1m3wwRH5WH1ieaL8ILGOopJQNSy5BGhq1Af5NBiw5JZyYrbPSFNMZPsEzXJJ x5/cgfxSdITGaLAMJ7QhB4i842+X9BWsw4g+Hr9rai3QmLbVDxwdqbhwplSs9uBru3sO dH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AL2O2+Mq; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si726151ejf.178.2020.06.10.14.31.57; Wed, 10 Jun 2020 14:32:20 -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=@google.com header.s=20161025 header.b=AL2O2+Mq; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbgFJV2K (ORCPT + 99 others); Wed, 10 Jun 2020 17:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgFJV2K (ORCPT ); Wed, 10 Jun 2020 17:28:10 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F27C03E96B for ; Wed, 10 Jun 2020 14:28:08 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id a45so2413143pje.1 for ; Wed, 10 Jun 2020 14:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gwps3c311yg/MfAkhuFrXNzWVeR3Kl/1PpIlzVubD9w=; b=AL2O2+Mq9RUcdHaCOovRWqzV5qa8/KYWOREbqMw8pLmJCR5vQoddwquiTZ91KjfhOs p+3ac1kKvIUSGM5Ss0Ko5eUHizcJMkt07eFm2zS2cNr2K9ansB/jNw9Z867A2Cru+cXL vDqO/yqjmR0+As98a9cqsu3CUDj9nZp9hblnzKGsq32xcm8AUzMPAo3o56ivjcyQIhFv +sxoLTzbIlIvZPUSCtn8WTQfYKVDj7sCSifiyjt2x7wFlE+bsctxEAiWG4lo+y2hx86Y X+U9iZEEQGMe0GoE+Yeto4PdJKum8Yn6JaAn0Q7zTFUFowBhhnAsQhgdpZ2n3ZQCw+NT Ttpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gwps3c311yg/MfAkhuFrXNzWVeR3Kl/1PpIlzVubD9w=; b=PkyVDAujEOVQjg+0YZqVTgS0tOG9y0MkPsf8FbaDbF/MoG/SnlmA4ZTL5pQvV7PR7b yyPm186vY1BI8OjolOK+a20VsvzRoH56u944ctLc4AaKT1k8b16GJskdZyLvrlpinOjD 2PrjNXrmPczJowYBlpWJ7piOUeiFNprgB8VngycD8IzEc2X0hnCjq8yeATiVSbbimgX2 ZZdWkzLPpjDX95xBwSMPEMd23r09YBJuk8QDj/29Ce0ZO+X2Q71oQeBmpxnpXbwb8jZg 3ERqH/D4xU4ZSt2PYS7wmCSU+JeuL+Vl1ks8oQc3gkmKLBUdSzXjfPl52blDEFHlI/PM hdTg== X-Gm-Message-State: AOAM533xL4ybKB5azPe1JYJY0KAT97RTaFVs0d45NRzfcEFjHjGbHAnv SY8AuJUwlDMP6Kh/QozbZ4zj/Hkck9KjZ/nNqu55KQ== X-Received: by 2002:a17:902:7201:: with SMTP id ba1mr4515817plb.223.1591824487405; Wed, 10 Jun 2020 14:28:07 -0700 (PDT) MIME-Version: 1.0 References: <20200610063715.v2qrqvwtegdxdwzl@google.com> <20200610191106.2662548-1-nivedita@alum.mit.edu> In-Reply-To: <20200610191106.2662548-1-nivedita@alum.mit.edu> From: Nick Desaulniers Date: Wed, 10 Jun 2020 14:27:55 -0700 Message-ID: Subject: Re: [PATCH] Makefile: Improve compressed debug info support detection To: Arvind Sankar Cc: Masahiro Yamada , Fangrui Song , Rong Chen , kernel test robot , kbuild-all@lists.01.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 12:11 PM Arvind Sankar wrote: > > 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. Thanks for the patch! In that case, should we consider dropping the cc-option check from the Kconfg then, too? It seems it would help for clang-4 and older, since they do error about the unknown option, but I'm not too worried about trying to support that version of Clang with this config. > 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. It kind of sounds like the assembler must be invoked to verify this will work for the cflags then? > > 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 > Signed-off-by: Arvind Sankar Does this imply all feature tests of as-option with -W(comma)... are broken? IIUC, then the assembler is still not invoked, much as in this case? (as in they all pass when maybe they should not?) (or based on below, maybe just the Kconfig from 74afda4016a74 in arch/arm64/Kconfig, AS_HAS_PAC) In the other thread, you discussed -c vs -s. It looks like -c is used for as-option, so I expect the assembler to be invoked. Maybe we should look at the mismatch between Kbuild and Kconfig regarding -c vs -s in scripts/Kbuild.include vs scripts/Kconfig.include? Otherwise it sounds like cc-option cannot be used to check for `-Wa,` flags in Kconfig, since if the assembler is never invoked, it may appear that GCC has support for -Wa,--compress-debug-sections=zlib when it indeed does not. > --- > 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 > -- Thanks, ~Nick Desaulniers