From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA1F6C4167B for ; Thu, 3 Dec 2020 23:29:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99F4822482 for ; Thu, 3 Dec 2020 23:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbgLCX3H (ORCPT ); Thu, 3 Dec 2020 18:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729657AbgLCX3H (ORCPT ); Thu, 3 Dec 2020 18:29:07 -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 B322CC061A54 for ; Thu, 3 Dec 2020 15:28:26 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id t8so2386194pfg.8 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=p02Zep/KG5Kxh+q+IxjSWLBg64PdPlUCPbtzL0ne9K2qIaC7+NqbUXgeZnjEh+QC4K hX89Ax7tDIyMX+bvaMZeO/r6qSdV5xS9kOTvhTrfgaSGy3MAdP+usrUJR5+TNOAjharL J3ELswHwcJoywI5X7gQMjDPSJf6+FiLOLMX3U0vtBPAwyahDZ/7uIgVfYthbDPSooYI+ pWnY3yHY71Vcn4LPCxzZrjIc4dCl1j/63QVQt1DCx6AzP5sgGRkmxfWpJDii7zpY/sci j3yrNje/3V2jjughBAXbh2tvpkJQ3aCVIwTZIDCpdE5fMA+qaAbDfgEEaaCb5inedDAT QoDQ== X-Gm-Message-State: AOAM532UOLpzYbD2K631XAx5t0GzERGw49AFtlJiAizeZGA/kL6aobW1 0ZFTqVjVyr8E3wweZQdupAVF1ATWOE1AxFa2iux3yg== X-Google-Smtp-Source: ABdhPJw5+vhOJybk2PqdIzO8tvVhjakR2H8TlBvhIEtUQpj58a9GObaMbVe9KgN6sVYMw0swRHNxFOSQXEoEgcJnQVU= 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-toolchains@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