Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp45753pxb; Tue, 12 Jan 2021 19:34:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS15bKKZrm+BW7NGElDqXI0O6L5bsPg8RLFjeKTE6kbZijRHO+pzBhwKG3bEF2fRPUl35s X-Received: by 2002:a05:6402:41:: with SMTP id f1mr162339edu.286.1610508871900; Tue, 12 Jan 2021 19:34:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610508871; cv=none; d=google.com; s=arc-20160816; b=ymbCzvDYilz5wB9k43qOgk+ueLn0OT2MOmo4Gp2uBxOTlLhGl2Yte1gaWa2arF995b E/ICa/Ba4zhCwrSK295AHaq6ZF5Pra/5UHXQoPNYBMqCRlwXTgbDVvWbhBzHj4z3YVe7 CrFw4NwQB7ZXWvyf0sFMz0L/utZMMqhEpbSDU+oqToPu/Ysz4sb5wYNY3Bnxw/0iU/mm 3McVQ25PvBQT7QXziqHHm6C6kTf4UTkrCh++MUzV5Ypg6GuD338HzT8jMOhoA9FLeYi/ 4eC6UAiRmzMUCKJL5r0f/a7M6r8Yv/D6xwRkxsstOpzfCBt/Ln2R+3rqYrtERTZT6WZl ftsw== 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=uqIln+HstZctFggtrRu2n6nxYwh4ZFHKHHQOBI++guI=; b=vGmC+ej9nxKAB31Nrb77fSDCIhkDODbH98yHOgte5hNn864T8ithsmNlMkRwa7eoNu kaiU/wMoYaq+n9z59MFEgYKSbRELm6wJyBMnvdfXULPNbwgmAjKPRQ9JFjr9Md+K7cwI WVWreV+7DUo8uxYndE9YOYpz6zqPJk3+NgwavL3CPAFmSNrx/08aC/GPYz/iZx8dxNO9 W/hAduwWZqNasS5HWkChW7xnlh9hVr10M4Rh4BCQi1TlD7nqxNQdCJLz9c3gLZsAha1y NxhHYIqjmiwgCsaPGxtegJeDTZTOBTS78SuPC0YYXexAn1UvT9XQphceqRER3FQgAS06 8weg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pvdFGS6O; 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 i7si323975ejx.34.2021.01.12.19.34.08; Tue, 12 Jan 2021 19:34:31 -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=pvdFGS6O; 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 S2393897AbhAMAnO (ORCPT + 99 others); Tue, 12 Jan 2021 19:43:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392416AbhAMAeI (ORCPT ); Tue, 12 Jan 2021 19:34:08 -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 E8194C0617A3 for ; Tue, 12 Jan 2021 16:32:51 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id d187so600745ybc.6 for ; Tue, 12 Jan 2021 16:32:51 -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=uqIln+HstZctFggtrRu2n6nxYwh4ZFHKHHQOBI++guI=; b=pvdFGS6OG2KgZMUrZd158HXq4dc4tWjUyc78+KbjfGWlFFk1MJrL+jUE9o7jJLc1Hj t2TCiMIZKwBGThTs2NswSLciBDyKsrsSxS1Ll6lBF1snZ9sZR93tiExU0dIipgFDeRun 0fW7Vrisk711AmpujZzLhlMZldz4VaGa66ZtXLkHUfXQ31Zr9hRz4qliyXzhIFm7xBSJ hIhUapntVkuUk4GDDrnUUbskeYNnIH42HwwqT8cu1ppIykqr+j/rE0pXTS/f7IV1TjHF i92XgCYDkUoX3kpSs4/BTH+3h0uIxGYsuyuRmZF0wo64a5WZ4Yy1eAaVThcKVClYEG3q eC0w== 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=uqIln+HstZctFggtrRu2n6nxYwh4ZFHKHHQOBI++guI=; b=tNSEiBwiOR5BgR5msjm0ZQy/kNPx2BNf94+0obf4McIIibAw+QDRpEk1hgbL5rp3Dx XPSYs3sv2h9hf5jOP5sQSEYHnP+cNrt19yJ4paHc55efmFA3NM8QYpAYU7bQdkwdDoam cZhy0vR6ODKLU/mng6wYPjAopOMGRTEOyEtOspOQPLRxHnAHEeH785KuNeCx0X/UWej7 1oXvHqyH45mQ/Ps5WteeOH++jbWZESIiAb8K4g7ziHZuRtdzabOdjlg12Qr5mlFAB24S uMZU5X8Ci1nBQ12rtITp3bUuR4sLOJ6fuzbeAtEZ/W2yMgANHZIvYcn3vhkTK7z7Yxb0 zRZQ== X-Gm-Message-State: AOAM532i8dh1Ux18J40pyew+eJO7w1ijdajedN6iN875lqQRLQWMSOcn 6lldz7vxdBLxUsZpj/S3YQ8U45oo5yB4VBXn+YM= 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:a5b:2cf:: with SMTP id h15mr2951368ybp.475.1610497971198; Tue, 12 Jan 2021 16:32:51 -0800 (PST) Date: Tue, 12 Jan 2021 16:32:34 -0800 In-Reply-To: <20210113003235.716547-1-ndesaulniers@google.com> Message-Id: <20210113003235.716547-3-ndesaulniers@google.com> Mime-Version: 1.0 References: <20210113003235.716547-1-ndesaulniers@google.com> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v4 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 , 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 | 21 ++++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d49c3f39ceb4..656fff17b331 100644 --- a/Makefile +++ b/Makefile @@ -826,12 +826,16 @@ else DEBUG_CFLAGS += -g endif -ifneq ($(LLVM_IAS),1) -KBUILD_AFLAGS += -Wa,-gdwarf-2 +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)) +ifdef CONFIG_CC_IS_CLANG +DEBUG_CFLAGS += $(dwarf-aflag) endif - -ifdef CONFIG_DEBUG_INFO_DWARF4 -DEBUG_CFLAGS += -gdwarf-4 +KBUILD_AFLAGS += $(dwarf-aflag) endif ifdef CONFIG_DEBUG_INFO_REDUCED 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