@@ -60,7 +60,7 @@ struct alternative {
60
60
61
61
struct objtool_file {
62
62
struct elf * elf ;
63
- struct list_head insns ;
63
+ struct list_head insn_list ;
64
64
};
65
65
66
66
const char * objname ;
@@ -71,7 +71,7 @@ static struct instruction *find_insn(struct objtool_file *file,
71
71
{
72
72
struct instruction * insn ;
73
73
74
- list_for_each_entry (insn , & file -> insns , list )
74
+ list_for_each_entry (insn , & file -> insn_list , list )
75
75
if (insn -> sec == sec && insn -> offset == offset )
76
76
return insn ;
77
77
@@ -83,18 +83,18 @@ static struct instruction *next_insn_same_sec(struct objtool_file *file,
83
83
{
84
84
struct instruction * next = list_next_entry (insn , list );
85
85
86
- if (& next -> list == & file -> insns || next -> sec != insn -> sec )
86
+ if (& next -> list == & file -> insn_list || next -> sec != insn -> sec )
87
87
return NULL ;
88
88
89
89
return next ;
90
90
}
91
91
92
92
#define for_each_insn (file , insn ) \
93
- list_for_each_entry(insn, &file->insns , list)
93
+ list_for_each_entry(insn, &file->insn_list , list)
94
94
95
95
#define func_for_each_insn (file , func , insn ) \
96
96
for (insn = find_insn(file, func->sec, func->offset); \
97
- insn && &insn->list != &file->insns && \
97
+ insn && &insn->list != &file->insn_list && \
98
98
insn->sec == func->sec && \
99
99
insn->offset < func->offset + func->len; \
100
100
insn = list_next_entry(insn, list))
@@ -117,7 +117,7 @@ static bool ignore_func(struct objtool_file *file, struct symbol *func)
117
117
/* check for STACK_FRAME_NON_STANDARD */
118
118
macro_sec = find_section_by_name (file -> elf , "__func_stack_frame_non_standard" );
119
119
if (macro_sec && macro_sec -> rela )
120
- list_for_each_entry (rela , & macro_sec -> rela -> relas , list )
120
+ list_for_each_entry (rela , & macro_sec -> rela -> rela_list , list )
121
121
if (rela -> sym -> sec == func -> sec &&
122
122
rela -> addend == func -> offset )
123
123
return true;
@@ -240,7 +240,7 @@ static int dead_end_function(struct objtool_file *file, struct symbol *func)
240
240
241
241
/*
242
242
* Call the arch-specific instruction decoder for all the instructions and add
243
- * them to the global insns list.
243
+ * them to the global instruction list.
244
244
*/
245
245
static int decode_instructions (struct objtool_file * file )
246
246
{
@@ -275,7 +275,7 @@ static int decode_instructions(struct objtool_file *file)
275
275
return -1 ;
276
276
}
277
277
278
- list_add_tail (& insn -> list , & file -> insns );
278
+ list_add_tail (& insn -> list , & file -> insn_list );
279
279
}
280
280
}
281
281
@@ -285,14 +285,14 @@ static int decode_instructions(struct objtool_file *file)
285
285
/*
286
286
* Warnings shouldn't be reported for ignored functions.
287
287
*/
288
- static void get_ignores (struct objtool_file * file )
288
+ static void add_ignores (struct objtool_file * file )
289
289
{
290
290
struct instruction * insn ;
291
291
struct section * sec ;
292
292
struct symbol * func ;
293
293
294
294
list_for_each_entry (sec , & file -> elf -> sections , list ) {
295
- list_for_each_entry (func , & sec -> symbols , list ) {
295
+ list_for_each_entry (func , & sec -> symbol_list , list ) {
296
296
if (func -> type != STT_FUNC )
297
297
continue ;
298
298
@@ -308,7 +308,7 @@ static void get_ignores(struct objtool_file *file)
308
308
/*
309
309
* Find the destination instructions for all jumps.
310
310
*/
311
- static int get_jump_destinations (struct objtool_file * file )
311
+ static int add_jump_destinations (struct objtool_file * file )
312
312
{
313
313
struct instruction * insn ;
314
314
struct rela * rela ;
@@ -365,7 +365,7 @@ static int get_jump_destinations(struct objtool_file *file)
365
365
/*
366
366
* Find the destination instructions for all calls.
367
367
*/
368
- static int get_call_destinations (struct objtool_file * file )
368
+ static int add_call_destinations (struct objtool_file * file )
369
369
{
370
370
struct instruction * insn ;
371
371
unsigned long dest_off ;
@@ -534,7 +534,7 @@ static int handle_jump_alt(struct objtool_file *file,
534
534
* instruction(s) has them added to its insn->alts list, which will be
535
535
* traversed in validate_branch().
536
536
*/
537
- static int get_special_section_alts (struct objtool_file * file )
537
+ static int add_special_section_alts (struct objtool_file * file )
538
538
{
539
539
struct list_head special_alts ;
540
540
struct instruction * orig_insn , * new_insn ;
@@ -604,10 +604,10 @@ static int get_special_section_alts(struct objtool_file *file)
604
604
* section which contains a list of addresses within the function to jump to.
605
605
* This finds these jump tables and adds them to the insn->alts lists.
606
606
*/
607
- static int get_switch_alts (struct objtool_file * file )
607
+ static int add_switch_table_alts (struct objtool_file * file )
608
608
{
609
609
struct instruction * insn , * alt_insn ;
610
- struct rela * rodata_rela , * rela ;
610
+ struct rela * rodata_rela , * text_rela ;
611
611
struct section * rodata ;
612
612
struct symbol * func ;
613
613
struct alternative * alt ;
@@ -616,23 +616,23 @@ static int get_switch_alts(struct objtool_file *file)
616
616
if (insn -> type != INSN_JUMP_DYNAMIC )
617
617
continue ;
618
618
619
- rodata_rela = find_rela_by_dest_range (insn -> sec , insn -> offset ,
620
- insn -> len );
621
- if (!rodata_rela || strcmp (rodata_rela -> sym -> name , ".rodata" ))
619
+ text_rela = find_rela_by_dest_range (insn -> sec , insn -> offset ,
620
+ insn -> len );
621
+ if (!text_rela || strcmp (text_rela -> sym -> name , ".rodata" ))
622
622
continue ;
623
623
624
624
rodata = find_section_by_name (file -> elf , ".rodata" );
625
625
if (!rodata || !rodata -> rela )
626
626
continue ;
627
627
628
628
/* common case: jmpq *[addr](,%rax,8) */
629
- rela = find_rela_by_dest (rodata , rodata_rela -> addend );
629
+ rodata_rela = find_rela_by_dest (rodata , text_rela -> addend );
630
630
631
631
/* rare case: jmpq *[addr](%rip) */
632
- if (!rela )
633
- rela = find_rela_by_dest (rodata ,
634
- rodata_rela -> addend + 4 );
635
- if (!rela )
632
+ if (!rodata_rela )
633
+ rodata_rela = find_rela_by_dest (rodata ,
634
+ text_rela -> addend + 4 );
635
+ if (!rodata_rela )
636
636
continue ;
637
637
638
638
func = find_containing_func (insn -> sec , insn -> offset );
@@ -642,17 +642,19 @@ static int get_switch_alts(struct objtool_file *file)
642
642
return -1 ;
643
643
}
644
644
645
- list_for_each_entry_from (rela , & rodata -> rela -> relas , list ) {
646
- if (rela -> sym -> sec != insn -> sec ||
647
- rela -> addend <= func -> offset ||
648
- rela -> addend >= func -> offset + func -> len )
645
+ list_for_each_entry_from (rodata_rela , & rodata -> rela -> rela_list ,
646
+ list ) {
647
+ if (rodata_rela -> sym -> sec != insn -> sec ||
648
+ rodata_rela -> addend <= func -> offset ||
649
+ rodata_rela -> addend >= func -> offset + func -> len )
649
650
break ;
650
651
651
- alt_insn = find_insn (file , insn -> sec , rela -> addend );
652
+ alt_insn = find_insn (file , insn -> sec ,
653
+ rodata_rela -> addend );
652
654
if (!alt_insn ) {
653
655
WARN ("%s: can't find instruction at %s+0x%x" ,
654
656
rodata -> rela -> name , insn -> sec -> name ,
655
- rela -> addend );
657
+ rodata_rela -> addend );
656
658
return -1 ;
657
659
}
658
660
@@ -678,21 +680,21 @@ static int decode_sections(struct objtool_file *file)
678
680
if (ret )
679
681
return ret ;
680
682
681
- get_ignores (file );
683
+ add_ignores (file );
682
684
683
- ret = get_jump_destinations (file );
685
+ ret = add_jump_destinations (file );
684
686
if (ret )
685
687
return ret ;
686
688
687
- ret = get_call_destinations (file );
689
+ ret = add_call_destinations (file );
688
690
if (ret )
689
691
return ret ;
690
692
691
- ret = get_special_section_alts (file );
693
+ ret = add_special_section_alts (file );
692
694
if (ret )
693
695
return ret ;
694
696
695
- ret = get_switch_alts (file );
697
+ ret = add_switch_table_alts (file );
696
698
if (ret )
697
699
return ret ;
698
700
@@ -901,7 +903,7 @@ static bool is_gcov_insn(struct instruction *insn)
901
903
sec = rela -> sym -> sec ;
902
904
offset = rela -> addend + insn -> offset + insn -> len - rela -> offset ;
903
905
904
- list_for_each_entry (sym , & sec -> symbols , list ) {
906
+ list_for_each_entry (sym , & sec -> symbol_list , list ) {
905
907
if (sym -> type != STT_OBJECT )
906
908
continue ;
907
909
@@ -968,7 +970,7 @@ static int validate_functions(struct objtool_file *file)
968
970
int ret , warnings = 0 ;
969
971
970
972
list_for_each_entry (sec , & file -> elf -> sections , list ) {
971
- list_for_each_entry (func , & sec -> symbols , list ) {
973
+ list_for_each_entry (func , & sec -> symbol_list , list ) {
972
974
if (func -> type != STT_FUNC )
973
975
continue ;
974
976
@@ -986,7 +988,7 @@ static int validate_functions(struct objtool_file *file)
986
988
}
987
989
988
990
list_for_each_entry (sec , & file -> elf -> sections , list ) {
989
- list_for_each_entry (func , & sec -> symbols , list ) {
991
+ list_for_each_entry (func , & sec -> symbol_list , list ) {
990
992
if (func -> type != STT_FUNC )
991
993
continue ;
992
994
@@ -1028,7 +1030,7 @@ static void cleanup(struct objtool_file *file)
1028
1030
struct instruction * insn , * tmpinsn ;
1029
1031
struct alternative * alt , * tmpalt ;
1030
1032
1031
- list_for_each_entry_safe (insn , tmpinsn , & file -> insns , list ) {
1033
+ list_for_each_entry_safe (insn , tmpinsn , & file -> insn_list , list ) {
1032
1034
list_for_each_entry_safe (alt , tmpalt , & insn -> alts , list ) {
1033
1035
list_del (& alt -> list );
1034
1036
free (alt );
@@ -1067,7 +1069,7 @@ int cmd_check(int argc, const char **argv)
1067
1069
return 1 ;
1068
1070
}
1069
1071
1070
- INIT_LIST_HEAD (& file .insns );
1072
+ INIT_LIST_HEAD (& file .insn_list );
1071
1073
1072
1074
ret = decode_sections (& file );
1073
1075
if (ret < 0 )
0 commit comments