Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}
authorNick Desaulniers <ndesaulniers@google.com>
Wed, 15 Mar 2023 21:40:59 +0000 (14:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:49:05 +0000 (08:49 +0100)
commit10a72c677bce46b992348e73a3c7a1b271221e8f
tree7fb889280a0cf7951e54435dd1b89d9a96270890
parent6e7bc50f97c9855da83f1478f722590defd45ff2
Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}

This is _not_ an upstream commit and just for 5.15.y only. It is based
on upstream
commit 32ef9e5054ec ("Makefile.debug: re-enable debug info for .S files").

When the user has chosen not to use their compiler's implicit default
DWARF version (which changes over time) via selecting
- CONFIG_DEBUG_INFO_DWARF4 or
- CONFIG_DEBUG_INFO_DWARF5
we need to tell the compiler this for Asm sources as well as C sources.
(We use the compiler to drive assembler jobs in kbuild, since most asm
needs to be preprocessed first).  Otherwise, we will get object files
built from Asm sources with the compiler's implicit default DWARF
version.

For example, selecting CONFIG_DEBUG_INFO_DWARF4 would produce a DWARFv5
vmlinux, since it was a mix of DWARFv4 object files from C sources and
DWARFv5 object files from Asm sources when using Clang as the assembler
(ex. `make LLVM=1`).

Fixes: 0ee2f0567a56 ("Makefile.debug: re-enable debug info for .S files")
Reported-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Makefile