Skip to contentSkip to conversation

objtool: use $(SRCARCH) to avoid compile error with ARCH=x86_64

PATCH In review Shile Zhang 3 participants 3 messages Dec 27, 2019 – Jan 17, 2020 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: use $(SRCARCH) to avoid compile error with ARCH=x86_64

To build objtool with ARCH=x86_64 will failed as:

$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 the command-line variable 'ARCH' cannot be overridden. It can be replaced by the one 'SRCARCH' defined in 'tools/scripts/Makefile.arch'.

---
 tools/objtool/Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
tools/objtool/Makefile +1 -5
index d2a19b0bc05a..ee08aeff30a1 100644
@@ -2,10 +2,6 @@
 include ../scripts/Makefile.include
 include ../scripts/Makefile.arch
 
-ifeq ($(ARCH),x86_64)
-ARCH := x86
-endif
-
 # always use the host compiler
 HOSTAR	?= ar
 HOSTCC	?= gcc
@@ -33,7 +29,7 @@ all: $(OBJTOOL)
 
 INCLUDES := -I$(srctree)/tools/include \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
-	    -I$(srctree)/tools/arch/$(ARCH)/include
+	    -I$(srctree)/tools/arch/$(SRCARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
 CFLAGS   := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
 LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
Signature · 1 line
2.24.0.rc2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Shile Zhang

To build objtool with ARCH=x86_64 will failed as:

   $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
   ...
Quoted 5 lines

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

Signature · 1 line
Kamalesh
#2 lore raw
In reply to Shile Zhang
Quoted 13 lines · Shile Zhang

To build objtool with ARCH=x86_64 will failed as:

   $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
   ...
Quoted 5 lines

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

Thanks. I'll submit it to the -tip tree.

Signature · 1 line
Josh