Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp876723ybg; Wed, 10 Jun 2020 16:33:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoFWB0E3Ny6Grurf1hyUhy88sugse+GH4dtF74qq0NeV8lvJviP9lLDJzZKyxOHoHsAK1z X-Received: by 2002:aa7:d492:: with SMTP id b18mr4663445edr.339.1591832006646; Wed, 10 Jun 2020 16:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591832006; cv=none; d=google.com; s=arc-20160816; b=bHv1b0DIPPbrNWbl6U4OZOe02JiuwIVvsQZI476SwjdbnH/FjhtyjsbZN+pzN9Q134 sMbDvRsZmyD7okSf9rO4lJpIifFGr0fgB/bOV1Gp6OVBs+eDQOis5bopEZ1490Pgfnjv WyTtC3BRozdW0bmkCe8SZU1I2NV7lep/1EMBihh4eAWQptRqMKHHGsiKJ9Yoz2SV3eLK Mt6/DawkOFt1gczWkRLOqdoDz/gJ76MTKxmHtp8DpKVww6ZnpLvPmKCxnrR5oGaU5Qrt bwAKtbgPdkFAvc0ZrdSeQwjT2ap7Mi9JhgURm7TkxQCoBM4aLBZlQuwM5UHzpbKXc1R5 HUvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=EqxFOEid1yw84Q1FNZAR72QP068PBSmquC7v1z9apLE=; b=TpWncj+FTw/49U6McpAClueLhScLXJe0QleTq8gBkXHlZPw8QFSdgOcQmacaLAtsE8 7KDpth1nY9vBplmUg55WWIb2O6/nJ34W8ql0C2o7cgoHk5UPRWJGq+Yb1Y8kArSaBI1J a6NbGB87espHstdkK0Zh8IXAi4I4/epRXZbURuF9h+nmF9m94/Z6n9HuDNC8TVo7fIB8 ON4Vsa2DhX7Vcj8L64knXSEhsEiD15nyOZMMxUOnDUG+VtqiPDp7RI0M/Shsd1Kzrh9f Lo1ktzIUIoZFmOfJvK53pvMZ8QTGOCrxVmB3UxziQYdq6fAYK2f1UsfICK6DBdWrgCbp abFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=t5CGcKvu; 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 do15si1340005ejc.430.2020.06.10.16.33.03; Wed, 10 Jun 2020 16:33:26 -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=fail header.i=@gmail.com header.s=20161025 header.b=t5CGcKvu; 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 S1726782AbgFJXav (ORCPT + 99 others); Wed, 10 Jun 2020 19:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbgFJXav (ORCPT ); Wed, 10 Jun 2020 19:30:51 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F08D7C03E96B for ; Wed, 10 Jun 2020 16:30:49 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id q8so3886949qkm.12 for ; Wed, 10 Jun 2020 16:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EqxFOEid1yw84Q1FNZAR72QP068PBSmquC7v1z9apLE=; b=t5CGcKvuoX3CG7zJYULItgVy06tVzd0hd3wR8qPdboQ++0yabyR+9R41tUtsNvPYxd dERjOdXgOzm2+J+Vt7TyD9unYbiJzzQHD0uVEMYg0vNNGAjTf2YubJ2yeuUJ6qWZCI/Q ivmFjOg+KGE7I0M5QbMLYw8BD71iVj3NsHbUW7QB9QleT+TEV1Ai+CREucHOVZ9xlsRQ t6NzINvzjg0UzNRiPRQY6WN15NU1QCD8w5/emgcp5BIXAFXQh4j9vXtggkKIjP7iBPpk LYQ8d3dZC+41WFPgze1qYoINVyDzK/1aDBUuKPfnm41iQYv+tREZnDnd1r3l0XJXstj+ aLCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=EqxFOEid1yw84Q1FNZAR72QP068PBSmquC7v1z9apLE=; b=oUyqnLLezlhA5StdeR/+cZH0SNDzt2/e7Z9GoQqtjTckHYusFiINZTSJ2vxkGHPO3o 09m3p2K8KXPDAWSwGr0KfyEaRrNVF1XYFuCfDRxZ4XH4mIuUJf+yMDQYF8jYG9tnD0LR 2lMA/pLP40399d2/wpjC8WnP38NtMFWgngTVwup2QzdSknVDtL+gNozH7iYlWNafPVVk olC24zv1ba+HFep6MNvQPNFBlXlP86tTgEz5Fd+MXixS8jaJMx4NGnb+0ttJw6y9NrSo 2RxVuy3lrd48kqWoYyu1v7xC+rWvKUskJHZyyGYvTIs/esiiVUUZ6NoNIpeDQUIb3H2D l4Dg== X-Gm-Message-State: AOAM532i90qYpcASx/pqvSxBDOeEcDA795trCqwN3p9GPmK8b2RhraLB FMEtMvDyWQuuOpKrd8i+/JU= X-Received: by 2002:a05:620a:5e9:: with SMTP id z9mr5397165qkg.459.1591831849011; Wed, 10 Jun 2020 16:30:49 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id s4sm873822qkh.120.2020.06.10.16.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 16:30:48 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Wed, 10 Jun 2020 19:30:46 -0400 To: Nick Desaulniers Cc: Arvind Sankar , Masahiro Yamada , Fangrui Song , Rong Chen , kernel test robot , kbuild-all@lists.01.org, LKML Subject: Re: [PATCH] Makefile: Improve compressed debug info support detection Message-ID: <20200610233046.GA2941409@rani.riverdale.lan> References: <20200610063715.v2qrqvwtegdxdwzl@google.com> <20200610191106.2662548-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 02:27:55PM -0700, Nick Desaulniers wrote: > 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. Also for gcc4 which doesn't support this at all -- that will report error on cc-option. We don't need to support it, but we shouldn't let it be enabled either. > > > 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? > Yes, the gcc driver reports an error when deciding what to pass to the assembler for -gz=zlib, if it was configured with a linker that does not support the flag. It's even more weird actually -- if it was configured with a linker that supports the flag but an assembler that doesn't, it will silently eat the flag when calling the assembler. At least that won't break anything, though none of the .o files will be compressed. > > > > 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) No, as-option does invoke the assembler. The problem here is that with -Wa, the option is only seen by the assembler, not the gcc driver. So it will succeed because the assembler supports it, but it will not test whether the gcc driver also supports it. > > 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. > Yeah, we might want to fix the mismatch there. In Kconfig, there aren't any instances of cc-option being used with -Wa, but there certainly are in Kbuild. It actually originally used to only run the preprocessor and got fixed to at least run the compiler in commit 3bed1b7b9d79 ("kbuild: use -S instead of -E for precise cc-option test in Kconfig") > > --- > > 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