@@ -28,7 +28,6 @@ struct alternative {
2828 bool skip_orig ;
2929};
3030
31- const char * objname ;
3231struct cfi_init_state initial_func_cfi ;
3332
3433struct instruction * find_insn (struct objtool_file * file ,
@@ -2909,37 +2908,22 @@ static int validate_reachable_instructions(struct objtool_file *file)
29092908 return 0 ;
29102909}
29112910
2912- static struct objtool_file file ;
2913-
2914- int check (const char * _objname , bool orc )
2911+ int check (struct objtool_file * file , bool orc )
29152912{
29162913 int ret , warnings = 0 ;
29172914
2918- objname = _objname ;
2919-
2920- file .elf = elf_open_read (objname , O_RDWR );
2921- if (!file .elf )
2922- return 1 ;
2923-
2924- INIT_LIST_HEAD (& file .insn_list );
2925- hash_init (file .insn_hash );
2926- INIT_LIST_HEAD (& file .static_call_list );
2927- file .c_file = !vmlinux && find_section_by_name (file .elf , ".comment" );
2928- file .ignore_unreachables = no_unreachable ;
2929- file .hints = false;
2930-
29312915 arch_initial_func_cfi_state (& initial_func_cfi );
29322916
2933- ret = decode_sections (& file );
2917+ ret = decode_sections (file );
29342918 if (ret < 0 )
29352919 goto out ;
29362920 warnings += ret ;
29372921
2938- if (list_empty (& file . insn_list ))
2922+ if (list_empty (& file -> insn_list ))
29392923 goto out ;
29402924
29412925 if (vmlinux && !validate_dup ) {
2942- ret = validate_vmlinux_functions (& file );
2926+ ret = validate_vmlinux_functions (file );
29432927 if (ret < 0 )
29442928 goto out ;
29452929
@@ -2948,46 +2932,46 @@ int check(const char *_objname, bool orc)
29482932 }
29492933
29502934 if (retpoline ) {
2951- ret = validate_retpoline (& file );
2935+ ret = validate_retpoline (file );
29522936 if (ret < 0 )
29532937 return ret ;
29542938 warnings += ret ;
29552939 }
29562940
2957- ret = validate_functions (& file );
2941+ ret = validate_functions (file );
29582942 if (ret < 0 )
29592943 goto out ;
29602944 warnings += ret ;
29612945
2962- ret = validate_unwind_hints (& file , NULL );
2946+ ret = validate_unwind_hints (file , NULL );
29632947 if (ret < 0 )
29642948 goto out ;
29652949 warnings += ret ;
29662950
29672951 if (!warnings ) {
2968- ret = validate_reachable_instructions (& file );
2952+ ret = validate_reachable_instructions (file );
29692953 if (ret < 0 )
29702954 goto out ;
29712955 warnings += ret ;
29722956 }
29732957
2974- ret = create_static_call_sections (& file );
2958+ ret = create_static_call_sections (file );
29752959 if (ret < 0 )
29762960 goto out ;
29772961 warnings += ret ;
29782962
29792963 if (orc ) {
2980- ret = create_orc (& file );
2964+ ret = create_orc (file );
29812965 if (ret < 0 )
29822966 goto out ;
29832967
2984- ret = create_orc_sections (& file );
2968+ ret = create_orc_sections (file );
29852969 if (ret < 0 )
29862970 goto out ;
29872971 }
29882972
2989- if (file . elf -> changed ) {
2990- ret = elf_write (file . elf );
2973+ if (file -> elf -> changed ) {
2974+ ret = elf_write (file -> elf );
29912975 if (ret < 0 )
29922976 goto out ;
29932977 }
0 commit comments