Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp62377pxb; Wed, 13 Jan 2021 23:22:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlp3bOo+iw7f7tLNQNLE+J26bCGFEdJ0H9DXN1GiPdbb2lF91S/uQgWU8KjZS+gPf478Ft X-Received: by 2002:a17:906:a48:: with SMTP id x8mr4240771ejf.444.1610608962121; Wed, 13 Jan 2021 23:22:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610608962; cv=none; d=google.com; s=arc-20160816; b=hrIM1UJ4x4jQ5N9yhJJHuwI1HZLIOOmIZiWiOf8RiqnbeDWpCEiPbJ94+l9n2erYcr ozuIS1PYqG8KoJuivP7MA3bQOVH2PZSTE+plEbsUp+Fbv71pVzGLC8Crslj08IeSjGu8 UybpRUW6GFKPLhr4woE5dg8Sf7WyL1CpBVrpIx6yQyeX4MI5ynTO9Rk/CFFIKe1bdiww seIcEmAGav2QxRSTIzeqM+LJBbTSmQtrBSkOYcqDAV9TT3352cz3JditoORN6VzFkBPg gD7Zs1jwfA2uP8532261343blJvHJxzC++KwTTjM842zgW/QPlvhyIJny4Ph5Ld5viJE g6jA== 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:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=mxmch7rl4egTEBXYfPlF0zYnqi6xJdFXG+QKIy1/Y8I=; b=CJfaBDxQmQLSqM9kF1gQLo7CpNDJoUDB9vh+qrCUcxP4eUwLHpr9Q0Zw7B03Zpd7s+ e7qJeXeliZHj34VNviwVS37cLoWP17xJ1kkS1Ghrfb2lf3IOViAyh7zLwfp9pixNy9LW 66kdAAyqJuGiW0A2E2DuxZduHGN/xeg7HVC3xanlFnO1rF0ty5DnJ2IPs93o0feHt3+0 DWJ8QrterMsUz9DCnUKwXwDsRL6NgnkUz3Lae2R/5kHlYS7z9t6nRavcI1p6xQr7DKpb 0EzQYUFOPwrgRut+c5r4S4TxuEpkzfRFJQXlcXjB8ENhwY3yjxnAAj6YxJdB2DAVPlhw +sAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eIH3XcvZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si2190874ede.511.2021.01.13.23.22.18; Wed, 13 Jan 2021 23:22: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=@gmail.com header.s=20161025 header.b=eIH3XcvZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbhANHVY (ORCPT + 99 others); Thu, 14 Jan 2021 02:21:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbhANHVX (ORCPT ); Thu, 14 Jan 2021 02:21:23 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 739D0C061786; Wed, 13 Jan 2021 23:20:42 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id b19so6810864ioa.9; Wed, 13 Jan 2021 23:20:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=mxmch7rl4egTEBXYfPlF0zYnqi6xJdFXG+QKIy1/Y8I=; b=eIH3XcvZt5LZzmQYeTgR0kWfAXt/LyPrhvg/sY/HMekpk9NEEkQSL3CAn2UiEWe6n1 CAvkqBec0A15ELhyuf683EMldYKzEPeZD3WHdEI0dYo0+O514JlkhvvBr9u0GlnqTjrP DPNoIPxN4wgzMYcNzr9kU0j0m66V+NYse/W/BQ2J3oKAY9OVg4iWaRe7LNMtGnpQAKdX S9VbCd8JyUgMQ+7Y/1LclPYy/FZX5x+dcp/4UgfV3cXjwJTYQClzmmbAysQhD1UwFDeX kYDc/yohyrqIP02FwPpuf+7Ex6XyPZQIplkHMbxk175ovUAx/GfKPcurlMptLWa9qn03 UQkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=mxmch7rl4egTEBXYfPlF0zYnqi6xJdFXG+QKIy1/Y8I=; b=LEaFFYcqeUdc1RHLKfgydjIzz3oI1krUCsPr4FyX8JK63OSIrRUrScK6t00ZAn9O4a zzGc890OvpTHclxP3JyxsCIeWgGBtE7J2bi+ReOEoNjL89+HYZlhKm4sTq6B5QvXLPog iFXRNmh+UTRxyTxF/vLmwIZwsyCfIC+Ks5maUflx4XQPHr52b+UZkQcP+qpuH1dKHEGE UQllT4rkO5Cte+UYjJxUIaAUP2xCod/gpPc4dTLPzy+IKKLS4RsM3WbrWMWTujp8EZ/i OriFSG0UOhwH3mzaujNvSu+IJKh5gji+TYEyEpDJTMTjaYfLDzmHqrbwtaDj8CZ5bLhi DylA== X-Gm-Message-State: AOAM532fiWZny1BxQcC5U1FZzn8//ccyLGmq3Nrjv9xUW6zU11qjzBlX /OTMHHZhdn/Pqgy6Xgq6ChW1OcV023wxc5KY8tY= X-Received: by 2002:a02:9f19:: with SMTP id z25mr5442115jal.30.1610608841857; Wed, 13 Jan 2021 23:20:41 -0800 (PST) MIME-Version: 1.0 References: <20210113003235.716547-1-ndesaulniers@google.com> <20210113003235.716547-3-ndesaulniers@google.com> In-Reply-To: Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Thu, 14 Jan 2021 08:20:30 +0100 Message-ID: Subject: Re: [PATCH v4 2/3] Kbuild: make DWARF version a choice To: Nick Desaulniers Cc: Masahiro Yamada , Nathan Chancellor , Andrew Morton , LKML , Clang-Built-Linux ML , Linux Kbuild mailing list , linux-arch , Jakub Jelinek , Fangrui Song , Caroline Tice , Nick Clifton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 14, 2021 at 12:27 AM Nick Desaulniers wrote: > > Sedat, > Thanks for testing, and congrats on https://lwn.net/Articles/839772/. > I always appreciate you taking the time to help test my work, and > other Clang+Linux kernel patches! > Hi Nick, cool, again in the top 15 :-). I should ask Mr. Corbet for a LWN subscription. > On Wed, Jan 13, 2021 at 1:24 PM Sedat Dilek wrote: > > > > On Wed, Jan 13, 2021 at 1:32 AM Nick Desaulniers > > wrote: > > > > > > --- 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) > > ^ DEBUG_CFLAGS are set for everyone (all toolchains) if > CONFIG_DEBUG_INFO is defined. > > > > +ifneq ($(dwarf-version-y)$(LLVM_IAS),21) > > ^ "If not using dwarf 2 and LLVM_IAS=1", ie. CONFIG_DEBUG_INFO_DWARF5 > && CONFIG_CC_IS_GCC > OK, I know DWARF v2 and LLVM_IAS=1 is broken. Looks like DWARF v5 with GCC v10.2.1 and binutils v2.35.1 is currently (here) no good choice. > > > +# Binutils 2.35+ required for -gdwarf-4+ support. > > > +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y)) > > > +ifdef CONFIG_CC_IS_CLANG > > ^ "if clang" > > > > +DEBUG_CFLAGS += $(dwarf-aflag) > > > endif > > > > Why is that "ifdef CONFIG_CC_IS_CLANG"? > > That's what Arvind requested on v2, IIUC: > https://lore.kernel.org/lkml/X8psgMuL4jMjP%2FOy@rani.riverdale.lan/ > > > When I use GCC v10.2.1 DEBUG_CFLAGS are not set. > > You should have -gdwarf-4 (and not -Wa,-gwarf-4) set for DEBUG_CFLAGS > when compiling with GCC and enabling CONFIG_DEBUG_INFO_DWARF4. Can you > please confirm? (Perhaps you may have accidentally disabled > CONFIG_DEBUG_INFO by rerunning `make defconfig`?) > $ egrep 'CC_IS_|LD_IS|BTF|DWARF' config-5.11.0-rc3-5-amd64-gcc10-llvm11 | grep ^CONFIG CONFIG_CC_IS_GCC=y CONFIG_LD_IS_LLD=y CONFIG_DEBUG_INFO_DWARF4=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y $ grep '\-Wa,-gdwarf-4' build-log_5.11.0-rc3-5-amd64-gcc10-llvm11.txt | wc -l 156