@@ -470,7 +470,7 @@ static int decode_instructions(struct objtool_file *file)
470470
471471// printf("%s: last chunk used: %d\n", sec->name, (int)idx);
472472
473- list_for_each_entry ( func , & sec -> symbol_list , list ) {
473+ sec_for_each_sym ( sec , func ) {
474474 if (func -> type != STT_NOTYPE && func -> type != STT_FUNC )
475475 continue ;
476476
@@ -924,7 +924,7 @@ static int create_ibt_endbr_seal_sections(struct objtool_file *file)
924924
925925static int create_cfi_sections (struct objtool_file * file )
926926{
927- struct section * sec , * s ;
927+ struct section * sec ;
928928 struct symbol * sym ;
929929 unsigned int * loc ;
930930 int idx ;
@@ -937,48 +937,38 @@ static int create_cfi_sections(struct objtool_file *file)
937937 }
938938
939939 idx = 0 ;
940- for_each_sec (file , s ) {
941- if (! s -> text )
940+ for_each_sym (file , sym ) {
941+ if (sym -> type != STT_FUNC )
942942 continue ;
943943
944- list_for_each_entry (sym , & s -> symbol_list , list ) {
945- if (sym -> type != STT_FUNC )
946- continue ;
947-
948- if (strncmp (sym -> name , "__cfi_" , 6 ))
949- continue ;
944+ if (strncmp (sym -> name , "__cfi_" , 6 ))
945+ continue ;
950946
951- idx ++ ;
952- }
947+ idx ++ ;
953948 }
954949
955950 sec = elf_create_section (file -> elf , ".cfi_sites" , 0 , sizeof (unsigned int ), idx );
956951 if (!sec )
957952 return -1 ;
958953
959954 idx = 0 ;
960- for_each_sec (file , s ) {
961- if (! s -> text )
955+ for_each_sym (file , sym ) {
956+ if (sym -> type != STT_FUNC )
962957 continue ;
963958
964- list_for_each_entry (sym , & s -> symbol_list , list ) {
965- if (sym -> type != STT_FUNC )
966- continue ;
967-
968- if (strncmp (sym -> name , "__cfi_" , 6 ))
969- continue ;
959+ if (strncmp (sym -> name , "__cfi_" , 6 ))
960+ continue ;
970961
971- loc = (unsigned int * )sec -> data -> d_buf + idx ;
972- memset (loc , 0 , sizeof (unsigned int ));
962+ loc = (unsigned int * )sec -> data -> d_buf + idx ;
963+ memset (loc , 0 , sizeof (unsigned int ));
973964
974- if (elf_add_reloc_to_insn (file -> elf , sec ,
975- idx * sizeof (unsigned int ),
976- R_X86_64_PC32 ,
977- s , sym -> offset ))
978- return -1 ;
965+ if (elf_add_reloc_to_insn (file -> elf , sec ,
966+ idx * sizeof (unsigned int ),
967+ R_X86_64_PC32 ,
968+ sym -> sec , sym -> offset ))
969+ return -1 ;
979970
980- idx ++ ;
981- }
971+ idx ++ ;
982972 }
983973
984974 return 0 ;
@@ -2207,23 +2197,20 @@ static int add_func_jump_tables(struct objtool_file *file,
22072197 */
22082198static int add_jump_table_alts (struct objtool_file * file )
22092199{
2210- struct section * sec ;
22112200 struct symbol * func ;
22122201 int ret ;
22132202
22142203 if (!file -> rodata )
22152204 return 0 ;
22162205
2217- for_each_sec (file , sec ) {
2218- list_for_each_entry (func , & sec -> symbol_list , list ) {
2219- if (func -> type != STT_FUNC )
2220- continue ;
2206+ for_each_sym (file , func ) {
2207+ if (func -> type != STT_FUNC )
2208+ continue ;
22212209
2222- mark_func_jump_tables (file , func );
2223- ret = add_func_jump_tables (file , func );
2224- if (ret )
2225- return ret ;
2226- }
2210+ mark_func_jump_tables (file , func );
2211+ ret = add_func_jump_tables (file , func );
2212+ if (ret )
2213+ return ret ;
22272214 }
22282215
22292216 return 0 ;
@@ -2535,30 +2522,27 @@ static bool is_profiling_func(const char *name)
25352522
25362523static int classify_symbols (struct objtool_file * file )
25372524{
2538- struct section * sec ;
25392525 struct symbol * func ;
25402526
2541- for_each_sec (file , sec ) {
2542- list_for_each_entry (func , & sec -> symbol_list , list ) {
2543- if (func -> bind != STB_GLOBAL )
2544- continue ;
2527+ for_each_sym (file , func ) {
2528+ if (func -> bind != STB_GLOBAL )
2529+ continue ;
25452530
2546- if (!strncmp (func -> name , STATIC_CALL_TRAMP_PREFIX_STR ,
2547- strlen (STATIC_CALL_TRAMP_PREFIX_STR )))
2548- func -> static_call_tramp = true;
2531+ if (!strncmp (func -> name , STATIC_CALL_TRAMP_PREFIX_STR ,
2532+ strlen (STATIC_CALL_TRAMP_PREFIX_STR )))
2533+ func -> static_call_tramp = true;
25492534
2550- if (arch_is_retpoline (func ))
2551- func -> retpoline_thunk = true;
2535+ if (arch_is_retpoline (func ))
2536+ func -> retpoline_thunk = true;
25522537
2553- if (arch_is_rethunk (func ))
2554- func -> return_thunk = true;
2538+ if (arch_is_rethunk (func ))
2539+ func -> return_thunk = true;
25552540
2556- if (arch_ftrace_match (func -> name ))
2557- func -> fentry = true;
2541+ if (arch_ftrace_match (func -> name ))
2542+ func -> fentry = true;
25582543
2559- if (is_profiling_func (func -> name ))
2560- func -> profiling_func = true;
2561- }
2544+ if (is_profiling_func (func -> name ))
2545+ func -> profiling_func = true;
25622546 }
25632547
25642548 return 0 ;
@@ -4213,7 +4197,7 @@ static int validate_section(struct objtool_file *file, struct section *sec)
42134197 struct symbol * func ;
42144198 int warnings = 0 ;
42154199
4216- list_for_each_entry ( func , & sec -> symbol_list , list ) {
4200+ sec_for_each_sym ( sec , func ) {
42174201 if (func -> type != STT_FUNC )
42184202 continue ;
42194203
0 commit comments