Skip to content

Commit 9ea7e6b

Browse files
jpoimboePeter Zijlstra
authored andcommitted
init: Mark [arch_call_]rest_init() __noreturn
In preparation for improving objtool's handling of weak noreturn functions, mark start_kernel(), arch_call_rest_init(), and rest_init() __noreturn. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/7194ed8a989a85b98d92e62df660f4a90435a723.1681342859.git.jpoimboe@kernel.org
1 parent 5743654 commit 9ea7e6b

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

arch/s390/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int __init arch_early_irq_init(void)
396396
return 0;
397397
}
398398

399-
void __init arch_call_rest_init(void)
399+
void __init __noreturn arch_call_rest_init(void)
400400
{
401401
unsigned long stack;
402402

include/linux/start_kernel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
up something else. */
1010

1111
extern asmlinkage void __init start_kernel(void);
12-
extern void __init arch_call_rest_init(void);
13-
extern void __ref rest_init(void);
12+
extern void __init __noreturn arch_call_rest_init(void);
13+
extern void __ref __noreturn rest_init(void);
1414

1515
#endif /* _LINUX_START_KERNEL_H */

init/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void __init setup_command_line(char *command_line)
683683

684684
static __initdata DECLARE_COMPLETION(kthreadd_done);
685685

686-
noinline void __ref rest_init(void)
686+
noinline void __ref __noreturn rest_init(void)
687687
{
688688
struct task_struct *tsk;
689689
int pid;
@@ -889,7 +889,7 @@ static int __init early_randomize_kstack_offset(char *buf)
889889
early_param("randomize_kstack_offset", early_randomize_kstack_offset);
890890
#endif
891891

892-
void __init __weak arch_call_rest_init(void)
892+
void __init __weak __noreturn arch_call_rest_init(void)
893893
{
894894
rest_init();
895895
}

tools/objtool/check.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
202202
"__reiserfs_panic",
203203
"__stack_chk_fail",
204204
"__ubsan_handle_builtin_unreachable",
205+
"arch_call_rest_init",
205206
"arch_cpu_idle_dead",
206207
"cpu_bringup_and_idle",
207208
"cpu_startup_entry",
@@ -217,6 +218,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
217218
"machine_real_restart",
218219
"make_task_dead",
219220
"panic",
221+
"rest_init",
220222
"rewind_stack_and_make_dead",
221223
"sev_es_terminate",
222224
"snp_abort",

0 commit comments

Comments
 (0)