]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/objtool/check.c
objtool: Support conditional retpolines
[linux.git] / tools / objtool / check.c
index 04572a049cfc3db52ff367e5ca152953ff569b7d..5f26620f13f56fdb2aec4668e0495a569f0bd049 100644 (file)
@@ -575,7 +575,11 @@ static int add_jump_destinations(struct objtool_file *file)
                         * Retpoline jumps are really dynamic jumps in
                         * disguise, so convert them accordingly.
                         */
-                       insn->type = INSN_JUMP_DYNAMIC;
+                       if (insn->type == INSN_JUMP_UNCONDITIONAL)
+                               insn->type = INSN_JUMP_DYNAMIC;
+                       else
+                               insn->type = INSN_JUMP_DYNAMIC_CONDITIONAL;
+
                        insn->retpoline_safe = true;
                        continue;
                } else {
@@ -2114,13 +2118,17 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
                        break;
 
                case INSN_JUMP_DYNAMIC:
+               case INSN_JUMP_DYNAMIC_CONDITIONAL:
                        if (func && is_sibling_call(insn)) {
                                ret = validate_sibling_call(insn, &state);
                                if (ret)
                                        return ret;
                        }
 
-                       return 0;
+                       if (insn->type == INSN_JUMP_DYNAMIC)
+                               return 0;
+
+                       break;
 
                case INSN_CONTEXT_SWITCH:
                        if (func && (!next_insn || !next_insn->hint)) {