Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp321818pxb; Fri, 15 Jan 2021 14:08:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3bM8Mlz0uWaPgvyxJlvgnkQ85bFRk8C+B+aY6x4B+UEBtRamq4+1GtNqwqB3V97BpFEjf X-Received: by 2002:a05:6402:2288:: with SMTP id cw8mr6589187edb.161.1610748506464; Fri, 15 Jan 2021 14:08:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610748506; cv=none; d=google.com; s=arc-20160816; b=cH7amYK3YtMXiXfK2BZpoL85J3UvmkWqWop3iIm9MZX4+zx41WsOwOj8wlmUyusX3n 3i/zeTakX3S7A/SWlgzIPUE0xxpSwr+Qpo9UHwqT1Andy38xvh3qyqR6TRQqqB9Ava/j t76rFDvAA5BOHhM1DpPvdJaDBmx+kP6tAo6Ntu4u8nQuZl7BiJhTbr5S2xU83wCEi10Y FPprSv0bBzxKjy6tG5acv6jVZFjgLVOAEFRhvhHOCI1HTwTT9MY2Oo5EGf3bHDyReGWu ZcezdMKuO+NHB8LAqYk5IwOrDT7QbPmxByYoULr4fYyDBezxreDYHrJoGPsIqGc3nKlV xy2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KN78Q17MGRiBbbDRSKVXa79TEYkMqvDyXwMUFINzonU=; b=WqXd+/aZffr4jvhZ/tfwFG40Bgt9oR4YKQz0/t/5trgtDYVWIsdH8NPwSkYxlCSP4R u9efRvIU/yD2JlVvdguCb0/gz/AgaWv1NlaKI4s1WHvV0hlogvSokAcvGI+P0sddqSmq f4J/V8PX83NleiPNwib4N4e4j9VhAUVd31IMsFH5c0f1ZTSTuZx4XMXE9xzXDgmk3BUv XqOb0m2mK/lipRdf1pf5uL37T+PluprfZ4E4bAsAmogN7OxHl/gSbK1MtkA6f3SgHPXE +vTAlg46RD0Xy2BUz/S9t7tFjTYB5Qmfuj07043oAml4r7MjExs3uhx+gM+/L2YE8V58 AYfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oCaduNG4; 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 jg13si5210402ejc.669.2021.01.15.14.08.02; Fri, 15 Jan 2021 14:08:26 -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=oCaduNG4; 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 S1727746AbhAOWGN (ORCPT + 99 others); Fri, 15 Jan 2021 17:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726459AbhAOWGM (ORCPT ); Fri, 15 Jan 2021 17:06:12 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3307C061757 for ; Fri, 15 Jan 2021 14:05:32 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id x126so6339588pfc.7 for ; Fri, 15 Jan 2021 14:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KN78Q17MGRiBbbDRSKVXa79TEYkMqvDyXwMUFINzonU=; b=oCaduNG4QbuGqwh1onPGbaLjRDDKevaN8DaXoeXbxEBsQU06c3p0l3GM/MONvKCJ5c /1cSKHx+XZbuoa+UIHkSdOEuOD7/3fw1qPb7jnl15lXWsQqck23jZr4tLw6L8VybNJFt EZVMNndQM4tIWKTavPqhTV2f7N5dvi0XqaaS0r8P/MD8fY6rFrpoSFDjEOsHKxZzreZ1 f/U3T/Klvug/QInnPrKH5qv1Thnjtl2zcBgKuugefxx9nlUTvVYhof4VNChQwdtAfz4Q lEHpoF5fq2a86PwLM00GdEUXm3O01/JJJ7qB/n0Yt8z3krshDGlQvciROuYZNXBevYMi aXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KN78Q17MGRiBbbDRSKVXa79TEYkMqvDyXwMUFINzonU=; b=bewjSZdI/DFZOR3a7P3Kg+ZwBKGqD1LmidCdSYsF0/vpe3YFDXaM7iwwg0dWWV9S35 Wp5lIY63UVonaKRTEGqqtc1W+5JiwDXSyHN+wOMgZZf7vdZjeCeLM4XWT9Q196UbkMS+ IkcCQH+rh4/e3Bow61VA/ZCCe4aferg3oyumGpIMiKYuBtd/nhalkvupdL0XE9lX9bHN 2c4qb9KG95tTZDq7DWoYGf33CyB2X3ykBQG1EA1yesOgse4BOG2Kq/HN9UiAL/Eb1Zsd /a5I646HPAv7NzrpF+dEwa+S68ZiHvA/dOo1kV3qWMgCT3yOYDYZyx8W7GfgiA66eGXY vxxg== X-Gm-Message-State: AOAM532NRBrAyQHsrvRb6wyiyDjx/aTJLsaQXhVbXzzqiojFI39tAVFd PT67Qkx0XvbaHLsVcbT50gB1/A== X-Received: by 2002:aa7:9707:0:b029:19d:c5a8:155e with SMTP id a7-20020aa797070000b029019dc5a8155emr14810092pfg.62.1610748332125; Fri, 15 Jan 2021 14:05:32 -0800 (PST) Received: from google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) by smtp.gmail.com with ESMTPSA id x19sm502602pfp.207.2021.01.15.14.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 14:05:31 -0800 (PST) Date: Fri, 15 Jan 2021 14:05:28 -0800 From: Fangrui Song To: Sedat Dilek Cc: Nick Desaulniers , Masahiro Yamada , Nathan Chancellor , Andrew Morton , linux-kernel@vger.kernel.org, Clang-Built-Linux ML , linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Jakub Jelinek , Caroline Tice , Nick Clifton , Yonghong Song , Jiri Olsa , Andrii Nakryiko , Arnaldo Carvalho de Melo , Arvind Sankar Subject: Re: [PATCH v5 2/3] Kbuild: make DWARF version a choice Message-ID: <20210115220528.pyyr7hls2lgca3o7@google.com> References: <20210115210616.404156-1-ndesaulniers@google.com> <20210115210616.404156-3-ndesaulniers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-15, Sedat Dilek wrote: >On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers > wrote: >> >> Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an >> explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a >> way that's forward compatible with existing configs, and makes adding >> future versions more straightforward. >> >> Suggested-by: Arvind Sankar >> Suggested-by: Fangrui Song >> Suggested-by: Masahiro Yamada >> Signed-off-by: Nick Desaulniers >> --- >> Makefile | 13 ++++++------- >> lib/Kconfig.debug | 21 ++++++++++++++++----- >> 2 files changed, 22 insertions(+), 12 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index d49c3f39ceb4..4eb3bf7ee974 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -826,13 +826,12 @@ else >> DEBUG_CFLAGS += -g >> endif >> >> -ifneq ($(LLVM_IAS),1) >> -KBUILD_AFLAGS += -Wa,-gdwarf-2 >> -endif >> - >> -ifdef CONFIG_DEBUG_INFO_DWARF4 >> -DEBUG_CFLAGS += -gdwarf-4 >> -endif >> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2 >> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 >> +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) >> +# Binutils 2.35+ required for -gdwarf-4+ support. >> +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y)) >> +KBUILD_AFLAGS += $(dwarf-aflag) >> >> ifdef CONFIG_DEBUG_INFO_REDUCED >> DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ >> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug >> index dd7d8d35b2a5..e80770fac4f0 100644 >> --- a/lib/Kconfig.debug >> +++ b/lib/Kconfig.debug >> @@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT >> to know about the .dwo files and include them. >> Incompatible with older versions of ccache. >> >> +choice >> + prompt "DWARF version" > >Here you use "DWARF version" so keep this for v2 and v4. > >> + help >> + Which version of DWARF debug info to emit. >> + >> +config DEBUG_INFO_DWARF2 >> + bool "Generate DWARF Version 2 debuginfo" > >s/DWARF Version/DWARF version > >> + help >> + Generate DWARF v2 debug info. >> + >> config DEBUG_INFO_DWARF4 >> - bool "Generate dwarf4 debuginfo" >> + bool "Generate DWARF Version 4 debuginfo" > >Same here: s/DWARF Version/DWARF version DWARF Version 2 is fine and preferable. I have checked DWARF Version 2/3/4/5 specifications. "DWARF Version 2" is the official way that version is referred to... > >- Sedat - > >> help >> - Generate dwarf4 debug info. This requires recent versions >> - of gcc and gdb. It makes the debug information larger. >> - But it significantly improves the success of resolving >> - variables in gdb on optimized code. >> + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. >> + It makes the debug information larger, but it significantly >> + improves the success of resolving variables in gdb on optimized code. >> + >> +endchoice # "DWARF version" >> >> config DEBUG_INFO_BTF >> bool "Generate BTF typeinfo" >> -- >> 2.30.0.284.gd98b1dd5eaa7-goog >>