Skip to content

Commit

Permalink
objtool: Use existing global variables for options
Browse files Browse the repository at this point in the history
Use the existing global variables instead of passing them around and
creating duplicate global variables.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Acked-by: Thomas Gleixner <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Feb 21, 2018
1 parent 531bb52 commit 43a4525
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tools/objtool/builtin-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ int cmd_check(int argc, const char **argv)

objname = argv[0];

return check(objname, no_fp, no_unreachable, false);
return check(objname, false);
}
6 changes: 1 addition & 5 deletions tools/objtool/builtin-orc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/

#include <string.h>
#include <subcmd/parse-options.h>
#include "builtin.h"
#include "check.h"

Expand All @@ -36,9 +35,6 @@ static const char *orc_usage[] = {
NULL,
};

extern const struct option check_options[];
extern bool no_fp, no_unreachable;

int cmd_orc(int argc, const char **argv)
{
const char *objname;
Expand All @@ -54,7 +50,7 @@ int cmd_orc(int argc, const char **argv)

objname = argv[0];

return check(objname, no_fp, no_unreachable, true);
return check(objname, true);
}

if (!strcmp(argv[0], "dump")) {
Expand Down
5 changes: 5 additions & 0 deletions tools/objtool/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#ifndef _BUILTIN_H
#define _BUILTIN_H

#include <subcmd/parse-options.h>

extern const struct option check_options[];
extern bool no_fp, no_unreachable;

extern int cmd_check(int argc, const char **argv);
extern int cmd_orc(int argc, const char **argv);

Expand Down
5 changes: 2 additions & 3 deletions tools/objtool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <string.h>
#include <stdlib.h>

#include "builtin.h"
#include "check.h"
#include "elf.h"
#include "special.h"
Expand All @@ -33,7 +34,6 @@ struct alternative {
};

const char *objname;
static bool no_fp;
struct cfi_state initial_func_cfi;

struct instruction *find_insn(struct objtool_file *file,
Expand Down Expand Up @@ -2022,13 +2022,12 @@ static void cleanup(struct objtool_file *file)
elf_close(file->elf);
}

int check(const char *_objname, bool _no_fp, bool no_unreachable, bool orc)
int check(const char *_objname, bool orc)
{
struct objtool_file file;
int ret, warnings = 0;

objname = _objname;
no_fp = _no_fp;

file.elf = elf_open(objname, orc ? O_RDWR : O_RDONLY);
if (!file.elf)
Expand Down
2 changes: 1 addition & 1 deletion tools/objtool/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct objtool_file {
bool ignore_unreachables, c_file, hints;
};

int check(const char *objname, bool no_fp, bool no_unreachable, bool orc);
int check(const char *objname, bool orc);

struct instruction *find_insn(struct objtool_file *file,
struct section *sec, unsigned long offset);
Expand Down

0 comments on commit 43a4525

Please sign in to comment.