Commit 6245ce4a authored by Josh Poimboeuf's avatar Josh Poimboeuf

objtool: Move noreturn function list to separate file

This makes it a little cleaner and easier to maintain.
Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
Link: https://lore.kernel.org/r/cecacf07a69a244c74474c18b7652627de67a528.1681853186.git.jpoimboe@kernel.orgSigned-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
parent d59fec29
...@@ -306,9 +306,8 @@ the objtool maintainers. ...@@ -306,9 +306,8 @@ the objtool maintainers.
3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation 3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation
The call from foo() to bar() doesn't return, but bar() is missing the The call from foo() to bar() doesn't return, but bar() is missing the
__noreturn annotation. NOTE: In addition to adding the __noreturn __noreturn annotation. NOTE: In addition to annotating the function
annotation, the function name also needs to be added to with __noreturn, please also add it to tools/objtool/noreturns.h.
'global_noreturns' in tools/objtool/check.c.
4. file.o: warning: objtool: func(): can't find starting instruction 4. file.o: warning: objtool: func(): can't find starting instruction
or or
......
...@@ -192,49 +192,11 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, ...@@ -192,49 +192,11 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
struct instruction *insn; struct instruction *insn;
bool empty = true; bool empty = true;
/* #define NORETURN(func) __stringify(func),
* Unfortunately these have to be hard coded because the noreturn
* attribute isn't provided in ELF data. Keep 'em sorted.
*/
static const char * const global_noreturns[] = { static const char * const global_noreturns[] = {
"__invalid_creds", #include "noreturns.h"
"__module_put_and_kthread_exit",
"__reiserfs_panic",
"__stack_chk_fail",
"__ubsan_handle_builtin_unreachable",
"arch_call_rest_init",
"arch_cpu_idle_dead",
"btrfs_assertfail",
"cpu_bringup_and_idle",
"cpu_startup_entry",
"do_exit",
"do_group_exit",
"do_task_dead",
"ex_handler_msr_mce",
"fortify_panic",
"hlt_play_dead",
"hv_ghcb_terminate",
"kthread_complete_and_exit",
"kthread_exit",
"kunit_try_catch_throw",
"machine_real_restart",
"make_task_dead",
"mpt_halt_firmware",
"nmi_panic_self_stop",
"panic",
"panic_smp_self_stop",
"rest_init",
"rewind_stack_and_make_dead",
"sev_es_terminate",
"snp_abort",
"start_kernel",
"stop_this_cpu",
"usercopy_abort",
"x86_64_start_kernel",
"x86_64_start_reservations",
"xen_cpu_bringup_again",
"xen_start_kernel",
}; };
#undef NORETURN
if (!func) if (!func)
return false; return false;
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* This is a (sorted!) list of all known __noreturn functions in the kernel.
* It's needed for objtool to properly reverse-engineer the control flow graph.
*
* Yes, this is unfortunate. A better solution is in the works.
*/
NORETURN(__invalid_creds)
NORETURN(__module_put_and_kthread_exit)
NORETURN(__reiserfs_panic)
NORETURN(__stack_chk_fail)
NORETURN(__ubsan_handle_builtin_unreachable)
NORETURN(arch_call_rest_init)
NORETURN(arch_cpu_idle_dead)
NORETURN(btrfs_assertfail)
NORETURN(cpu_bringup_and_idle)
NORETURN(cpu_startup_entry)
NORETURN(do_exit)
NORETURN(do_group_exit)
NORETURN(do_task_dead)
NORETURN(ex_handler_msr_mce)
NORETURN(fortify_panic)
NORETURN(hlt_play_dead)
NORETURN(hv_ghcb_terminate)
NORETURN(kthread_complete_and_exit)
NORETURN(kthread_exit)
NORETURN(kunit_try_catch_throw)
NORETURN(machine_real_restart)
NORETURN(make_task_dead)
NORETURN(mpt_halt_firmware)
NORETURN(nmi_panic_self_stop)
NORETURN(panic)
NORETURN(panic_smp_self_stop)
NORETURN(rest_init)
NORETURN(rewind_stack_and_make_dead)
NORETURN(sev_es_terminate)
NORETURN(snp_abort)
NORETURN(start_kernel)
NORETURN(stop_this_cpu)
NORETURN(usercopy_abort)
NORETURN(x86_64_start_kernel)
NORETURN(x86_64_start_reservations)
NORETURN(xen_cpu_bringup_again)
NORETURN(xen_start_kernel)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment