All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sedat Dilek <sedat.dilek@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Clang-Built-Linux ML <clang-built-linux@googlegroups.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Fangrui Song <maskray@google.com>,
	Caroline Tice <cmtice@google.com>,
	Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH v4 2/3] Kbuild: make DWARF version a choice
Date: Thu, 14 Jan 2021 08:30:21 +0100	[thread overview]
Message-ID: <CA+icZUXcZiNqPC-k3TsNsLdXLJ6EQK5ZVwOOtQ+BqzYNNUzpcA@mail.gmail.com> (raw)
In-Reply-To: <CA+icZUWySPfGGswqEBZkCQ+OjogmMqzBvik3ddLHPWJ2w8EC3A@mail.gmail.com>

On Thu, Jan 14, 2021 at 8:20 AM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Thu, Jan 14, 2021 at 12:27 AM Nick Desaulniers
> <ndesaulniers@google.com> 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 <sedat.dilek@gmail.com> wrote:
> > >
> > > On Wed, Jan 13, 2021 at 1:32 AM Nick Desaulniers
> > > <ndesaulniers@google.com> 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

I wonder why I see GNU/as here (see above CONFIG_LD_IS_LLD=y)?

$ llvm-dwarfdump-11 vmlinux | head -20 | egrep
'debug_info|format|version|DW_AT_producer'
vmlinux:        file format elf64-x86-64
.debug_info contents:
0x00000000: Compile Unit: length = 0x0000001e, format = DWARF32,
version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at
0x00000022)
             DW_AT_producer    ("GNU AS 2.35.1")
0x00000022: Compile Unit: length = 0x0000c1d2, format = DWARF32,
version = 0x0004, abbr_offset = 0x0012, addr_size = 0x08 (next unit at
0x0000c1f8)
             DW_AT_producer    ("GNU C89 10.2.1 20210110 -mno-sse
-mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387
-mno-fp-ret-in-387 -mpreferred-stack-boundary
=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel
-mindirect-branch=thunk-extern -mindirect-branch-register
-mrecord-mcount -mfentry -march=x86-64 -g -g
dwarf-4 -O2 -std=gnu90 -fno-strict-aliasing -fno-common -fshort-wchar
-fno-PIE -falign-jumps=1 -falign-loops=1
-fno-asynchronous-unwind-tables -fno-jump-tables -fno-de
lete-null-pointer-checks -fno-allow-store-data-races
-fstack-protector-strong -fno-strict-overflow -fstack-check=no
-fconserve-stack -fcf-protection=none -fno-stack-pr
otector")

Maybe, I should set all LLVM utils and linker manually, not using LLVM=1.

- Sedat -

  reply	other threads:[~2021-01-14  7:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  0:32 [PATCH v4 0/3] Kbuild: DWARF v5 support Nick Desaulniers
2021-01-13  0:32 ` [PATCH v4 1/3] Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4 Nick Desaulniers
2021-01-13 17:48   ` Nathan Chancellor
2021-01-13  0:32 ` [PATCH v4 2/3] Kbuild: make DWARF version a choice Nick Desaulniers
2021-01-13 17:51   ` Nathan Chancellor
2021-01-13 21:24   ` Sedat Dilek
2021-01-13 23:27     ` Nick Desaulniers
2021-01-14  7:20       ` Sedat Dilek
2021-01-14  7:30         ` Sedat Dilek [this message]
2021-01-15  3:54       ` Masahiro Yamada
2021-01-13  0:32 ` [PATCH v4 3/3] Kbuild: implement support for DWARF v5 Nick Desaulniers
2021-01-13 17:55   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+icZUXcZiNqPC-k3TsNsLdXLJ6EQK5ZVwOOtQ+BqzYNNUzpcA@mail.gmail.com \
    --to=sedat.dilek@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=cmtice@google.com \
    --cc=jakub@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=maskray@google.com \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.