Skip to contentSkip to conversation

Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}

PATCH Applied Nick Desaulniers 2 participants 3 messages Mar 15, 2023 – Mar 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
index a7b664680ea3..88b2b13bf35b 100644
@@ -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
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
maintainer Applied
#1 lore raw

Patch "Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}" has been added to the 5.15-stable tree

This is a note to let you know that I've just added the patch titled

    Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}

to the 5.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
makefile-use-gdwarf-4-5-for-assembler-for-debug_info_dwarf-4-5.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From [email protected] Thu Mar 16 09:23:48 2023
From: Nick Desaulniers <[email protected]>
Date: Wed, 15 Mar 2023 14:40:59 -0700
Subject: Makefile: use -gdwarf-{4|5} for assembler for DEBUG_INFO_DWARF{4|5}
To: Greg Kroah-Hartman <[email protected]>, [email protected], [email protected]
Cc: Masahiro Yamada <[email protected]>, Nathan Chancellor <[email protected]>, [email protected], [email protected], [email protected], Nick Desaulniers <[email protected]>, Lecopzer Chen <[email protected]>
Message-ID: <[email protected]>

From: Nick Desaulniers <[email protected]>

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")
---
 Makefile |    1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -888,6 +888,7 @@ ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN
 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

Patches currently in stable-queue which might be from [email protected] are

queue-5.15/scripts-handle-brokenpipeerror-for-python-scripts.patch queue-5.15/makefile-use-gdwarf-4-5-for-assembler-for-debug_info_dwarf-4-5.patch

#2 lore raw
In reply to Nick Desaulniers
Quoted 19 lines · Nick Desaulniers

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).

Quoted 6 lines
Fixes 0ee2f0567a56 ("Makefile.debug: re-enable debug info for .S files")
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

Now queued up, thanks,

greg k-h