Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp888893pxu; Thu, 3 Dec 2020 15:33:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJPJ2VNaIkbfaRG4EajRGYJYS2NquZVUZ0/SaA901HwESq8q9WIcYfz96YuKVX179CyP5M X-Received: by 2002:a05:6402:318f:: with SMTP id di15mr5065555edb.237.1607038392123; Thu, 03 Dec 2020 15:33:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607038392; cv=none; d=google.com; s=arc-20160816; b=k+ZLjM51BYtXKaco6gKYcU+eGZr4YfmQjm0Ab2Xh32H44MXUxQf2UnL5Kk+R6NY3g1 37h4yvyCLPjAUR0OV3sNE2SB6FZYN317qkK6BTx6sHom4zKVXqvVRQ8BnYgb9BUJ7+th X9glndMJzLKJIbZ3jgwSiamNWQ9nAfKNOil7MxhMDIQuIfuCakKG+rXQSQ1Ac6sCflx7 ugNfnUg8Lsjd+8jL9SUCc2UQyBDcAhLm6jqcbQBnUAU14zWKn0DqJGld26Ty4FH2PYhq KYA+yKX/+HOh5gRQbxOf/qPmF8JhrgTaBAD0Ftt+jC6vLCdXVqVSgqklma7wFd6coTGl 2sQw== 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=VZd5mQQ4Yh6641GciI7/R39T5bgJu4Raw0a7sjqJGxc=; b=dMDQ464+13mjE+cjjRF9rUskdZpwSeii4TgAu6PeBc3z/aBycKW+7QVCtlqGvRqI+z C6WFsvgd69YzN9+Cy/xbUIzQ9ySXC36Iezp3G3yitEKc3AK3KURRaFxMCU4AqSMTVbOS EDDzFD6adNTNkvuspYhFyvDrlwRXGY2uE717+GBqZoQNSkljc+MC4atvQcfUuuwox4JR 2DMRpRE1IF7WQtG/PG4lL+R6NQwsfmf+lpF6SaKSnEodKbMMI2LOy5XMJ1znwlzWClCa wDxvHgrkKu+ndeYCjbev0gP83MBQ4E4D6MD3Tn4UwZ41g/z178al2UBaNb1ZS0rt5JZK 6JPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Tl6txBU+; 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 gn38si251804ejc.438.2020.12.03.15.32.48; Thu, 03 Dec 2020 15:33:12 -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=Tl6txBU+; 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 S2387996AbgLCX3N (ORCPT + 99 others); Thu, 3 Dec 2020 18:29:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727080AbgLCX3M (ORCPT ); Thu, 3 Dec 2020 18:29:12 -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 B9EDEC061A55 for ; Thu, 3 Dec 2020 15:28:26 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id t7so2391135pfh.7 for ; Thu, 03 Dec 2020 15:28: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=VZd5mQQ4Yh6641GciI7/R39T5bgJu4Raw0a7sjqJGxc=; b=Tl6txBU+3C9StAbudDXRNLyIAPS31KsI9v4twNU6Lq+WPY8iNFC55TLj2WdGnJasBe m8Os8PGEga/OHzYnd54fc4sQu8wFbUi73y+mDxRe9oGIm+/uJna1eZkgTLcjWILpVTR0 FsFs07nx9N4iB7xQIeReeQ311cqPgZYbuKsWXWACa8Q1/HG85TCg3caSCIY0sQ+h7dJo zmetcLxThqzMpLebJWiyMJBYjMWhPMMEaura+uPwdRrUiU45M9YUT/Hysck9HJhFmpOU V1YtRlRrBovZueUcBi0tjNBAxVi0DCl2XjGILJYVJlWfQXu8Tgfyp1ePvSo93fwGZYii Da8w== 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=VZd5mQQ4Yh6641GciI7/R39T5bgJu4Raw0a7sjqJGxc=; b=Jf7qKT1H1TsvGynSGa5ppmt7D5YCEy703gCBqbrFKlzbXJft/ndD2GKJqFtsuDUgtm fnZfJAjnSH82xQjHcbwk1qPSpSEHVD1/EqK+Mq0+oZ2ZhHkgaZ3jcc6zq/5dQvpXQGVM vNbKVSPp+ihM4o++In9qUZBJF5AfvFATLGYZFKTHe9eS8Bi8lAKgtY952N0Tt+1n6asw hqrDSHYx4z4fSG8Qy4N/nB/jjz4slUbl/F+P++qiSvFJuk+nzz5YO8ndfwSuusuulqTP 4Yu8tBSnNrfa3KDc4Wvq0rmP6BjNR2+Gp11b0Y2XB9bDsj6n5wLZ/l+IMjKdoMXjLafy Bxeg== X-Gm-Message-State: AOAM531P3QCes6ybFnFw0SsTTO1q4SAbkiBrI4UsjSNBTsnDwP/5WXC4 +molHinMwntXHZjDgn6cqEYBu0ytfF4iZHSFPWHFRQ== X-Received: by 2002:a63:3247:: with SMTP id y68mr5151471pgy.10.1607038106075; Thu, 03 Dec 2020 15:28: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: From: Nick Desaulniers Date: Thu, 3 Dec 2020 15:28: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 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. > > > 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. Sigh...llvm-readelf doesn't accept --debug-dump=info for checking the DWARF version; llvm-dwarfdump works with no args...at this point I'm tempted to just version check GCC. -- Thanks, ~Nick Desaulniers