Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp853394pxb; Tue, 3 Nov 2020 14:29:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5yTnu3snVu+aLgjaBsKXrg+o2BlXhNAohmUleKZs2v0us6AzLz6OO7Z+yzLyF+GF2dLVJ X-Received: by 2002:a17:906:c0d8:: with SMTP id bn24mr21685262ejb.480.1604442543187; Tue, 03 Nov 2020 14:29:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604442543; cv=none; d=google.com; s=arc-20160816; b=JdVcEzDf7GTiB948Pi/4I9ARmbd2QrrPvkIhmH/riMjIHk0/8ne69ZECTxuDwvMq89 wuusMeZwj2a15T8ok1xvIR//vYOjyOF0CrPZDdCwTFgtZhTi0M29EQM+gujC8OQ1lsd3 oqNP1uq9mSKSQxsrofxBWJ7z5dFZKss//tlaULgZB0KABFzd2I+bFF9L1QtQ+adP5u1M knNitU7Uj0s7OyOpcQeDIPwbX0p6R8qiCGU7c1s26rqKy+G1mpdoKpkgoth9GQ5zFAuQ oxBbiPgsWqL4faC072Ae6SPFktUif6oJHmuTBVUOJ4mwRABE631N7o3A1rC+/p4vsyaj bxgA== 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=3g/UXdTcvEaVpEpHCFk6DWCyxnMD9jfZ4IYbgmoi5Do=; b=tWlh6KI78UPck2S5tBIEnFyw4BW0vguJWMG5LaTrnghdBFMU05oaS832d9Xceck+vT tOGfHDS9xQTYVZhsFG1A6sOaUkkNTT37xGm8hlznmQIAW8ViCMd6EuLUuebfkC+QyL+c ouePZtmwMLp6Tc6IUqDee9TM82o8AEYspxXWoF9W0iwzzq4MoEE+sTgnI8izxXQB7ekr c2mfVgoNOCSbEBh7hHz2HDhWbh7gKdgT20hz57L3HmHm6HPRocBs3e5eX/SFr/ZWAu9U ExLHMU33bA/ACkR93NxY0VFTb7TwBzkF3r2W6l3GvwNJnkI6OiMLGhQ3qJH19iimstBW +fjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uq428C0M; 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 d14si9596edv.394.2020.11.03.14.28.39; Tue, 03 Nov 2020 14:29:03 -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=uq428C0M; 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 S1729906AbgKCW1R (ORCPT + 99 others); Tue, 3 Nov 2020 17:27:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729342AbgKCW1R (ORCPT ); Tue, 3 Nov 2020 17:27:17 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 465F8C0613D1 for ; Tue, 3 Nov 2020 14:27:17 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id b19so9286752pld.0 for ; Tue, 03 Nov 2020 14:27:17 -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=3g/UXdTcvEaVpEpHCFk6DWCyxnMD9jfZ4IYbgmoi5Do=; b=uq428C0MISj1+Yl3N5njjURIa/fb2YaK/JiA0AEh+acv8LHAXJ7l0yTVpCqIB6Qr3o QRceQ69dCamC4YCnafirBV/b52//G3ZG/U3YJIABb7lP7NPRk4BPkds/NfGKod7xn/AU pVbJDMR8Y/vSDADnZbMUgZFib80urJO1Sb+GncvjQKy9wsVQ3/SBq0jKbcDZ0EVCqCoV QP53Q4L17XlBU1RROAaBjEw/LUqKoF5rQBM+ClVV6UlEChNhO+guriWVeNo7MkjxxVx9 xGA01uekR50k6+ccmbEr+cf/7zkpKcVdUrwRJhEF44xWzdGv3A4UN5QoKt1E2+IKv6J6 kjlg== 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=3g/UXdTcvEaVpEpHCFk6DWCyxnMD9jfZ4IYbgmoi5Do=; b=riaQHq467XWpMIpKElXExCidYBUniagttWiwpGXnflt31yDNrpstFC2BDDA81X3C1R wYUw7JXBLC/gz9TUp/zA4PA6lyEaYf4rP3l1y31ihJBUux9XCpgl4QXYwQiw0LetD51c cGucsLawgcFbILcXKaXRBZ2a0uo9tCMpSG7hWjn6jQcy5qpqPjEED32DN9qqi+gNqEOQ 1GnjXhW1wPVB9cPDMtaQEWeClqjDJTGN4vfj5BiVddFabWL66Qp/WMfuBU4E4Wm03Snl Uvotv52AZHhrCyeuGgCafX8ZBV4BnmQbAX9QEEtCB+sdiGC2gq3RypinAq9Y2zWRnsQL cd0w== X-Gm-Message-State: AOAM532chbqNfxuKcPzPQW8/EGumqd07juMl1z1hvgHLoENd73UKrTBY jJeX2TBlwpJtrSqb5auAIdszEKiuJs+Y2Dw2x3w/Mg== X-Received: by 2002:a17:902:ee85:b029:d6:c43e:2321 with SMTP id a5-20020a170902ee85b02900d6c43e2321mr12767000pld.29.1604442436696; Tue, 03 Nov 2020 14:27:16 -0800 (PST) MIME-Version: 1.0 References: <20201022012106.1875129-1-ndesaulniers@google.com> <20201022014448.mcx5n7unf7kkka3o@google.com> In-Reply-To: <20201022014448.mcx5n7unf7kkka3o@google.com> From: Nick Desaulniers Date: Tue, 3 Nov 2020 14:27:05 -0800 Message-ID: Subject: Re: [PATCH] Kbuild: implement support for DWARF5 To: Fangrui Song Cc: Masahiro Yamada , Linux Kbuild mailing list , LKML , clang-built-linux , linux-toolchains@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 6:44 PM Fangrui Song wrote: > > On 2020-10-21, 'Nick Desaulniers' via Clang Built Linux wrote: > >DWARF5 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. Further -gdwarf-X where X is an unsupported value doesn't > >produce an error in $(CC). GNU `as` only recently gained support for > >specifying -gdwarf-5. > > > >The DWARF version of a binary can be validated with: > > To be more correct: this is just the version number of the .debug_info section. > Other sections can use different version numbers. > (For example, GNU as still does not support version 5 .debug_line) How do you recommend we validate that then? > > >$ llvm-dwarfdump vmlinux | head -n 5 | grep version > >or > >$ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version > >diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > >index cd14444bf600..0382808ef9fe 100644 > >--- a/include/asm-generic/vmlinux.lds.h > >+++ b/include/asm-generic/vmlinux.lds.h > >@@ -828,7 +828,11 @@ > > .debug_types 0 : { *(.debug_types) } \ > > /* DWARF 5 */ \ > > .debug_macro 0 : { *(.debug_macro) } \ > >- .debug_addr 0 : { *(.debug_addr) } > >+ .debug_addr 0 : { *(.debug_addr) } \ > >+ .debug_line_str 0 : { *(.debug_line_str) } \ > >+ .debug_loclists 0 : { *(.debug_loclists) } \ > >+ .debug_rnglists 0 : { *(.debug_rnglists) } \ > >+ .debug_str_offsets 0 : { *(.debug_str_offsets) } > > Consider adding .debug_names for the accelerator table. > It is the DWARF v5 version of .debug_pub{names,types} (which are mentioned > a few lines above). I hadn't seen that section produced in my limited testing. Being a fan of TDD, I kind of would like to see the linker warn on orphan section placement, then add it to the list, as I did with the above. Do you have more info on when or how .debug_pub* can be produced? Thanks for the rest of the feedback, I'll incorporate it into v2. -- Thanks, ~Nick Desaulniers