Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp885745pxu; Thu, 3 Dec 2020 15:27:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJywwLWyHrVT1XFaEy23Z7cE4popFowyVS9bE+Ne1SM1+DhBcVTIQt9ms12Y8693UBf1qYty X-Received: by 2002:a50:f98b:: with SMTP id q11mr5068690edn.345.1607038055650; Thu, 03 Dec 2020 15:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607038055; cv=none; d=google.com; s=arc-20160816; b=JV5tOm9iw3OLHm5jV+zIPAX7LbF3tm9xH7GOUezA2+v/R2bO3XC3QJS0eStrZuty9Y wDtGxEqz4PZEQmqz3RfxMrmGw7CkYSKPL65GJM1d+dZBaIMmFUM2VaceTMJIH3uH+6iw H+i3npdkZeeho7mFY16Vvgak/iXKCg9gHB2KkQ0lfAsMbtnMLyrHjZOJolm1pq0DkZ/L OOpDxak4X2izXiocohAP72J3FTFdsnuRwABfrgh2V0BU6jQjZ/orS/MD9nPoZOqILrPi Ah9Wd24kTiMwkGVMb+aOced+nPPqoXhiU8KTIeHe3QEjByL+dynm+4LAvK2oOLrlfEZJ ylag== 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=S2evVpZUx4sUY7dWUP7rv8pY8q8EVmsWGDPP1XnlIFk=; b=QLXoKFmARKuac9o+ADODeMLr+OTaLp0gF8wJ0JznHRoXWKwtNuS5NBvkqcLj5/EViN ROSbTG8iLst6K37YmK0vx+7ImCoI7w3cF6yQunULtQLsCuQJzRfyyYPawzeqPs4MRoNJ SiapDn++beXJTXcroaGDVKWr2QowY05vZmiSePRN3J5m1ZRgzxQRMTt+aoFKvSCHjw9s 1iEvHwKt2eP9X0kTOjDew9QOHi7WElCzmprDi/Ot53WRCLuuPUe1y/Cv+IUVfc/Rjd2y etMbb8x6KyCzXr/3zuvaDrErvE96ky1n34II72zleg/9OaAv7JmLYOwWFOMUcniVMXK2 Wsjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WXnuoy84; 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 q19si2040728edv.85.2020.12.03.15.27.12; Thu, 03 Dec 2020 15:27:35 -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=WXnuoy84; 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 S1728593AbgLCXXN (ORCPT + 99 others); Thu, 3 Dec 2020 18:23:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbgLCXXN (ORCPT ); Thu, 3 Dec 2020 18:23:13 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C23C061A51 for ; Thu, 3 Dec 2020 15:22:26 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id x24so2381366pfn.6 for ; Thu, 03 Dec 2020 15:22:26 -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=S2evVpZUx4sUY7dWUP7rv8pY8q8EVmsWGDPP1XnlIFk=; b=WXnuoy84v9PFoh0yGywWUCdQtzX/ZN11G5fmsPPcyfgwYUVDhtfFmSY2dF81SliPjo bGT2Og1S58EhP/WctvWmW32jBosDdo15bXBZJJiLqUQldLXgdhmAHrkmEzcUdaQLrV/D Hz62BG50vOqBLptXseMWP+t3YltwmaAnYLeY6t2NEc/PZR3RMLZyFIlGPkQ9NNj8Z4UI m7auC5CxI3a+dxWFl0NLDGy3Du6wUoKzCEqBOwSiJvtYUdfsmqAd0XyLA8y9EovstVK4 UVCasyFJa2CyPrl2BhjfzyfS1QcHqDAQWsZ6kUBdo08n9iZckpe1jlYbBLFDtUrpr+P2 gGlQ== 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=S2evVpZUx4sUY7dWUP7rv8pY8q8EVmsWGDPP1XnlIFk=; b=X3pRQ1aM9HElLtDeCU7dJX+cSZG0QZ283LQbYx0thhPCWpOGzNXhRzofrgaKJN1UPR WSYyds2wQbfhgBHjwS5BpIZym4405nSD0QNRN06VJ2BjTZKR5iOibk6Z7DWitWpdpYhe C0pYyaE26R4jMXR1Z5czUFDp8XWx61RLed/hFR1hk3YfKS/b3KdFRUDWE7BB1/uNU/Yg P+VgIrZ8VoZRdKAdgHx9QvxokZ2Gj/MMe15soq0Wmj4N6y7uMKaFwRLQtorrHGmdc6lv PRJMFMU3/xZO4z8eHedJcjZpAHfH77ig1LCGUY/NEzWJIk4buAeLnDiLadNlhxcSr+5u nYGQ== X-Gm-Message-State: AOAM532EBsqxE91lB/MUexeUcoKnUHAvsnFfkVmtaHvcUHaUZHS0nrie nFPiPPBcHoRzbzZXhUOLsr8UQk+aCzRv+X08KxdSEA== X-Received: by 2002:a63:8f4f:: with SMTP id r15mr5060126pgn.381.1607037746077; Thu, 03 Dec 2020 15:22:26 -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: <20201124172836.GA346213@rani.riverdale.lan> From: Nick Desaulniers Date: Thu, 3 Dec 2020 15:22:14 -0800 Message-ID: Subject: Re: [PATCH v2 4/4] Kbuild: implement support for DWARF v5 To: Arvind Sankar Cc: Masahiro Yamada , 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 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. > > > /* Stabs debugging sections. */ > > #define STABS_DEBUG \ > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > index 03c494eefabd..c5b54ba51060 100644 > > --- a/lib/Kconfig.debug > > +++ b/lib/Kconfig.debug > > @@ -274,6 +274,14 @@ config DEBUG_INFO_DWARF4 > > It makes the debug information larger, but it significantly > > improves the success of resolving variables in gdb on optimized code. > > > > +config DEBUG_INFO_DWARF5 > > + bool "Generate DWARF5 debuginfo" > > + depends on $(cc-option,-gdwarf-5) > > + depends on $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS)) > > + help > > + Genereate dwarf5 debug info. Requires binutils 2.35+, gcc 5.1+, and > > + gdb 8.0+. > > + > > endchoice # "DWARF version" > > Perhaps this can be expanded with some description of the advantages of > dwarf5 over dwarf4? Will do. > > > > > config DEBUG_INFO_BTF > > diff --git a/scripts/test_dwarf5_support.sh b/scripts/test_dwarf5_support.sh > > new file mode 100755 > > index 000000000000..156ad5ec4274 > > --- /dev/null > > +++ b/scripts/test_dwarf5_support.sh > > @@ -0,0 +1,9 @@ > > +#!/bin/sh > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +# Test that assembler accepts -gdwarf-5 and .file 0 directives, which were bugs > > +# in binutils < 2.35. > > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25612 > > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25614 > > +set -e > > +echo '.file 0 "filename"' | $* -Wa,-gdwarf-5 -c -x assembler -o /dev/null - > > This also actually needs --gdwarf-5 to really check the support for the > option, but older versions should error on the .file 0 in any case. Based on Jakub's feedback on the earlier thread https://lore.kernel.org/lkml/20201104121934.GT3788@tucnak/ it sounds like the dwarf version also needs to be dumped since GCC 5 < x < 7 accepts --gdwarf-5, but did not produce DWARF Version 5 debug info. -- Thanks, ~Nick Desaulniers