@@ -114,16 +114,34 @@ static struct instruction *prev_insn_same_sym(struct objtool_file *file,
114
114
for (insn = next_insn_same_sec(file, insn); insn; \
115
115
insn = next_insn_same_sec(file, insn))
116
116
117
+ static inline struct symbol * insn_call_dest (struct instruction * insn )
118
+ {
119
+ if (insn -> type == INSN_JUMP_DYNAMIC ||
120
+ insn -> type == INSN_CALL_DYNAMIC )
121
+ return NULL ;
122
+
123
+ return insn -> _call_dest ;
124
+ }
125
+
126
+ static inline struct reloc * insn_jump_table (struct instruction * insn )
127
+ {
128
+ if (insn -> type == INSN_JUMP_DYNAMIC ||
129
+ insn -> type == INSN_CALL_DYNAMIC )
130
+ return insn -> _jump_table ;
131
+
132
+ return NULL ;
133
+ }
134
+
117
135
static bool is_jump_table_jump (struct instruction * insn )
118
136
{
119
137
struct alt_group * alt_group = insn -> alt_group ;
120
138
121
- if (insn -> jump_table )
139
+ if (insn_jump_table ( insn ) )
122
140
return true;
123
141
124
142
/* Retpoline alternative for a jump table? */
125
143
return alt_group && alt_group -> orig_group &&
126
- alt_group -> orig_group -> first_insn -> jump_table ;
144
+ insn_jump_table ( alt_group -> orig_group -> first_insn ) ;
127
145
}
128
146
129
147
static bool is_sibling_call (struct instruction * insn )
@@ -137,8 +155,8 @@ static bool is_sibling_call(struct instruction *insn)
137
155
return !is_jump_table_jump (insn );
138
156
}
139
157
140
- /* add_jump_destinations() sets insn->call_dest for sibling calls. */
141
- return (is_static_jump (insn ) && insn -> call_dest );
158
+ /* add_jump_destinations() sets insn_call_dest( insn) for sibling calls. */
159
+ return (is_static_jump (insn ) && insn_call_dest ( insn ) );
142
160
}
143
161
144
162
/*
@@ -274,8 +292,8 @@ static void init_insn_state(struct objtool_file *file, struct insn_state *state,
274
292
275
293
/*
276
294
* We need the full vmlinux for noinstr validation, otherwise we can
277
- * not correctly determine insn->call_dest-> sec (external symbols do
278
- * not have a section).
295
+ * not correctly determine insn_call_dest( insn)-> sec (external symbols
296
+ * do not have a section).
279
297
*/
280
298
if (opts .link && opts .noinstr && sec )
281
299
state -> noinstr = sec -> noinstr ;
@@ -678,7 +696,7 @@ static int create_static_call_sections(struct objtool_file *file)
678
696
return -1 ;
679
697
680
698
/* find key symbol */
681
- key_name = strdup (insn -> call_dest -> name );
699
+ key_name = strdup (insn_call_dest ( insn ) -> name );
682
700
if (!key_name ) {
683
701
perror ("strdup" );
684
702
return -1 ;
@@ -709,7 +727,7 @@ static int create_static_call_sections(struct objtool_file *file)
709
727
* trampoline address. This is fixed up in
710
728
* static_call_add_module().
711
729
*/
712
- key_sym = insn -> call_dest ;
730
+ key_sym = insn_call_dest ( insn ) ;
713
731
}
714
732
free (key_name );
715
733
@@ -1340,7 +1358,7 @@ static void annotate_call_site(struct objtool_file *file,
1340
1358
struct instruction * insn , bool sibling )
1341
1359
{
1342
1360
struct reloc * reloc = insn_reloc (file , insn );
1343
- struct symbol * sym = insn -> call_dest ;
1361
+ struct symbol * sym = insn_call_dest ( insn ) ;
1344
1362
1345
1363
if (!sym )
1346
1364
sym = reloc -> sym ;
@@ -1425,7 +1443,7 @@ static void annotate_call_site(struct objtool_file *file,
1425
1443
static void add_call_dest (struct objtool_file * file , struct instruction * insn ,
1426
1444
struct symbol * dest , bool sibling )
1427
1445
{
1428
- insn -> call_dest = dest ;
1446
+ insn -> _call_dest = dest ;
1429
1447
if (!dest )
1430
1448
return ;
1431
1449
@@ -1683,12 +1701,12 @@ static int add_call_destinations(struct objtool_file *file)
1683
1701
if (insn -> ignore )
1684
1702
continue ;
1685
1703
1686
- if (!insn -> call_dest ) {
1704
+ if (!insn_call_dest ( insn ) ) {
1687
1705
WARN_FUNC ("unannotated intra-function call" , insn -> sec , insn -> offset );
1688
1706
return -1 ;
1689
1707
}
1690
1708
1691
- if (insn_func (insn ) && insn -> call_dest -> type != STT_FUNC ) {
1709
+ if (insn_func (insn ) && insn_call_dest ( insn ) -> type != STT_FUNC ) {
1692
1710
WARN_FUNC ("unsupported call to non-function" ,
1693
1711
insn -> sec , insn -> offset );
1694
1712
return -1 ;
@@ -2125,7 +2143,7 @@ static void mark_func_jump_tables(struct objtool_file *file,
2125
2143
reloc = find_jump_table (file , func , insn );
2126
2144
if (reloc ) {
2127
2145
reloc -> jump_table_start = true;
2128
- insn -> jump_table = reloc ;
2146
+ insn -> _jump_table = reloc ;
2129
2147
}
2130
2148
}
2131
2149
}
@@ -2137,10 +2155,10 @@ static int add_func_jump_tables(struct objtool_file *file,
2137
2155
int ret ;
2138
2156
2139
2157
func_for_each_insn (file , func , insn ) {
2140
- if (!insn -> jump_table )
2158
+ if (!insn_jump_table ( insn ) )
2141
2159
continue ;
2142
2160
2143
- ret = add_jump_table (file , insn , insn -> jump_table );
2161
+ ret = add_jump_table (file , insn , insn_jump_table ( insn ) );
2144
2162
if (ret )
2145
2163
return ret ;
2146
2164
}
@@ -2612,8 +2630,8 @@ static int decode_sections(struct objtool_file *file)
2612
2630
static bool is_fentry_call (struct instruction * insn )
2613
2631
{
2614
2632
if (insn -> type == INSN_CALL &&
2615
- insn -> call_dest &&
2616
- insn -> call_dest -> fentry )
2633
+ insn_call_dest ( insn ) &&
2634
+ insn_call_dest ( insn ) -> fentry )
2617
2635
return true;
2618
2636
2619
2637
return false;
@@ -3320,8 +3338,8 @@ static inline const char *call_dest_name(struct instruction *insn)
3320
3338
struct reloc * rel ;
3321
3339
int idx ;
3322
3340
3323
- if (insn -> call_dest )
3324
- return insn -> call_dest -> name ;
3341
+ if (insn_call_dest ( insn ) )
3342
+ return insn_call_dest ( insn ) -> name ;
3325
3343
3326
3344
rel = insn_reloc (NULL , insn );
3327
3345
if (rel && !strcmp (rel -> sym -> name , "pv_ops" )) {
@@ -3403,13 +3421,13 @@ static int validate_call(struct objtool_file *file,
3403
3421
struct insn_state * state )
3404
3422
{
3405
3423
if (state -> noinstr && state -> instr <= 0 &&
3406
- !noinstr_call_dest (file , insn , insn -> call_dest )) {
3424
+ !noinstr_call_dest (file , insn , insn_call_dest ( insn ) )) {
3407
3425
WARN_FUNC ("call to %s() leaves .noinstr.text section" ,
3408
3426
insn -> sec , insn -> offset , call_dest_name (insn ));
3409
3427
return 1 ;
3410
3428
}
3411
3429
3412
- if (state -> uaccess && !func_uaccess_safe (insn -> call_dest )) {
3430
+ if (state -> uaccess && !func_uaccess_safe (insn_call_dest ( insn ) )) {
3413
3431
WARN_FUNC ("call to %s() with UACCESS enabled" ,
3414
3432
insn -> sec , insn -> offset , call_dest_name (insn ));
3415
3433
return 1 ;
@@ -3847,11 +3865,11 @@ static int validate_entry(struct objtool_file *file, struct instruction *insn)
3847
3865
3848
3866
/* fallthrough */
3849
3867
case INSN_CALL :
3850
- dest = find_insn (file , insn -> call_dest -> sec ,
3851
- insn -> call_dest -> offset );
3868
+ dest = find_insn (file , insn_call_dest ( insn ) -> sec ,
3869
+ insn_call_dest ( insn ) -> offset );
3852
3870
if (!dest ) {
3853
3871
WARN ("Unresolved function after linking!?: %s" ,
3854
- insn -> call_dest -> name );
3872
+ insn_call_dest ( insn ) -> name );
3855
3873
return -1 ;
3856
3874
}
3857
3875
@@ -3952,13 +3970,13 @@ static int validate_retpoline(struct objtool_file *file)
3952
3970
static bool is_kasan_insn (struct instruction * insn )
3953
3971
{
3954
3972
return (insn -> type == INSN_CALL &&
3955
- !strcmp (insn -> call_dest -> name , "__asan_handle_no_return" ));
3973
+ !strcmp (insn_call_dest ( insn ) -> name , "__asan_handle_no_return" ));
3956
3974
}
3957
3975
3958
3976
static bool is_ubsan_insn (struct instruction * insn )
3959
3977
{
3960
3978
return (insn -> type == INSN_CALL &&
3961
- !strcmp (insn -> call_dest -> name ,
3979
+ !strcmp (insn_call_dest ( insn ) -> name ,
3962
3980
"__ubsan_handle_builtin_unreachable" ));
3963
3981
}
3964
3982
@@ -4036,7 +4054,8 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
4036
4054
* It may also insert a UD2 after calling a __noreturn function.
4037
4055
*/
4038
4056
prev_insn = list_prev_entry (insn , list );
4039
- if ((prev_insn -> dead_end || dead_end_function (file , prev_insn -> call_dest )) &&
4057
+ if ((prev_insn -> dead_end ||
4058
+ dead_end_function (file , insn_call_dest (prev_insn ))) &&
4040
4059
(insn -> type == INSN_BUG ||
4041
4060
(insn -> type == INSN_JUMP_UNCONDITIONAL &&
4042
4061
insn -> jump_dest && insn -> jump_dest -> type == INSN_BUG )))
0 commit comments