| @@ -273,7 +273,7 @@ static void init_insn_state(struct insn_state *state, struct section *sec) · 272 unmodified lines |
| 273 | * not correctly determine insn->call_dest->sec (external symbols do | 273 | * not correctly determine insn->call_dest->sec (external symbols do |
| 274 | * not have a section). | 274 | * not have a section). |
| 275 | */ | 275 | */ |
| 276 | if (vmlinux && noinstr && sec) | 276 | if (opts.vmlinux && opts.noinstr && sec) |
| 277 | state->noinstr = sec->noinstr; | 277 | state->noinstr = sec->noinstr; |
| 278 | } | 278 | } |
| 279 | | 279 | |
| @@ -339,7 +339,7 @@ static void *cfi_hash_alloc(unsigned long size) · 59 unmodified lines |
| 339 | if (cfi_hash == (void *)-1L) { | 339 | if (cfi_hash == (void *)-1L) { |
| 340 | WARN("mmap fail cfi_hash"); | 340 | WARN("mmap fail cfi_hash"); |
| 341 | cfi_hash = NULL; | 341 | cfi_hash = NULL; |
| 342 | } else if (stats) { | 342 | } else if (opts.stats) { |
| 343 | printf("cfi_bits: %d\n", cfi_bits); | 343 | printf("cfi_bits: %d\n", cfi_bits); |
| 344 | } | 344 | } |
| 345 | | 345 | |
| @@ -434,7 +434,7 @@ static int decode_instructions(struct objtool_file *file) · 88 unmodified lines |
| 434 | } | 434 | } |
| 435 | } | 435 | } |
| 436 | | 436 | |
| 437 | if (stats) | 437 | if (opts.stats) |
| 438 | printf("nr_insns: %lu\n", nr_insns); | 438 | printf("nr_insns: %lu\n", nr_insns); |
| 439 | | 439 | |
| 440 | return 0; | 440 | return 0; |
| @@ -497,7 +497,7 @@ static int init_pv_ops(struct objtool_file *file) · 56 unmodified lines |
| 497 | struct symbol *sym; | 497 | struct symbol *sym; |
| 498 | int idx, nr; | 498 | int idx, nr; |
| 499 | | 499 | |
| 500 | if (!noinstr) | 500 | if (!opts.noinstr) |
| 501 | return 0; | 501 | return 0; |
| 502 | | 502 | |
| 503 | file->pv_ops = NULL; | 503 | file->pv_ops = NULL; |
| @@ -668,7 +668,7 @@ static int create_static_call_sections(struct objtool_file *file) · 164 unmodified lines |
| 668 | | 668 | |
| 669 | key_sym = find_symbol_by_name(file->elf, tmp); | 669 | key_sym = find_symbol_by_name(file->elf, tmp); |
| 670 | if (!key_sym) { | 670 | if (!key_sym) { |
| 671 | if (!module) { | 671 | if (!opts.module) { |
| 672 | WARN("static_call: can't find static_call_key symbol: %s", tmp); | 672 | WARN("static_call: can't find static_call_key symbol: %s", tmp); |
| 673 | return -1; | 673 | return -1; |
| 674 | } | 674 | } |
| @@ -761,7 +761,7 @@ static int create_ibt_endbr_seal_sections(struct objtool_file *file) · 86 unmodified lines |
| 761 | list_for_each_entry(insn, &file->endbr_list, call_node) | 761 | list_for_each_entry(insn, &file->endbr_list, call_node) |
| 762 | idx++; | 762 | idx++; |
| 763 | | 763 | |
| 764 | if (stats) { | 764 | if (opts.stats) { |
| 765 | printf("ibt: ENDBR at function start: %d\n", file->nr_endbr); | 765 | printf("ibt: ENDBR at function start: %d\n", file->nr_endbr); |
| 766 | printf("ibt: ENDBR inside functions: %d\n", file->nr_endbr_int); | 766 | printf("ibt: ENDBR inside functions: %d\n", file->nr_endbr_int); |
| 767 | printf("ibt: superfluous ENDBR: %d\n", idx); | 767 | printf("ibt: superfluous ENDBR: %d\n", idx); |
| @@ -1028,7 +1028,7 @@ static void add_uaccess_safe(struct objtool_file *file) · 260 unmodified lines |
| 1028 | struct symbol *func; | 1028 | struct symbol *func; |
| 1029 | const char **name; | 1029 | const char **name; |
| 1030 | | 1030 | |
| 1031 | if (!uaccess) | 1031 | if (!opts.uaccess) |
| 1032 | return; | 1032 | return; |
| 1033 | | 1033 | |
| 1034 | for (name = uaccess_safe_builtin; *name; name++) { | 1034 | for (name = uaccess_safe_builtin; *name; name++) { |
| @@ -1170,7 +1170,7 @@ static void annotate_call_site(struct objtool_file *file, · 135 unmodified lines |
| 1170 | return; | 1170 | return; |
| 1171 | } | 1171 | } |
| 1172 | | 1172 | |
| 1173 | if (mcount && sym->fentry) { | 1173 | if (opts.mcount && sym->fentry) { |
| 1174 | if (sibling) | 1174 | if (sibling) |
| 1175 | WARN_FUNC("Tail call to __fentry__ !?!?", insn->sec, insn->offset); | 1175 | WARN_FUNC("Tail call to __fentry__ !?!?", insn->sec, insn->offset); |
| 1176 | | 1176 | |
| @@ -1256,7 +1256,7 @@ static bool is_first_func_insn(struct objtool_file *file, struct instruction *in · 79 unmodified lines |
| 1256 | if (insn->offset == insn->func->offset) | 1256 | if (insn->offset == insn->func->offset) |
| 1257 | return true; | 1257 | return true; |
| 1258 | | 1258 | |
| 1259 | if (ibt) { | 1259 | if (opts.ibt) { |
| 1260 | struct instruction *prev = prev_insn_same_sym(file, insn); | 1260 | struct instruction *prev = prev_insn_same_sym(file, insn); |
| 1261 | | 1261 | |
| 1262 | if (prev && prev->type == INSN_ENDBR && | 1262 | if (prev && prev->type == INSN_ENDBR && |
| @@ -1699,7 +1699,7 @@ static int add_special_section_alts(struct objtool_file *file) · 436 unmodified lines |
| 1699 | free(special_alt); | 1699 | free(special_alt); |
| 1700 | } | 1700 | } |
| 1701 | | 1701 | |
| 1702 | if (stats) { | 1702 | if (opts.stats) { |
| 1703 | printf("jl\\\tNOP\tJMP\n"); | 1703 | printf("jl\\\tNOP\tJMP\n"); |
| 1704 | printf("short:\t%ld\t%ld\n", file->jl_nop_short, file->jl_short); | 1704 | printf("short:\t%ld\t%ld\n", file->jl_nop_short, file->jl_short); |
| 1705 | printf("long:\t%ld\t%ld\n", file->jl_nop_long, file->jl_long); | 1705 | printf("long:\t%ld\t%ld\n", file->jl_nop_long, file->jl_long); |
| @@ -1945,7 +1945,7 @@ static int read_unwind_hints(struct objtool_file *file) · 239 unmodified lines |
| 1945 | | 1945 | |
| 1946 | insn->hint = true; | 1946 | insn->hint = true; |
| 1947 | | 1947 | |
| 1948 | if (ibt && hint->type == UNWIND_HINT_TYPE_REGS_PARTIAL) { | 1948 | if (opts.ibt && hint->type == UNWIND_HINT_TYPE_REGS_PARTIAL) { |
| 1949 | struct symbol *sym = find_symbol_by_offset(insn->sec, insn->offset); | 1949 | struct symbol *sym = find_symbol_by_offset(insn->sec, insn->offset); |
| 1950 | | 1950 | |
| 1951 | if (sym && sym->bind == STB_GLOBAL && | 1951 | if (sym && sym->bind == STB_GLOBAL && |
| @@ -2806,7 +2806,7 @@ static int update_cfi_state(struct instruction *insn, · 854 unmodified lines |
| 2806 | } | 2806 | } |
| 2807 | | 2807 | |
| 2808 | /* detect when asm code uses rbp as a scratch register */ | 2808 | /* detect when asm code uses rbp as a scratch register */ |
| 2809 | if (!no_fp && insn->func && op->src.reg == CFI_BP && | 2809 | if (!opts.no_fp && insn->func && op->src.reg == CFI_BP && |
| 2810 | cfa->base != CFI_BP) | 2810 | cfa->base != CFI_BP) |
| 2811 | cfi->bp_scratch = true; | 2811 | cfi->bp_scratch = true; |
| 2812 | break; | 2812 | break; |
| @@ -3363,7 +3363,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 550 unmodified lines |
| 3363 | | 3363 | |
| 3364 | ret = validate_branch(file, func, alt->insn, state); | 3364 | ret = validate_branch(file, func, alt->insn, state); |
| 3365 | if (ret) { | 3365 | if (ret) { |
| 3366 | if (backtrace) | 3366 | if (opts.backtrace) |
| 3367 | BT_FUNC("(alt)", insn); | 3367 | BT_FUNC("(alt)", insn); |
| 3368 | return ret; | 3368 | return ret; |
| 3369 | } | 3369 | } |
| @@ -3379,7 +3379,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 9 unmodified lines |
| 3379 | switch (insn->type) { | 3379 | switch (insn->type) { |
| 3380 | | 3380 | |
| 3381 | case INSN_RETURN: | 3381 | case INSN_RETURN: |
| 3382 | if (sls && !insn->retpoline_safe && | 3382 | if (opts.sls && !insn->retpoline_safe && |
| 3383 | next_insn && next_insn->type != INSN_TRAP) { | 3383 | next_insn && next_insn->type != INSN_TRAP) { |
| 3384 | WARN_FUNC("missing int3 after ret", | 3384 | WARN_FUNC("missing int3 after ret", |
| 3385 | insn->sec, insn->offset); | 3385 | insn->sec, insn->offset); |
| @@ -3392,7 +3392,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 6 unmodified lines |
| 3392 | if (ret) | 3392 | if (ret) |
| 3393 | return ret; | 3393 | return ret; |
| 3394 | | 3394 | |
| 3395 | if (!no_fp && func && !is_fentry_call(insn) && | 3395 | if (!opts.no_fp && func && !is_fentry_call(insn) && |
| 3396 | !has_valid_stack_frame(&state)) { | 3396 | !has_valid_stack_frame(&state)) { |
| 3397 | WARN_FUNC("call without frame pointer save/setup", | 3397 | WARN_FUNC("call without frame pointer save/setup", |
| 3398 | sec, insn->offset); | 3398 | sec, insn->offset); |
| @@ -3415,7 +3415,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 16 unmodified lines |
| 3415 | ret = validate_branch(file, func, | 3415 | ret = validate_branch(file, func, |
| 3416 | insn->jump_dest, state); | 3416 | insn->jump_dest, state); |
| 3417 | if (ret) { | 3417 | if (ret) { |
| 3418 | if (backtrace) | 3418 | if (opts.backtrace) |
| 3419 | BT_FUNC("(branch)", insn); | 3419 | BT_FUNC("(branch)", insn); |
| 3420 | return ret; | 3420 | return ret; |
| 3421 | } | 3421 | } |
| @@ -3427,7 +3427,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 5 unmodified lines |
| 3427 | break; | 3427 | break; |
| 3428 | | 3428 | |
| 3429 | case INSN_JUMP_DYNAMIC: | 3429 | case INSN_JUMP_DYNAMIC: |
| 3430 | if (sls && !insn->retpoline_safe && | 3430 | if (opts.sls && !insn->retpoline_safe && |
| 3431 | next_insn && next_insn->type != INSN_TRAP) { | 3431 | next_insn && next_insn->type != INSN_TRAP) { |
| 3432 | WARN_FUNC("missing int3 after indirect jump", | 3432 | WARN_FUNC("missing int3 after indirect jump", |
| 3433 | insn->sec, insn->offset); | 3433 | insn->sec, insn->offset); |
| @@ -3499,7 +3499,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, · 65 unmodified lines |
| 3499 | break; | 3499 | break; |
| 3500 | } | 3500 | } |
| 3501 | | 3501 | |
| 3502 | if (ibt) | 3502 | if (opts.ibt) |
| 3503 | validate_ibt_insn(file, insn); | 3503 | validate_ibt_insn(file, insn); |
| 3504 | | 3504 | |
| 3505 | if (insn->dead_end) | 3505 | if (insn->dead_end) |
| @@ -3541,7 +3541,7 @@ static int validate_unwind_hints(struct objtool_file *file, struct section *sec) · 35 unmodified lines |
| 3541 | while (&insn->list != &file->insn_list && (!sec || insn->sec == sec)) { | 3541 | while (&insn->list != &file->insn_list && (!sec || insn->sec == sec)) { |
| 3542 | if (insn->hint && !insn->visited && !insn->ignore) { | 3542 | if (insn->hint && !insn->visited && !insn->ignore) { |
| 3543 | ret = validate_branch(file, insn->func, insn, state); | 3543 | ret = validate_branch(file, insn->func, insn, state); |
| 3544 | if (ret && backtrace) | 3544 | if (ret && opts.backtrace) |
| 3545 | BT_FUNC("<=== (hint)", insn); | 3545 | BT_FUNC("<=== (hint)", insn); |
| 3546 | warnings += ret; | 3546 | warnings += ret; |
| 3547 | } | 3547 | } |
| @@ -3571,7 +3571,7 @@ static int validate_retpoline(struct objtool_file *file) · 23 unmodified lines |
| 3571 | * loaded late, they very much do need retpoline in their | 3571 | * loaded late, they very much do need retpoline in their |
| 3572 | * .init.text | 3572 | * .init.text |
| 3573 | */ | 3573 | */ |
| 3574 | if (!strcmp(insn->sec->name, ".init.text") && !module) | 3574 | if (!strcmp(insn->sec->name, ".init.text") && !opts.module) |
| 3575 | continue; | 3575 | continue; |
| 3576 | | 3576 | |
| 3577 | WARN_FUNC("indirect %s found in RETPOLINE build", | 3577 | WARN_FUNC("indirect %s found in RETPOLINE build", |
| @@ -3621,7 +3621,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio · 43 unmodified lines |
| 3621 | * In this case we'll find a piece of code (whole function) that is not | 3621 | * In this case we'll find a piece of code (whole function) that is not |
| 3622 | * covered by a !section symbol. Ignore them. | 3622 | * covered by a !section symbol. Ignore them. |
| 3623 | */ | 3623 | */ |
| 3624 | if (!insn->func && lto) { | 3624 | if (!insn->func && opts.lto) { |
| 3625 | int size = find_symbol_hole_containing(insn->sec, insn->offset); | 3625 | int size = find_symbol_hole_containing(insn->sec, insn->offset); |
| 3626 | unsigned long end = insn->offset + size; | 3626 | unsigned long end = insn->offset + size; |
| 3627 | | 3627 | |
| @@ -3728,7 +3728,7 @@ static int validate_symbol(struct objtool_file *file, struct section *sec, · 100 unmodified lines |
| 3728 | state->uaccess = sym->uaccess_safe; | 3728 | state->uaccess = sym->uaccess_safe; |
| 3729 | | 3729 | |
| 3730 | ret = validate_branch(file, insn->func, insn, *state); | 3730 | ret = validate_branch(file, insn->func, insn, *state); |
| 3731 | if (ret && backtrace) | 3731 | if (ret && opts.backtrace) |
| 3732 | BT_FUNC("<=== (sym)", insn); | 3732 | BT_FUNC("<=== (sym)", insn); |
| 3733 | return ret; | 3733 | return ret; |
| 3734 | } | 3734 | } |
| @@ -3853,12 +3853,12 @@ int check(struct objtool_file *file) · 118 unmodified lines |
| 3853 | { | 3853 | { |
| 3854 | int ret, warnings = 0; | 3854 | int ret, warnings = 0; |
| 3855 | | 3855 | |
| 3856 | if (lto && !(vmlinux || module)) { | 3856 | if (opts.lto && !(opts.vmlinux || opts.module)) { |
| 3857 | fprintf(stderr, "--lto requires: --vmlinux or --module\n"); | 3857 | fprintf(stderr, "--lto requires: --vmlinux or --module\n"); |
| 3858 | return 1; | 3858 | return 1; |
| 3859 | } | 3859 | } |
| 3860 | | 3860 | |
| 3861 | if (ibt && !lto) { | 3861 | if (opts.ibt && !opts.lto) { |
| 3862 | fprintf(stderr, "--ibt requires: --lto\n"); | 3862 | fprintf(stderr, "--ibt requires: --lto\n"); |
| 3863 | return 1; | 3863 | return 1; |
| 3864 | } | 3864 | } |
| @@ -3883,7 +3883,7 @@ int check(struct objtool_file *file) · 18 unmodified lines |
| 3883 | if (list_empty(&file->insn_list)) | 3883 | if (list_empty(&file->insn_list)) |
| 3884 | goto out; | 3884 | goto out; |
| 3885 | | 3885 | |
| 3886 | if (vmlinux && !lto) { | 3886 | if (opts.vmlinux && !opts.lto) { |
| 3887 | ret = validate_vmlinux_functions(file); | 3887 | ret = validate_vmlinux_functions(file); |
| 3888 | if (ret < 0) | 3888 | if (ret < 0) |
| 3889 | goto out; | 3889 | goto out; |
| @@ -3892,7 +3892,7 @@ int check(struct objtool_file *file) · 2 unmodified lines |
| 3892 | goto out; | 3892 | goto out; |
| 3893 | } | 3893 | } |
| 3894 | | 3894 | |
| 3895 | if (retpoline) { | 3895 | if (opts.retpoline) { |
| 3896 | ret = validate_retpoline(file); | 3896 | ret = validate_retpoline(file); |
| 3897 | if (ret < 0) | 3897 | if (ret < 0) |
| 3898 | return ret; | 3898 | return ret; |
| @@ -3909,7 +3909,7 @@ int check(struct objtool_file *file) · 10 unmodified lines |
| 3909 | goto out; | 3909 | goto out; |
| 3910 | warnings += ret; | 3910 | warnings += ret; |
| 3911 | | 3911 | |
| 3912 | if (ibt) { | 3912 | if (opts.ibt) { |
| 3913 | ret = validate_ibt(file); | 3913 | ret = validate_ibt(file); |
| 3914 | if (ret < 0) | 3914 | if (ret < 0) |
| 3915 | goto out; | 3915 | goto out; |
| @@ -3928,28 +3928,28 @@ int check(struct objtool_file *file) · 12 unmodified lines |
| 3928 | goto out; | 3928 | goto out; |
| 3929 | warnings += ret; | 3929 | warnings += ret; |
| 3930 | | 3930 | |
| 3931 | if (retpoline) { | 3931 | if (opts.retpoline) { |
| 3932 | ret = create_retpoline_sites_sections(file); | 3932 | ret = create_retpoline_sites_sections(file); |
| 3933 | if (ret < 0) | 3933 | if (ret < 0) |
| 3934 | goto out; | 3934 | goto out; |
| 3935 | warnings += ret; | 3935 | warnings += ret; |
| 3936 | } | 3936 | } |
| 3937 | | 3937 | |
| 3938 | if (mcount) { | 3938 | if (opts.mcount) { |
| 3939 | ret = create_mcount_loc_sections(file); | 3939 | ret = create_mcount_loc_sections(file); |
| 3940 | if (ret < 0) | 3940 | if (ret < 0) |
| 3941 | goto out; | 3941 | goto out; |
| 3942 | warnings += ret; | 3942 | warnings += ret; |
| 3943 | } | 3943 | } |
| 3944 | | 3944 | |
| 3945 | if (ibt) { | 3945 | if (opts.ibt) { |
| 3946 | ret = create_ibt_endbr_seal_sections(file); | 3946 | ret = create_ibt_endbr_seal_sections(file); |
| 3947 | if (ret < 0) | 3947 | if (ret < 0) |
| 3948 | goto out; | 3948 | goto out; |
| 3949 | warnings += ret; | 3949 | warnings += ret; |
| 3950 | } | 3950 | } |
| 3951 | | 3951 | |
| 3952 | if (stats) { | 3952 | if (opts.stats) { |
| 3953 | printf("nr_insns_visited: %ld\n", nr_insns_visited); | 3953 | printf("nr_insns_visited: %ld\n", nr_insns_visited); |
| 3954 | printf("nr_cfi: %ld\n", nr_cfi); | 3954 | printf("nr_cfi: %ld\n", nr_cfi); |
| 3955 | printf("nr_cfi_reused: %ld\n", nr_cfi_reused); | 3955 | printf("nr_cfi_reused: %ld\n", nr_cfi_reused); |