[RFC][PATCH 02/36] objtool: Move struct objtool_file into arch-independent header

From: Matt Helsley
Date: Fri Apr 10 2020 - 15:36:24 EST


The objtool_file structure describing the files objtool works on is
not architecture dependent -- it's not x86 only. So we can split it
out from the check.h header that will move into arch/x86 and reuse
it for future objtool subcommands.

Signed-off-by: Matt Helsley <mhelsley@xxxxxxxxxx>
---
tools/objtool/check.h | 10 +---------
tools/objtool/objtool.h | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 9 deletions(-)
create mode 100644 tools/objtool/objtool.h

diff --git a/tools/objtool/check.h b/tools/objtool/check.h
index f0ce8ffe7135..ec6ff7f0970c 100644
--- a/tools/objtool/check.h
+++ b/tools/objtool/check.h
@@ -7,11 +7,10 @@
#define _CHECK_H

#include <stdbool.h>
-#include "elf.h"
+#include "objtool.h"
#include "cfi.h"
#include "arch.h"
#include "orc.h"
-#include <linux/hashtable.h>

struct insn_state {
struct cfi_reg cfa;
@@ -47,13 +46,6 @@ struct instruction {
struct orc_entry orc;
};

-struct objtool_file {
- struct elf *elf;
- struct list_head insn_list;
- DECLARE_HASHTABLE(insn_hash, 20);
- bool ignore_unreachables, c_file, hints, rodata;
-};
-
int check(const char *objname, bool orc);

struct instruction *find_insn(struct objtool_file *file,
diff --git a/tools/objtool/objtool.h b/tools/objtool/objtool.h
new file mode 100644
index 000000000000..afa52fe6f644
--- /dev/null
+++ b/tools/objtool/objtool.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2020 Matt Helsley <mhelsley@xxxxxxxxxx>
+ */
+
+#ifndef _OBJTOOL_H
+#define _OBJTOOL_H
+#include <stdbool.h>
+#include <linux/list.h>
+#include <linux/hashtable.h>
+
+#include "elf.h"
+
+struct objtool_file {
+ struct elf *elf;
+ struct list_head insn_list;
+ DECLARE_HASHTABLE(insn_hash, 20);
+ bool ignore_unreachables, c_file, hints, rodata;
+};
+#endif
--
2.20.1