Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp287414pxu; Fri, 11 Dec 2020 02:19:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlVHDf/8bsa6WRQ8lxJitpMUCWGe0iTRu7OWD2J6PFdg/2lPI9XPGmmG0/0AmLk38LZYtV X-Received: by 2002:a17:907:9705:: with SMTP id jg5mr10369002ejc.448.1607681956185; Fri, 11 Dec 2020 02:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607681956; cv=none; d=google.com; s=arc-20160816; b=v4UwlkREwhdvdzdNNKFtMnCpUg/U/rfwKCouQM/sp4fteFI0ZQM4VtdaUW+9Oux11J yvrq8EZaJ5fR55g2F5nRqV4Xb8fZ4a7fHqBp1tapHDJiMr01oZuQMsIEJvqdTMWTM+YS UnQLSgpf1T/v4eQs2nDrT0TGtjTVtsVG+NW3mIaRi8InZz3VHiDvOmxOaqI5e/In8wcq j5CVhQTfumHPz4TQQPRLJdegQquLtSMYSgl7piq2dIPArIca1tgTrq7n4MioM4XvEGL2 sQYAqrDFTgAaxVQS9M5Cxitdpq8kSTmvNwNeNkIHPgCEsiKPe0tbJIGSpE6tyLClXOWK hAAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cuo3hOaqklmDAlFeyNMO9tK7FfLVT9BZ8OlP4OtCFqU=; b=jJkxxOwLJy07ZLJs6x8+rMT66zJGMvop4AdKeY35oMn73diTJ8QOQ+zmQ1fe5vBx8p LhCgqXVscIQUKlIfEfVeUSMaWO/XIx3BAMHcdJM/BBtwtSdUHw1IoYipudbQ4S+eLRb+ XyqKCeeGzrWT6F0U48jRK+WagF8mcqfFRmx4VhzZEc6H4KwuY9ZBoV1Dox26bPyvcAWi 8FmmVBh4+qro8Ud4LblE85PNG3LmdtD3ukxvhvvj9A1fLyrZlDE2X9wr56bzU8jf9hh3 YNsXsiUSpHZ0YCTkSiHUUXBe1Zmx7Ci5KZujNZ3nb6S5/89d5E6UZs3VJpnB5lxX/Rqe 0KFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=loFvrO8O; 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 dm3si4347849edb.547.2020.12.11.02.18.53; Fri, 11 Dec 2020 02:19:16 -0800 (PST) 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=loFvrO8O; 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 S2394327AbgLJXUA (ORCPT + 99 others); Thu, 10 Dec 2020 18:20:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394206AbgLJXTi (ORCPT ); Thu, 10 Dec 2020 18:19:38 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 902A7C061793 for ; Thu, 10 Dec 2020 15:18:58 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id n1so3029867pge.8 for ; Thu, 10 Dec 2020 15:18:58 -0800 (PST) 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=cuo3hOaqklmDAlFeyNMO9tK7FfLVT9BZ8OlP4OtCFqU=; b=loFvrO8ObA/6GshmdsKH7qoI9iCisWk9O7eMVsEDDZ7795PK+dK/Q+MwLj0jnH2RFz vH6+g/5LTdZhvhkEFVoIddq3QyjSAE3in4aK+MoNY+uX1lEgr3aoFQXm+PzxS5sajEEA tByw4b/yDS3LOmXy1Fag/9bVMqWF75R3JnSNCZ9MIe7dxlBFqTnDaRd/X/eWIOzlB56o DiOCxZOKFuuoao5akTG99bCddkdqOFHs+sIWXA+IqBtcNvihhXQAnQnyrFdCjPSEjhcx PYnf4I2cmhjEEB8BpxDv4p7d05/5F3UEPkaYM19XqyMZGGUjGGnVp1aCmldrS1pBtQQV R9Wg== 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=cuo3hOaqklmDAlFeyNMO9tK7FfLVT9BZ8OlP4OtCFqU=; b=nbSBfGNSvDftuzRuL+PfQaM22ydmNx6ykru+UZGf2UVPvEnhY6131jxn4Zd4vAc02y 8F1QTw1kuBkUiDvyQsCpg2c+PReXX19z/s/iXyuzZeP9VR2iTwDMfImYpPOYWC0XGUSA J2JuM+lu6u/f9iiFUY0s69SXBKONPzIA1/vWTM9q5agDgHM9blXE+xe8thrNkZjmXDR+ YpZmYue1Deg8PjtMetW3HFuFrp8t41aazD9Q0hI+LGnIjqxI0/d1/7RyCHAgbzcpnnv8 0Salwi0OlnvOR3QdGKMNUuMqf7A+bHKI5+8F+Tl1csb0I620T2ts60qsGZAsIhkT+alu gECw== X-Gm-Message-State: AOAM531219O2ylbfOzLIPgQYjA6HZQ8Qxadbufd9xxAr4/rdRFaK+b1j tAaiOvh1cb7n5TonSZf/M+GHqUNZyrhDwnbsDCYHHA== X-Received: by 2002:a63:184c:: with SMTP id 12mr1370518pgy.381.1607642337689; Thu, 10 Dec 2020 15:18:57 -0800 (PST) MIME-Version: 1.0 References: <20201104005343.4192504-1-ndesaulniers@google.com> <20201104005343.4192504-5-ndesaulniers@google.com> <20201124172836.GA346213@rani.riverdale.lan> In-Reply-To: From: Nick Desaulniers Date: Thu, 10 Dec 2020 15:18:45 -0800 Message-ID: Subject: Re: [PATCH v2 4/4] Kbuild: implement support for DWARF v5 To: Arvind Sankar , Masahiro Yamada Cc: Jakub Jelinek , Linux Kbuild mailing list , Linux Kernel Mailing List , linux-toolchains@vger.kernel.org, clang-built-linux , Fangrui Song , Nathan Chancellor , Sedat Dilek , Dmitry Golovin , Alistair Delva Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 4, 2020 at 9:06 AM Arvind Sankar wrote: > > On Thu, Dec 03, 2020 at 03:28:14PM -0800, Nick Desaulniers wrote: > > On Thu, Dec 3, 2020 at 3:22 PM Nick Desaulniers wrote: > > > > > > On Tue, Nov 24, 2020 at 9:28 AM Arvind Sankar wrote: > > > > > > > > On Tue, Nov 03, 2020 at 04:53:43PM -0800, Nick Desaulniers wrote: > > > > > DWARF v5 is the latest standard of the DWARF debug info format. > > > > > > > > > > Feature detection of DWARF5 is onerous, especially given that we've > > > > > removed $(AS), so we must query $(CC) for DWARF5 assembler directive > > > > > support. GNU `as` only recently gained support for specifying > > > > > -gdwarf-5. > > > > > > > > With gcc, using -gdwarf-5 even without -Wa,--gdwarf-5 results in > > > > considerably smaller debug info. gcc does not seem to generate the .file 0 > > > > directive that causes older GNU as to barf. > > > > > > > > Should the assembler support check be restricted to CC_IS_CLANG? > > > > > > No, because if LLVM_IAS=1 then the assembler support need not be checked. > > > > Also, if your version of GCC supports DWARF Version 5, but your > > version of GAS does not, then I'm more inclined to not allow > > CONFIG_DEBUG_INFO_DWARF5 to be selectable, rather than mix and match > > or partially support this for one but not the other. Either all tools > > used support DWARF 5, or you don't get to use DWARF 5. > > > > Why? Does this actually cause any problems? > > It seems like the options for gcc can actually be very straightforward: > you just need a cc-option check, and then add -gdwarf-N to both CFLAGS > and AFLAGS and you're done. Adding the -Wa flag is superfluous and > carries the risk of interfering with what the compiler driver does. Just > let the gcc driver handle the details. > > Clang/IAS is almost as straightforward, with the only additional edge > case being that for assembler files, DWARF 2 doesn't work, so the CFLAGS > is the same -gdwarf-N, but AFLAGS gets -gdwarf-N only if N > 2. > > The messy case is only Clang/IAS=0, which needs to check the support > from the external assembler, and needs CFLAGS of -gdwarf-N and AFLAGS of > -Wa,--gdwarf-N, because Clang doesn't pass that option on to an external > assembler. This is why I was asking if the assembler support check can > be restricted to CC_IS_CLANG: nothing but Clang/IAS=0 actually requires > that check. Oh, I see. Yeah, that might be a nicer approach. What should we do in the case of gcc < 7 though, where -gdwarf-5 won't produce DWARF v5? Maybe that's ok, but the intent behind the Kconfig check was to prevent the option from being selectable if the tools do not support it. Maybe it's more flexible to pass the arguments along, and hope for the best? As a gcc-5 user, I might be surprised if I chose CONFIG_DEBUG_INFO_DWARF5 if what I got was not actually DWARF v5; it does violate the principle of least surprise. Maybe that doesn't matter though? -- Thanks, ~Nick Desaulniers