Skip to content

Commit 66734e3

Browse files
Julien Thierryjpoimboe
authored andcommitted
objtool: Define 'struct orc_entry' only when needed
Implementation of ORC requires some definitions that are currently provided by the target architecture headers. Do not depend on these definitions when the orc subcommand is not implemented. This avoid requiring arches with no orc implementation to provide dummy orc definitions. Signed-off-by: Julien Thierry <jthierry@redhat.com> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
1 parent 3eaecac commit 66734e3

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

tools/objtool/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ ifeq ($(SRCARCH),x86)
5555
SUBCMD_ORC := y
5656
endif
5757

58+
ifeq ($(SUBCMD_ORC),y)
59+
CFLAGS += -DINSN_USE_ORC
60+
endif
61+
5862
export SUBCMD_CHECK SUBCMD_ORC
5963
export srctree OUTPUT CFLAGS SRCARCH AWK
6064
include $(srctree)/tools/build/Makefile.include

tools/objtool/arch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include "objtool.h"
1212
#include "cfi.h"
1313

14+
#ifdef INSN_USE_ORC
1415
#include <asm/orc_types.h>
16+
#endif
1517

1618
enum insn_type {
1719
INSN_JUMP_CONDITIONAL,

tools/objtool/check.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ struct instruction {
4343
struct symbol *func;
4444
struct list_head stack_ops;
4545
struct cfi_state cfi;
46+
#ifdef INSN_USE_ORC
4647
struct orc_entry orc;
48+
#endif
4749
};
4850

4951
struct instruction *find_insn(struct objtool_file *file,

0 commit comments

Comments
 (0)