linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}
@ 2023-03-15 21:40 Nick Desaulniers
  2023-03-16  8:24 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Desaulniers @ 2023-03-15 21:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, sashal, stable
  Cc: Masahiro Yamada, Nathan Chancellor, linux-kbuild, linux-kernel,
	llvm, Nick Desaulniers, Lecopzer Chen

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>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index a7b664680ea3..88b2b13bf35b 100644
--- a/Makefile
+++ b/Makefile
@@ -888,6 +888,7 @@ ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
 dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
 DEBUG_CFLAGS	+= -gdwarf-$(dwarf-version-y)
+KBUILD_AFLAGS	+= -gdwarf-$(dwarf-version-y)
 endif
 
 ifdef CONFIG_DEBUG_INFO_REDUCED
-- 
2.40.0.rc1.284.g88254d51c5-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}
  2023-03-15 21:40 [PATCH] Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5} Nick Desaulniers
@ 2023-03-16  8:24 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-16  8:24 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: sashal, stable, Masahiro Yamada, Nathan Chancellor, linux-kbuild,
	linux-kernel, llvm, Lecopzer Chen

On Wed, Mar 15, 2023 at 02:40:59PM -0700, Nick Desaulniers wrote:
> 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>
> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)

Now queued up, thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-16  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 21:40 [PATCH] Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5} Nick Desaulniers
2023-03-16  8:24 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).