Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool: Use existing global variables for options

Use the existing global variables instead of passing them around and
creating duplicate global variables.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Peter Zijlstra and committed by
Ingo Molnar
43a4525f 531bb52a

+10 -10
+1 -1
tools/objtool/builtin-check.c
··· 53 53 54 54 objname = argv[0]; 55 55 56 - return check(objname, no_fp, no_unreachable, false); 56 + return check(objname, false); 57 57 }
+1 -5
tools/objtool/builtin-orc.c
··· 25 25 */ 26 26 27 27 #include <string.h> 28 - #include <subcmd/parse-options.h> 29 28 #include "builtin.h" 30 29 #include "check.h" 31 30 ··· 34 35 "objtool orc dump file.o", 35 36 NULL, 36 37 }; 37 - 38 - extern const struct option check_options[]; 39 - extern bool no_fp, no_unreachable; 40 38 41 39 int cmd_orc(int argc, const char **argv) 42 40 { ··· 50 54 51 55 objname = argv[0]; 52 56 53 - return check(objname, no_fp, no_unreachable, true); 57 + return check(objname, true); 54 58 } 55 59 56 60 if (!strcmp(argv[0], "dump")) {
+5
tools/objtool/builtin.h
··· 17 17 #ifndef _BUILTIN_H 18 18 #define _BUILTIN_H 19 19 20 + #include <subcmd/parse-options.h> 21 + 22 + extern const struct option check_options[]; 23 + extern bool no_fp, no_unreachable; 24 + 20 25 extern int cmd_check(int argc, const char **argv); 21 26 extern int cmd_orc(int argc, const char **argv); 22 27
+2 -3
tools/objtool/check.c
··· 18 18 #include <string.h> 19 19 #include <stdlib.h> 20 20 21 + #include "builtin.h" 21 22 #include "check.h" 22 23 #include "elf.h" 23 24 #include "special.h" ··· 34 33 }; 35 34 36 35 const char *objname; 37 - static bool no_fp; 38 36 struct cfi_state initial_func_cfi; 39 37 40 38 struct instruction *find_insn(struct objtool_file *file, ··· 2022 2022 elf_close(file->elf); 2023 2023 } 2024 2024 2025 - int check(const char *_objname, bool _no_fp, bool no_unreachable, bool orc) 2025 + int check(const char *_objname, bool orc) 2026 2026 { 2027 2027 struct objtool_file file; 2028 2028 int ret, warnings = 0; 2029 2029 2030 2030 objname = _objname; 2031 - no_fp = _no_fp; 2032 2031 2033 2032 file.elf = elf_open(objname, orc ? O_RDWR : O_RDONLY); 2034 2033 if (!file.elf)
+1 -1
tools/objtool/check.h
··· 63 63 bool ignore_unreachables, c_file, hints; 64 64 }; 65 65 66 - int check(const char *objname, bool no_fp, bool no_unreachable, bool orc); 66 + int check(const char *objname, bool orc); 67 67 68 68 struct instruction *find_insn(struct objtool_file *file, 69 69 struct section *sec, unsigned long offset);