[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <edd9abc04a63d009d527a3dd69ebeb040236afb2.1750980517.git.jpoimboe@kernel.org>
Date: Thu, 26 Jun 2025 16:55:35 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org,
Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>,
Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Puranjay Mohan <puranjay@...nel.org>,
Dylan Hatch <dylanbhatch@...gle.com>
Subject: [PATCH v3 48/64] x86/orc: Define ELF section entry size for unwind hints
In preparation for the objtool klp diff subcommand, define the entry
size for the discard.unwind_hints section in its ELF header. This will
allow tooling to extract individual entries.
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
include/linux/objtool.h | 11 ++++++++---
kernel/bounds.c | 4 ++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/include/linux/objtool.h b/include/linux/objtool.h
index 366ad004d794..c7a3851ae4ae 100644
--- a/include/linux/objtool.h
+++ b/include/linux/objtool.h
@@ -2,6 +2,10 @@
#ifndef _LINUX_OBJTOOL_H
#define _LINUX_OBJTOOL_H
+#ifndef COMPILE_OFFSETS
+#include <generated/bounds.h>
+#endif
+
#include <linux/objtool_types.h>
#ifdef CONFIG_OBJTOOL
@@ -10,9 +14,10 @@
#ifndef __ASSEMBLY__
-#define UNWIND_HINT(type, sp_reg, sp_offset, signal) \
+#define UNWIND_HINT(type, sp_reg, sp_offset, signal) \
"987: \n\t" \
- ".pushsection .discard.unwind_hints\n\t" \
+ ".pushsection .discard.unwind_hints, \"M\", @progbits, "\
+ __stringify(UNWIND_HINT_SIZE) "\n\t" \
/* struct unwind_hint */ \
".long 987b - .\n\t" \
".short " __stringify(sp_offset) "\n\t" \
@@ -88,7 +93,7 @@
*/
.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 signal=0
.Lhere_\@:
- .pushsection .discard.unwind_hints
+ .pushsection .discard.unwind_hints, "M", @progbits, UNWIND_HINT_SIZE
/* struct unwind_hint */
.long .Lhere_\@ - .
.short \sp_offset
diff --git a/kernel/bounds.c b/kernel/bounds.c
index 21c37e3ea629..f9bc13727721 100644
--- a/kernel/bounds.c
+++ b/kernel/bounds.c
@@ -15,6 +15,7 @@
#include <linux/spinlock_types.h>
#include <linux/jump_label.h>
#include <linux/static_call_types.h>
+#include <linux/objtool_types.h>
int main(void)
{
@@ -37,6 +38,9 @@ int main(void)
#endif
#ifdef CONFIG_HAVE_STATIC_CALL_INLINE
DEFINE(STATIC_CALL_TRAMP_KEY_SIZE, sizeof(struct static_call_tramp_key));
+#endif
+#ifdef CONFIG_OBJTOOL
+ DEFINE(UNWIND_HINT_SIZE, sizeof(struct unwind_hint));
#endif
/* End of constants */
--
2.49.0
Powered by blists - more mailing lists