Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4101731pxu; Mon, 30 Nov 2020 18:00:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5OPmWI6K7ijtWhIS7UeKz2wfYIfpvYTFRvuQ+QbolMcQZHe01lLP/JhMvafH09BGLLNk3 X-Received: by 2002:a05:6402:2da:: with SMTP id b26mr717874edx.176.1606788010420; Mon, 30 Nov 2020 18:00:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606788010; cv=none; d=google.com; s=arc-20160816; b=bciqbkXUBSNad2ygRJK7hj0k6QybWugtabPcu1Ow0uzYaBP6SB0n2i3+tAy25mG0fH czcTLyWUh8Y6/QEzgPLW7cT7jtiyZ0xz53Q3ZQzxm1S9j93Qcw/Pd4sTBVgLjL4pExHk 3sspaudia3hM0fszOEfGT6WazOvo75u/CvmsqjYP3Imp3tSWLFDby6GuTbcTvWDGcwWb 6BEvcGF6c0l8mkkNhnV9JV2j7L/wEBEIc9aqMHVC+fD97BfZdKtTnb0tVzuFzNOSw+d3 v0bl8y2QpCLUlRu5ZvgjVy3kJcP6uNl/bzapCnDFJGkRzUWYhWo9FyiTaPfHiQ7ocG7c 1PKg== 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:dkim-filter; bh=eBmxAR7K2Jbfp4KHt3489WMG4z7PgIgZCJ+eBjBop4A=; b=FF23MVIZGwyeJ+h8yi2r5tr4S1sXFLsMJlQNniNK77SioQtrbYG1rkxmAu04Ty9Mnc +Xy0SnoJDy79zmqU49i9nkePt8HtOTsqtRVqJJs+JThCi0Q8bjC4ntbDytk4Etk0xO2H FHmZXd9aWlSyXpRFa1unSTv/F0rBOkDhFkjU2jHi4jRYewz29XxS+BScTfHg7xu/AJAn 9ylLhVblI9pRfEznvhJhtK7E6xY3E8pzK2xd9qgVp4IlYjEbl+JXELIqykRr5OIwp3wJ plIL2+XeYzfuLRGoYwK2zOQQCXqcyBdKOR2eBr3oWm4/shyCI12HOTAHg8GVSBt5ZCjB e5mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=o59lXxne; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si210211edw.160.2020.11.30.17.59.47; Mon, 30 Nov 2020 18:00:10 -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=@nifty.com header.s=dec2015msa header.b=o59lXxne; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbgLAB56 (ORCPT + 99 others); Mon, 30 Nov 2020 20:57:58 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:46739 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgLAB55 (ORCPT ); Mon, 30 Nov 2020 20:57:57 -0500 X-Greylist: delayed 28283 seconds by postgrey-1.27 at vger.kernel.org; Mon, 30 Nov 2020 20:57:56 EST Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 0B11uswA001093; Tue, 1 Dec 2020 10:56:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 0B11uswA001093 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1606787815; bh=eBmxAR7K2Jbfp4KHt3489WMG4z7PgIgZCJ+eBjBop4A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o59lXxne9HU0MBSkhL5X+CMfz5WG7gA9UqFXr7ANoeiOVmPi5KZ35D63E1umWv9Ly qCesk5Q1y3sXj7Oh7r1bqdWUtYBfPBYJW82rox1KK/C3PrZjYnILAQcF9v1TaD61wz k521PnjOiwkfALoHzZ3iHH3j8OSexqol8njVs7cp1WNNh//Ml8DvS4dn0dlSoGLExL EMpuJqmrOjOMU0uvQ+7YiMUzwBt21YItjSysCYhydyWNLdj/XM+MSQhg/l6HWyAT67 rszy903/Ha6qEb93gfwFg8N3THmAH41tzSBuvq0cTmKkyMg/Oh95xDZWJCLZ7l5jMv o1iIHTqkqIoRQ== X-Nifty-SrcIP: [209.85.216.43] Received: by mail-pj1-f43.google.com with SMTP id b12so256337pjl.0; Mon, 30 Nov 2020 17:56:54 -0800 (PST) X-Gm-Message-State: AOAM530qg2t2s0pwXy7pq3ms7C3fXOX8ig3Puer990lm/zH5Ld1oen99 Dc31YMC4GIBeK3UtGOTGL6h3fZU8pFf8z+PDFzE= X-Received: by 2002:a17:902:6949:b029:da:17d0:d10f with SMTP id k9-20020a1709026949b02900da17d0d10fmr453041plt.71.1606787813943; Mon, 30 Nov 2020 17:56:53 -0800 (PST) MIME-Version: 1.0 References: <20201104005343.4192504-1-ndesaulniers@google.com> <20201104005343.4192504-5-ndesaulniers@google.com> In-Reply-To: <20201104005343.4192504-5-ndesaulniers@google.com> From: Masahiro Yamada Date: Tue, 1 Dec 2020 10:56:17 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/4] Kbuild: implement support for DWARF v5 To: Nick Desaulniers 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 Wed, Nov 4, 2020 at 9:54 AM 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. > > The DWARF version of a binary can be validated with: > $ llvm-dwarfdump vmlinux | head -n 5 | grep version > or > $ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version > > DWARF5 wins significantly in terms of size when mixed with compression > (CONFIG_DEBUG_INFO_COMPRESSED). > > 363M vmlinux.clang12.dwarf5.compressed > 434M vmlinux.clang12.dwarf4.compressed > 439M vmlinux.clang12.dwarf2.compressed > 457M vmlinux.clang12.dwarf5 > 536M vmlinux.clang12.dwarf4 > 548M vmlinux.clang12.dwarf2 > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf > Suggested-by: Masahiro Yamada > Suggested-by: Jakub Jelinek > Signed-off-by: Nick Desaulniers > --- > Makefile | 1 + > include/asm-generic/vmlinux.lds.h | 6 +++++- > lib/Kconfig.debug | 8 ++++++++ > scripts/test_dwarf5_support.sh | 9 +++++++++ > 4 files changed, 23 insertions(+), 1 deletion(-) > create mode 100755 scripts/test_dwarf5_support.sh > > diff --git a/Makefile b/Makefile > index e23786a4c1c7..9056bac0ff85 100644 > --- a/Makefile > +++ b/Makefile > @@ -828,6 +828,7 @@ endif > > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2 > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 > DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) > ifneq ($(dwarf-version-y)$(LLVM_IAS),21) > # Binutils 2.35+ required for -gdwarf-4+ support. > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > index b2b3d81b1535..76ce62c77029 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -829,7 +829,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) } > > /* 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" The choice menu looks like follows: (X) Generate DWARF v2 debuginfo ( ) Generate dwarf4 debuginfo ( ) Generate DWARF5 debuginfo Upper / Lower case inconsistency. -- Best Regards Masahiro Yamada