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

objtool: Fix ARCH=x86_64 build error

Building objtool with ARCH=x86_64 fails with:

$make ARCH=x86_64 -C tools/objtool
...
CC arch/x86/decode.o
arch/x86/decode.c:10:22: fatal error: asm/insn.h: No such file or directory
#include <asm/insn.h>
^
compilation terminated.
mv: cannot stat ‘arch/x86/.decode.o.tmp’: No such file or directory
make[2]: *** [arch/x86/decode.o] Error 1
...

The root cause is that the command-line variable 'ARCH' cannot be
overridden. It can be replaced by 'SRCARCH', which is defined in
'tools/scripts/Makefile.arch'.

Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/d5d11370ae116df6c653493acd300ec3d7f5e925.1579543924.git.jpoimboe@redhat.com

authored by

Shile Zhang and committed by
Ingo Molnar
8580bed7 6ec14aa7

+1 -5
+1 -5
tools/objtool/Makefile
··· 2 2 include ../scripts/Makefile.include 3 3 include ../scripts/Makefile.arch 4 4 5 - ifeq ($(ARCH),x86_64) 6 - ARCH := x86 7 - endif 8 - 9 5 # always use the host compiler 10 6 HOSTAR ?= ar 11 7 HOSTCC ?= gcc ··· 29 33 30 34 INCLUDES := -I$(srctree)/tools/include \ 31 35 -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ 32 - -I$(srctree)/tools/arch/$(ARCH)/include 36 + -I$(srctree)/tools/arch/$(SRCARCH)/include 33 37 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed 34 38 CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) 35 39 LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)