Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp289574pxb; Fri, 15 Jan 2021 13:11:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtXrBmunNKPID9cr/JIFOwe8f+/VE61B+3AT4Ol/x03A6RKydABaCNNE9d+SPq2IHUfoNA X-Received: by 2002:a17:906:a011:: with SMTP id p17mr10112830ejy.30.1610745066546; Fri, 15 Jan 2021 13:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610745066; cv=none; d=google.com; s=arc-20160816; b=pzozK4GyrJMty1MjXmG1QBNP8n1g8jX1jqSZNUowF9YpdByA3d5EUiKPsQFrZ4QYlr pKK6mpqW2J+Qgbz5+V/4vhnRvqh53nskdOLKEtS85YTfXZnSOJGcaswCKfVXeJt6H/92 BJ0+UJ2IdyZu0FRuIqOGJ4RFMedtQpsEnCfFd/HmSufi9+sT4nPKHpoaRjPBbxdctOJh Khn3oSsFrD0Cgn6ai9eSbIG30rSualGbdeqbtFQcCX2k+oRHUfK+h4rxMS7CnJTibMan KjWdzeHPs0yGTXpPUNCqWfHHBMSztRfsE/kqTZoNVgSF1I0b23ZPOUCHCkAENpnr9/zJ MFAA== 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=WwUdb2o6/JIc/+fz+e0NhIo1IFclKkxRZVZ3uFNIMcs=; b=VwA8JdaW7J/HaciCrI5i2IOFuE8foLTmAVjtUhDbVgVfmrIw8YAv3do362XmVZoUY5 04DeARJp/kOL/BpXcCWr6Ti5/YJ2Ganbm96xdrhrxLXJq1T4ZU0vEw4P2PZrilfCqTVQ HEJ/fQ8LI7Mn3sPALIGSZPTltE5kazi8NTvtRVnYuBsjDxVpSNtGAXeuemMOSVwbUXE8 xrJ1hqlPp7TcmZuOq1PCzR3nml8PGbyhyhAQMN5A/WIG0uaNjEkQkTEgY/CpgjDY6kWN iQ+P8uXXDhm4cXqXl+n+cStMAnEZhlvtkpDmF9PYxnc+BP6z4vz08uweUZi2ZciZNhMi JzPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P98utPfE; 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 r10si15198ejy.116.2021.01.15.13.10.43; Fri, 15 Jan 2021 13:11:06 -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=P98utPfE; 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 S2387490AbhAOVHo (ORCPT + 99 others); Fri, 15 Jan 2021 16:07:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729204AbhAOVHm (ORCPT ); Fri, 15 Jan 2021 16:07:42 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 495C5C061799 for ; Fri, 15 Jan 2021 13:06:24 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id x17so8064968ybs.12 for ; Fri, 15 Jan 2021 13:06:24 -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=WwUdb2o6/JIc/+fz+e0NhIo1IFclKkxRZVZ3uFNIMcs=; b=P98utPfE6V667LGwTk/IdGWWjs1i97DTxFXdD6FraJ/KKKWgNoEaRBbxZ5phN52hfH nDeTjvnhKRW/+FmCsSU+a0ByuNJP2F+Io4jbDhySATDrrnQFLaYSR44keYYmmfBBJoYq h+deIqj8r6oJ1KqkWf9euVm/PkBcINapnocm6aqqq6PRdVuUmS9zxAaXF//OAQHLJWi7 KuUvn19Vgodzjl78CtFaFVyCwJVmqRHjq6Mde/X8DTE4onvHWAqFcyFnB68qcHKONg9u NDURrcYtPVIq9OWtnW3/9GnSF76L6hDE8KjAZd9WJ0v9ky5M3UOE1HFnEdUaUxpYvxT3 fo8A== 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=WwUdb2o6/JIc/+fz+e0NhIo1IFclKkxRZVZ3uFNIMcs=; b=unss1B6JW+r23XtVSRyHCxVq3tXRhrroY7jUB4LYszUaq6ADa/Z0NrGjTik21Tc71G gASrXHmpfsUh0sRzRAhKKbq1UTdBuSl4ThT2zvFFoShX5bI7tBfr3MuRUSHW8RLobWdp jdawq1pVI4jTTJvt1mo+88JRrRJiDADHCfuxn1D6RmP4Q8yrws4VEaViIdfUNJm92Zc4 Jb8umbAxfURSou7JmMyVsm9WMbxSZPb6Lye+O0UwyTvk4ZHChTLJUX9RysKF5SxeAmes yW8Z80dRoyriYTRFFCiwtuWPsxV0euz1i9VhEvBY9uiFsb90/FxlfTZLmyMqIZZhxpCl NjTw== X-Gm-Message-State: AOAM533bnBmi+pls3YB5CpAEOUeDPchfXPNQqD1vbuUySZm3DMJLNmwZ TM41UyQ2/NO5jNsu0krGcDCVFVOZQYmnlVXPbD0= 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:a25:340c:: with SMTP id b12mr4325908yba.474.1610744783536; Fri, 15 Jan 2021 13:06:23 -0800 (PST) Date: Fri, 15 Jan 2021 13:06:15 -0800 In-Reply-To: <20210115210616.404156-1-ndesaulniers@google.com> Message-Id: <20210115210616.404156-3-ndesaulniers@google.com> Mime-Version: 1.0 References: <20210115210616.404156-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v5 2/3] Kbuild: make DWARF version a choice From: Nick Desaulniers To: Masahiro Yamada Cc: Nathan Chancellor , Andrew Morton , Sedat Dilek , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Jakub Jelinek , Fangrui Song , Caroline Tice , Nick Clifton , Yonghong Song , Jiri Olsa , Andrii Nakryiko , Arnaldo Carvalho de Melo , Nick Desaulniers , Arvind Sankar 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: 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" + help + Which version of DWARF debug info to emit. + +config DEBUG_INFO_DWARF2 + bool "Generate DWARF Version 2 debuginfo" + help + Generate DWARF v2 debug info. + config DEBUG_INFO_DWARF4 - bool "Generate dwarf4 debuginfo" + bool "Generate DWARF Version 4 debuginfo" 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