@@ -1271,7 +1271,7 @@ static bool is_first_func_insn(struct objtool_file *file, struct instruction *in
1271
1271
*/
1272
1272
static int add_jump_destinations (struct objtool_file * file )
1273
1273
{
1274
- struct instruction * insn ;
1274
+ struct instruction * insn , * jump_dest ;
1275
1275
struct reloc * reloc ;
1276
1276
struct section * dest_sec ;
1277
1277
unsigned long dest_off ;
@@ -1291,7 +1291,10 @@ static int add_jump_destinations(struct objtool_file *file)
1291
1291
add_retpoline_call (file , insn );
1292
1292
continue ;
1293
1293
} else if (insn -> func ) {
1294
- /* internal or external sibling call (with reloc) */
1294
+ /*
1295
+ * External sibling call or internal sibling call with
1296
+ * STT_FUNC reloc.
1297
+ */
1295
1298
add_call_dest (file , insn , reloc -> sym , true);
1296
1299
continue ;
1297
1300
} else if (reloc -> sym -> sec -> idx ) {
@@ -1303,8 +1306,8 @@ static int add_jump_destinations(struct objtool_file *file)
1303
1306
continue ;
1304
1307
}
1305
1308
1306
- insn -> jump_dest = find_insn (file , dest_sec , dest_off );
1307
- if (!insn -> jump_dest ) {
1309
+ jump_dest = find_insn (file , dest_sec , dest_off );
1310
+ if (!jump_dest ) {
1308
1311
1309
1312
/*
1310
1313
* This is a special case where an alt instruction
@@ -1323,8 +1326,8 @@ static int add_jump_destinations(struct objtool_file *file)
1323
1326
/*
1324
1327
* Cross-function jump.
1325
1328
*/
1326
- if (insn -> func && insn -> jump_dest -> func &&
1327
- insn -> func != insn -> jump_dest -> func ) {
1329
+ if (insn -> func && jump_dest -> func &&
1330
+ insn -> func != jump_dest -> func ) {
1328
1331
1329
1332
/*
1330
1333
* For GCC 8+, create parent/child links for any cold
@@ -1342,16 +1345,22 @@ static int add_jump_destinations(struct objtool_file *file)
1342
1345
* subfunction is through a jump table.
1343
1346
*/
1344
1347
if (!strstr (insn -> func -> name , ".cold" ) &&
1345
- strstr (insn -> jump_dest -> func -> name , ".cold" )) {
1346
- insn -> func -> cfunc = insn -> jump_dest -> func ;
1347
- insn -> jump_dest -> func -> pfunc = insn -> func ;
1348
+ strstr (jump_dest -> func -> name , ".cold" )) {
1349
+ insn -> func -> cfunc = jump_dest -> func ;
1350
+ jump_dest -> func -> pfunc = insn -> func ;
1348
1351
1349
- } else if (!same_function (insn , insn -> jump_dest ) &&
1350
- is_first_func_insn (file , insn -> jump_dest )) {
1351
- /* internal sibling call (without reloc) */
1352
- add_call_dest (file , insn , insn -> jump_dest -> func , true);
1352
+ } else if (!same_function (insn , jump_dest ) &&
1353
+ is_first_func_insn (file , jump_dest )) {
1354
+ /*
1355
+ * Internal sibling call without reloc or with
1356
+ * STT_SECTION reloc.
1357
+ */
1358
+ add_call_dest (file , insn , jump_dest -> func , true);
1359
+ continue ;
1353
1360
}
1354
1361
}
1362
+
1363
+ insn -> jump_dest = jump_dest ;
1355
1364
}
1356
1365
1357
1366
return 0 ;
0 commit comments