[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1687249112-2790-2-git-send-email-tangyouling@loongson.cn>
Date: Tue, 20 Jun 2023 16:18:30 +0800
From: Youling Tang <tangyouling@...ngson.cn>
To: Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Huacai Chen <chenhuacai@...nel.org>,
madvenka@...ux.microsoft.com
Cc: chenzhongjin@...wei.com, WANG Xuerui <kernel@...0n.name>,
Xi Ruoyao <xry111@...111.site>, live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
tangyouling00@...il.com, youling.tang@...look.com
Subject: [RFC PATCH v1 21/23] objtool: Add arch-specific "noreturn" function handling
Fix the following warnings:
arch/loongarch/mm/fault.o: warning: objtool: no_context.part.0() falls through to
next function do_sigsegv()
It should mark 'dead_end' when the function is "noreturn/__noreturn".
Signed-off-by: Youling Tang <tangyouling@...ngson.cn>
---
tools/objtool/arch/loongarch/special.c | 5 +++++
tools/objtool/arch/powerpc/special.c | 3 +++
tools/objtool/arch/x86/special.c | 4 ++++
tools/objtool/check.c | 7 ++++++-
tools/objtool/include/objtool/special.h | 3 +++
5 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/arch/loongarch/special.c b/tools/objtool/arch/loongarch/special.c
index 8669dbe44459..be4d5d83e331 100644
--- a/tools/objtool/arch/loongarch/special.c
+++ b/tools/objtool/arch/loongarch/special.c
@@ -5,6 +5,11 @@
#include <objtool/special.h>
#include <objtool/builtin.h>
+/* Architecture specific "noreturn" function */
+const char * const arch_noreturns[] = {
+ "die",
+};
+int arch_noreturns_size = ARRAY_SIZE(arch_noreturns);
bool arch_support_alt_relocation(struct special_alt *special_alt,
struct instruction *insn,
diff --git a/tools/objtool/arch/powerpc/special.c b/tools/objtool/arch/powerpc/special.c
index d33868147196..35107e6ae2f1 100644
--- a/tools/objtool/arch/powerpc/special.c
+++ b/tools/objtool/arch/powerpc/special.c
@@ -4,6 +4,9 @@
#include <objtool/special.h>
#include <objtool/builtin.h>
+/* Architecture specific "noreturn" function */
+const char * const arch_noreturns[] = {};
+int arch_noreturns_size = ARRAY_SIZE(arch_noreturns);
bool arch_support_alt_relocation(struct special_alt *special_alt,
struct instruction *insn,
diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c
index 7c97b7391279..48fa72f564f9 100644
--- a/tools/objtool/arch/x86/special.c
+++ b/tools/objtool/arch/x86/special.c
@@ -7,6 +7,10 @@
#define X86_FEATURE_POPCNT (4 * 32 + 23)
#define X86_FEATURE_SMAP (9 * 32 + 20)
+/* Architecture specific "noreturn" function */
+const char * const arch_noreturns[] = {};
+int arch_noreturns_size = ARRAY_SIZE(arch_noreturns);
+
void arch_handle_alternative(unsigned short feature, struct special_alt *alt)
{
switch (feature) {
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f91723010d6b..c637e54088f6 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -110,11 +110,16 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
if (func->bind == STB_WEAK)
return false;
- if (func->bind == STB_GLOBAL)
+ if (func->bind == STB_GLOBAL) {
for (i = 0; i < ARRAY_SIZE(global_noreturns); i++)
if (!strcmp(func->name, global_noreturns[i]))
return true;
+ for (i = 0; i < arch_noreturns_size; i++)
+ if (!strcmp(func->name, arch_noreturns[i]))
+ return true;
+ }
+
if (!func->len)
return false;
diff --git a/tools/objtool/include/objtool/special.h b/tools/objtool/include/objtool/special.h
index 86d4af9c5aa9..f800817f0ed8 100644
--- a/tools/objtool/include/objtool/special.h
+++ b/tools/objtool/include/objtool/special.h
@@ -30,6 +30,9 @@ struct special_alt {
unsigned int orig_len, new_len; /* group only */
};
+extern const char * const arch_noreturns[];
+extern int arch_noreturns_size;
+
int special_get_alts(struct elf *elf, struct list_head *alts);
void arch_handle_alternative(unsigned short feature, struct special_alt *alt);
--
2.39.2
Powered by blists - more mailing lists