@@ -2395,9 +2395,8 @@ static bool ignore_unreachable_insn(struct instruction *insn)
2395
2395
return false;
2396
2396
}
2397
2397
2398
- static int validate_functions (struct objtool_file * file )
2398
+ static int validate_section (struct objtool_file * file , struct section * sec )
2399
2399
{
2400
- struct section * sec ;
2401
2400
struct symbol * func ;
2402
2401
struct instruction * insn ;
2403
2402
struct insn_state state ;
@@ -2410,36 +2409,45 @@ static int validate_functions(struct objtool_file *file)
2410
2409
CFI_NUM_REGS * sizeof (struct cfi_reg ));
2411
2410
state .stack_size = initial_func_cfi .cfa .offset ;
2412
2411
2413
- for_each_sec (file , sec ) {
2414
- list_for_each_entry (func , & sec -> symbol_list , list ) {
2415
- if (func -> type != STT_FUNC )
2416
- continue ;
2412
+ list_for_each_entry (func , & sec -> symbol_list , list ) {
2413
+ if (func -> type != STT_FUNC )
2414
+ continue ;
2417
2415
2418
- if (!func -> len ) {
2419
- WARN ("%s() is missing an ELF size annotation" ,
2420
- func -> name );
2421
- warnings ++ ;
2422
- }
2416
+ if (!func -> len ) {
2417
+ WARN ("%s() is missing an ELF size annotation" ,
2418
+ func -> name );
2419
+ warnings ++ ;
2420
+ }
2423
2421
2424
- if (func -> pfunc != func || func -> alias != func )
2425
- continue ;
2422
+ if (func -> pfunc != func || func -> alias != func )
2423
+ continue ;
2426
2424
2427
- insn = find_insn (file , sec , func -> offset );
2428
- if (!insn || insn -> ignore || insn -> visited )
2429
- continue ;
2425
+ insn = find_insn (file , sec , func -> offset );
2426
+ if (!insn || insn -> ignore || insn -> visited )
2427
+ continue ;
2430
2428
2431
- state .uaccess = func -> uaccess_safe ;
2429
+ state .uaccess = func -> uaccess_safe ;
2432
2430
2433
- ret = validate_branch (file , func , insn , state );
2434
- if (ret && backtrace )
2435
- BT_FUNC ("<=== (func)" , insn );
2436
- warnings += ret ;
2437
- }
2431
+ ret = validate_branch (file , func , insn , state );
2432
+ if (ret && backtrace )
2433
+ BT_FUNC ("<=== (func)" , insn );
2434
+ warnings += ret ;
2438
2435
}
2439
2436
2440
2437
return warnings ;
2441
2438
}
2442
2439
2440
+ static int validate_functions (struct objtool_file * file )
2441
+ {
2442
+ struct section * sec ;
2443
+ int warnings = 0 ;
2444
+
2445
+ for_each_sec (file , sec )
2446
+ warnings += validate_section (file , sec );
2447
+
2448
+ return warnings ;
2449
+ }
2450
+
2443
2451
static int validate_reachable_instructions (struct objtool_file * file )
2444
2452
{
2445
2453
struct instruction * insn ;
0 commit comments