lkml.org 
[lkml]   [2023]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 11/14] DCE/DSE: riscv: build reference for .pushsection in C functions
Date
Add the SECTION_SHF_LINK_ORDER method and the SECTION_SHF_GROUP method
to refactor __ASM_EXTABLE_RAW, so it won't produce orphan sections
anymore.

Signed-off-by: Yuan Tan <tanyuan@tinylab.org>
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
arch/riscv/include/asm/asm-extable.h | 34 ++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/include/asm/asm-extable.h b/arch/riscv/include/asm/asm-extable.h
index d0be5a838242..7164d871e038 100644
--- a/arch/riscv/include/asm/asm-extable.h
+++ b/arch/riscv/include/asm/asm-extable.h
@@ -13,6 +13,21 @@

#ifdef __ASSEMBLY__

+#if defined(CONFIG_SECTION_SHF_LINK_ORDER_SUPPORT)
+#define __ASM_EXTABLE_PUSH_SECTION \
+ __LABEL_NAME(.L__ex_table) : \
+ .pushsection __SECTION_NAME(__ex_table), "ao", __LABEL_NAME(.L__ex_table)
+
+#elif defined(CONFIG_SECTION_SHF_GROUP_SUPPORT)
+#define __ASM_EXTABLE_PUSH_SECTION \
+ .attach_to_group __SECTION_NAME(__ex_table); \
+ .pushsection __SECTION_NAME(__ex_table), "a?"
+
+#else
+#define __ASM_EXTABLE_PUSH_SECTION \
+ .pushsection __SECTION_NAME(__ex_table), "a"
+#endif
+
#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \
.pushsection __SECTION_NAME(__ex_table), "a"; \
.balign 4; \
@@ -32,8 +47,23 @@
#include <linux/stringify.h>
#include <asm/gpr-num.h>

-#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \
- ".pushsection " __SECTION_NAME(__ex_table) ", \"a\"\n" \
+#ifdef CONFIG_SECTION_SHF_LINK_ORDER_SUPPORT
+#define __ASM_EXTABLE_PUSH_SECTION \
+ __LABEL_NAME(.L__ex_table) ":" \
+ ".pushsection " __SECTION_NAME(__ex_table) ", \"ao\"," __LABEL_NAME(.L__ex_table) "\n"
+
+#elif defined(CONFIG_SECTION_SHF_GROUP_SUPPORT)
+#define __ASM_EXTABLE_PUSH_SECTION \
+ ".attach_to_group " __SECTION_NAME(__ex_table) "\n" \
+ ".pushsection " __SECTION_NAME(__ex_table) ", \"a?\"\n"
+
+#else
+#define __ASM_EXTABLE_PUSH_SECTION \
+ ".pushsection " __SECTION_NAME(__ex_table) ", \"a\"\n"
+#endif
+
+#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \
+ __ASM_EXTABLE_PUSH_SECTION \
".balign 4\n" \
".long ((" insn ") - .)\n" \
".long ((" fixup ") - .)\n" \
--
2.34.1
\
 
 \ /
  Last update: 2023-11-20 13:48    [W:0.082 / U:1.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site