Re: [PATCH v6 1/2] Kbuild: make DWARF version a choice

From: Nick Desaulniers
Date: Fri Jan 29 2021 - 17:41:59 EST


On Fri, Jan 29, 2021 at 1:41 PM Jakub Jelinek <jakub@xxxxxxxxxx> wrote:
>
> On Fri, Jan 29, 2021 at 04:32:32PM -0500, Arvind Sankar wrote:
> > Given what Jakub is saying, i.e. it was previously impossible to get
> > dwarf2 with gcc, and you get dwarf4 whether or not DEBUG_INFO_DWARF4 was
>
> It isn't impossible to get it, -gdwarf-2 works, it is just not a very good
> choice (at least unless one knows some debug info consumer is not DWARF3 or
> later ready).
> Though, even gcc -gdwarf-2 will use many extensions from DWARF3 and later,
> as long as there is no way to describe stuff in DWARF2. -gstrict-dwarf
> option requests that no DWARF extensions are used.

Playing with this in godbolt, it looks like the implicit default dwarf
version changed from 2 to 4 in somewhere between the GCC 4.7.4 and
4.8.1 release. The precise version, and whether it was strictly that
version or not doesn't matter much; the minimum supported version of
GCC for building the kernel currently being 4.9 means that without
specifying DEBUG_INFO_DWARF4, that all kernel developers regardless of
toolchain and supported toolchain version have been building as DWARF
v4 (implicitly, or explicitly). DWARF v2 is quite irrelevant then.

Ok, so I think Arvind's suggestion of "make DEBUG_INFO_DWARF4 a menu
option, just don't add a DEBUG_INFO_DWARF2" makes a lot of sense.
Will drop DEBUG_INFO_DWARF2 in v7.
--
Thanks,
~Nick Desaulniers