@@ -2486,12 +2486,37 @@ static bool ignore_unreachable_insn(struct instruction *insn)
2486
2486
return false;
2487
2487
}
2488
2488
2489
- static int validate_section (struct objtool_file * file , struct section * sec )
2489
+ static int validate_symbol (struct objtool_file * file , struct section * sec ,
2490
+ struct symbol * sym , struct insn_state * state )
2490
2491
{
2491
- struct symbol * func ;
2492
2492
struct instruction * insn ;
2493
+ int ret ;
2494
+
2495
+ if (!sym -> len ) {
2496
+ WARN ("%s() is missing an ELF size annotation" , sym -> name );
2497
+ return 1 ;
2498
+ }
2499
+
2500
+ if (sym -> pfunc != sym || sym -> alias != sym )
2501
+ return 0 ;
2502
+
2503
+ insn = find_insn (file , sec , sym -> offset );
2504
+ if (!insn || insn -> ignore || insn -> visited )
2505
+ return 0 ;
2506
+
2507
+ state -> uaccess = sym -> uaccess_safe ;
2508
+
2509
+ ret = validate_branch (file , insn -> func , insn , * state );
2510
+ if (ret && backtrace )
2511
+ BT_FUNC ("<=== (sym)" , insn );
2512
+ return ret ;
2513
+ }
2514
+
2515
+ static int validate_section (struct objtool_file * file , struct section * sec )
2516
+ {
2493
2517
struct insn_state state ;
2494
- int ret , warnings = 0 ;
2518
+ struct symbol * func ;
2519
+ int warnings = 0 ;
2495
2520
2496
2521
/*
2497
2522
* We need the full vmlinux for noinstr validation, otherwise we can
@@ -2505,31 +2530,13 @@ static int validate_section(struct objtool_file *file, struct section *sec)
2505
2530
if (func -> type != STT_FUNC )
2506
2531
continue ;
2507
2532
2508
- if (!func -> len ) {
2509
- WARN ("%s() is missing an ELF size annotation" ,
2510
- func -> name );
2511
- warnings ++ ;
2512
- }
2513
-
2514
- if (func -> pfunc != func || func -> alias != func )
2515
- continue ;
2516
-
2517
- insn = find_insn (file , sec , func -> offset );
2518
- if (!insn || insn -> ignore || insn -> visited )
2519
- continue ;
2520
-
2521
2533
clear_insn_state (& state );
2522
2534
state .cfi .cfa = initial_func_cfi .cfa ;
2523
2535
memcpy (& state .cfi .regs , & initial_func_cfi .regs ,
2524
2536
CFI_NUM_REGS * sizeof (struct cfi_reg ));
2525
2537
state .cfi .stack_size = initial_func_cfi .cfa .offset ;
2526
2538
2527
- state .uaccess = func -> uaccess_safe ;
2528
-
2529
- ret = validate_branch (file , func , insn , state );
2530
- if (ret && backtrace )
2531
- BT_FUNC ("<=== (func)" , insn );
2532
- warnings += ret ;
2539
+ warnings += validate_symbol (file , sec , func , & state );
2533
2540
}
2534
2541
2535
2542
return warnings ;
0 commit comments