Re: [PATCH v3 5/8] objtool: Check local label about sibling call

From: Peter Zijlstra
Date: Fri Oct 20 2023 - 05:30:51 EST


On Fri, Oct 20, 2023 at 10:26:58AM +0800, Tiezhu Yang wrote:

> + if (reloc && reloc->sym->type == STT_NOTYPE &&
> + strncmp(reloc->sym->name, ".L", 2) == 0)

> + if (reloc->sym->type == STT_NOTYPE &&
> + strncmp(reloc->sym->name, ".L", 2) == 0) {

Would not something like the below be better?

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e308d1ba664e..a57d293c834d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2506,6 +2506,9 @@ static int classify_symbols(struct objtool_file *file)
struct symbol *func;

for_each_sym(file, func) {
+ if (func->type == STT_NOTYPE && strstarts(func->name, ".L"))
+ func->local_label = true;
+
if (func->bind != STB_GLOBAL)
continue;

diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index 9f71e988eca4..2b8a69de4db8 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -67,6 +67,7 @@ struct symbol {
u8 profiling_func : 1;
u8 warned : 1;
u8 embedded_insn : 1;
+ u8 local_label : 1;
struct list_head pv_target;
struct reloc *relocs;
};