Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp927165pxb; Tue, 3 Nov 2020 16:57:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6vlu3fDCsf0ke/mgKiZyl2nIw83Af7OzyzktjndAqRJiMpUCA8Uythz3jPCi9twyyEZwy X-Received: by 2002:a17:906:2558:: with SMTP id j24mr8017395ejb.329.1604451462275; Tue, 03 Nov 2020 16:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604451462; cv=none; d=google.com; s=arc-20160816; b=xe6GcLY3FcfoFHGbEALlINy9U25wWjuwpPWQPEnio4no/Jny/MRVcQhgkN2rnAYOhu 4zN/WohWR8DokSS4IW4NS4iICQ/MjAYJj646AG2/cCj/yVlv1/INf/IRgWcW3qb85207 rgltXeVNO06tx3kWdgk2kEFU60ixDgN8I1HHkgcMwXOWvocP19j1R5evmuG/lJw145z5 uGmqGYjWaoC/DR9HSQGNk0G66VfVDMYY96rECejAsA0na/f+bnRFN5Bf9xsVUBhrwXN7 UxeAzlqcleOTfYGw7s4t/hSy3jAyiWNHTYeBDuMKz4yJRq4vphfgw7eBE8ltRTBZxKZf kL2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=sEoLa2K7mY/J71l6bRl2EaWMrBUYyyUbe4HY5uHEuDw=; b=egf0PXfhxdqcNk+WxYL8zC9cvShZHkTffEYF8JAgpuQZbiDrXdAJTSqBWRVKg1oAJm EYnLosUgtCV4pvgHUqEs3WSrudV+XY4xu+Flw36KLn43YTKScMsJWUK1t5OcDDumRuqa jTABd34xI3YaskOGXAuUunyzt9ySkbemnimj60Rys7XishUhcab7xJsBN0lyJlPJhlev tQ+ZfStOJWzi/rItuxnmOQmopqDKjKJtTrVdyAqh0LKA/8YslnjqEclBYDYafSF3wVsC ES2aeWP8LjWoIRzWKojMlQCxhMfgxL/RS4C5QOyWcEMWVCuf/9AcIOgcM+/tFd2u+3D2 GrTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PhJTUPR2; 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 z11si354209ejf.614.2020.11.03.16.57.17; Tue, 03 Nov 2020 16:57:42 -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=PhJTUPR2; 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 S1729864AbgKDAxy (ORCPT + 99 others); Tue, 3 Nov 2020 19:53:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729610AbgKDAxx (ORCPT ); Tue, 3 Nov 2020 19:53:53 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F35E6C0401C2 for ; Tue, 3 Nov 2020 16:53:52 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id s130so4616280pgc.22 for ; Tue, 03 Nov 2020 16:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=sEoLa2K7mY/J71l6bRl2EaWMrBUYyyUbe4HY5uHEuDw=; b=PhJTUPR2xqSR+ujql+GZQjnimaFdfxKUJ4XBGPiMU7prjL2P411miMnABec+34UJbU lEKGHURwGefRBq0nC27kvgNP0xItZS+Geo1izk8BzrbEPCv3GMCtWSi4afJ4+s8nDp8R GPdIImMke9cA45MztHtbStm/oIZa+tOk98FuUFW8lrt1YVWJKPllBYXv1fTeWzAIGAE/ 3OxNZXZYsXnSXm+yHf1uIb1CdtnXvZkoOOzAA4Kj7XcI1h1ncA2G3+zz5/GrHiyZhE0d jwDvwi96cUT951aVwsQpUcDe85Bwkvgq2ANfgKPah+IgoW0/usGq2KDrIADGoimjN5He 38KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=sEoLa2K7mY/J71l6bRl2EaWMrBUYyyUbe4HY5uHEuDw=; b=Zg+KH54kQgFxUWmBPhRHTLcrGFZK7SHAGw9B3N5qmy5RQ8NYGmXbwuCmPzE/8J3+JB u/AgDAQX4ww8VzE4EHKT7knYCI3Qrq/sebuXMHgCciOTxbBcQ54jxNAKhDjKIBKsRUOE VoFe3uJ6KzMj3Y/UtB4SVij00kbob+U1CsiF0dLSUT3l67RM4Ovc6/DNvG3mBBMr8kJ6 dxItrNXZVlaZ6rA0GxZWZ6mQjnjz8ugo95goRw6fFEghh72fAJf7Nsfu+oTaheFjRyOv Lc8NmnHW5KMtQzURTqnS7yT0Dr8poAde+O07hkTpOFSMiBNtZ/iL5tVwbOOYevUHI8Uo Zuxw== X-Gm-Message-State: AOAM530lb00mjYAh9ZKCjVl6pHEjFoUybkTCzrNGbxHbVa2Sk3VVfDZS A+YR41dgnCTnuFYB5H5T8JJOzly8YhgNLGahEXI= Sender: "ndesaulniers via sendgmr" X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:15c:211:202:f693:9fff:fef4:4d25]) (user=ndesaulniers job=sendgmr) by 2002:a65:50c5:: with SMTP id s5mr18813679pgp.399.1604451232483; Tue, 03 Nov 2020 16:53:52 -0800 (PST) Date: Tue, 3 Nov 2020 16:53:42 -0800 In-Reply-To: <20201104005343.4192504-1-ndesaulniers@google.com> Message-Id: <20201104005343.4192504-4-ndesaulniers@google.com> Mime-Version: 1.0 References: <20201104005343.4192504-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v2 3/4] Kbuild: make DWARF version a choice From: Nick Desaulniers To: Masahiro Yamada 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 , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Fangrui Song Suggested-by: Masahiro Yamada Signed-off-by: Nick Desaulniers --- Makefile | 14 ++++++++------ lib/Kconfig.debug | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 75b1a3dcbf30..e23786a4c1c7 100644 --- a/Makefile +++ b/Makefile @@ -826,12 +826,14 @@ else DEBUG_CFLAGS += -g endif -ifndef LLVM_IAS -KBUILD_AFLAGS += -Wa,-gdwarf-2 -endif - -ifdef CONFIG_DEBUG_INFO_DWARF4 -DEBUG_CFLAGS += -gdwarf-4 +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2 +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) +ifneq ($(dwarf-version-y)$(LLVM_IAS),21) +# Binutils 2.35+ required for -gdwarf-4+ support. +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y)) +DEBUG_CFLAGS += $(dwarf-aflag) +KBUILD_AFLAGS += $(dwarf-aflag) endif ifdef CONFIG_DEBUG_INFO_REDUCED diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 83a860126897..03c494eefabd 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -256,14 +256,25 @@ config DEBUG_INFO_SPLIT to know about the .dwo files and include them. Incompatible with older versions of ccache. +choice + prompt "DWARF version" + help + Which version of DWARF debug info to emit. + +config DEBUG_INFO_DWARF2 + bool "Generate DWARF v2 debuginfo" + help + Generate DWARF v2 debug info. + config DEBUG_INFO_DWARF4 bool "Generate dwarf4 debuginfo" depends on $(cc-option,-gdwarf-4) 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.29.1.341.ge80a0c044ae-goog