diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/objtool/check.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3a31b238f885..38047c6aa575 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c | |||
@@ -543,6 +543,28 @@ static int add_jump_destinations(struct objtool_file *file) | |||
543 | dest_off); | 543 | dest_off); |
544 | return -1; | 544 | return -1; |
545 | } | 545 | } |
546 | |||
547 | /* | ||
548 | * For GCC 8+, create parent/child links for any cold | ||
549 | * subfunctions. This is _mostly_ redundant with a similar | ||
550 | * initialization in read_symbols(). | ||
551 | * | ||
552 | * If a function has aliases, we want the *first* such function | ||
553 | * in the symbol table to be the subfunction's parent. In that | ||
554 | * case we overwrite the initialization done in read_symbols(). | ||
555 | * | ||
556 | * However this code can't completely replace the | ||
557 | * read_symbols() code because this doesn't detect the case | ||
558 | * where the parent function's only reference to a subfunction | ||
559 | * is through a switch table. | ||
560 | */ | ||
561 | if (insn->func && insn->jump_dest->func && | ||
562 | insn->func != insn->jump_dest->func && | ||
563 | !strstr(insn->func->name, ".cold.") && | ||
564 | strstr(insn->jump_dest->func->name, ".cold.")) { | ||
565 | insn->func->cfunc = insn->jump_dest->func; | ||
566 | insn->jump_dest->func->pfunc = insn->func; | ||
567 | } | ||
546 | } | 568 | } |
547 | 569 | ||
548 | return 0; | 570 | return 0; |