[RFC,v1,20/23] LoongArch: Move some data definitions into the .data section

Message ID 1687249112-2790-1-git-send-email-tangyouling@loongson.cn
State New
Headers
Series None |

Commit Message

Youling Tang June 20, 2023, 8:18 a.m. UTC
  Make part of the data definition into the .data section, avoid objtool
to detect "unreachable instruction" warning.

At the same time, removing unreachable instruction flow operations
(b process_entry).

Co-developed-by: Jinyang He <hejinyang@loongson.cn>
Signed-off-by: Jinyang He <hejinyang@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
 arch/loongarch/kernel/genex.S           | 2 ++
 arch/loongarch/kernel/relocate_kernel.S | 7 +++----
 2 files changed, 5 insertions(+), 4 deletions(-)
  

Patch

diff --git a/arch/loongarch/kernel/genex.S b/arch/loongarch/kernel/genex.S
index 44ff1ff64260..883b718b5ffe 100644
--- a/arch/loongarch/kernel/genex.S
+++ b/arch/loongarch/kernel/genex.S
@@ -77,7 +77,9 @@  SYM_FUNC_END(except_vec_cex)
 	668:
 	RESTORE_ALL_AND_RET
 	SYM_FUNC_END(handle_\exception)
+	.pushsection	".data", "aw", %progbits
 	SYM_DATA(unwind_hint_\exception, .word 668b - 666b)
+	.popsection
 	.endm
 
 	BUILD_HANDLER ade ade badv
diff --git a/arch/loongarch/kernel/relocate_kernel.S b/arch/loongarch/kernel/relocate_kernel.S
index d0123fa2b511..1ea3df967b46 100644
--- a/arch/loongarch/kernel/relocate_kernel.S
+++ b/arch/loongarch/kernel/relocate_kernel.S
@@ -75,7 +75,6 @@  copy_word:
 	LONG_ADDI	s5, s5, -1
 	beqz		s5, process_entry
 	b		copy_word
-	b		process_entry
 
 done:
 	ibar		0
@@ -112,6 +111,6 @@  SYM_CODE_END(kexec_smp_wait)
 
 relocate_new_kernel_end:
 
-SYM_DATA_START(relocate_new_kernel_size)
-	PTR		relocate_new_kernel_end - relocate_new_kernel
-SYM_DATA_END(relocate_new_kernel_size)
+.pushsection	".data", "aw", %progbits
+SYM_DATA(relocate_new_kernel_size, .long relocate_new_kernel_end - relocate_new_kernel)
+.popsection