@@ -1271,7 +1271,7 @@ static bool is_first_func_insn(struct objtool_file *file, struct instruction *in
12711271 */
12721272static int add_jump_destinations (struct objtool_file * file )
12731273{
1274- struct instruction * insn ;
1274+ struct instruction * insn , * jump_dest ;
12751275 struct reloc * reloc ;
12761276 struct section * dest_sec ;
12771277 unsigned long dest_off ;
@@ -1291,7 +1291,10 @@ static int add_jump_destinations(struct objtool_file *file)
12911291 add_retpoline_call (file , insn );
12921292 continue ;
12931293 } 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+ */
12951298 add_call_dest (file , insn , reloc -> sym , true);
12961299 continue ;
12971300 } else if (reloc -> sym -> sec -> idx ) {
@@ -1303,8 +1306,8 @@ static int add_jump_destinations(struct objtool_file *file)
13031306 continue ;
13041307 }
13051308
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 ) {
13081311
13091312 /*
13101313 * This is a special case where an alt instruction
@@ -1323,8 +1326,8 @@ static int add_jump_destinations(struct objtool_file *file)
13231326 /*
13241327 * Cross-function jump.
13251328 */
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 ) {
13281331
13291332 /*
13301333 * For GCC 8+, create parent/child links for any cold
@@ -1342,16 +1345,22 @@ static int add_jump_destinations(struct objtool_file *file)
13421345 * subfunction is through a jump table.
13431346 */
13441347 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 ;
13481351
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 ;
13531360 }
13541361 }
1362+
1363+ insn -> jump_dest = jump_dest ;
13551364 }
13561365
13571366 return 0 ;
0 commit comments