aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2016-07-22 15:19:20 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-22 15:37:44 -0400
commit60cbdf5d051d4f4db23d267d511ca241d4be7c0d (patch)
tree9efe572143b47a35cee1fe8bf0d20188d88c7237
parent0cf6eb603b83ea386f26363b5b12e64297822bb1 (diff)
tools build: Fix objtool build with ARCH=x86_64
The objtool build fails in a cross-compiled environment on a non-x86 host with "ARCH=x86_64": tools/objtool/objtool-in.o: In function `decode_instructions': tools/objtool/builtin-check.c:276: undefined reference to `arch_decode_instruction' We could override the ARCH environment variable and change it back to x86, similar to what the objtool Makefile was doing before; but it's tricky to override environment variables consistently. Instead, take a similar approach used by the Linux top-level Makefile and introduce a SRCARCH Makefile variable which evaluates to "x86" when ARCH is either "x86_64" or "x86". Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160722191920.ej62fnspnqurbaa7@treble Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/objtool/Build2
-rw-r--r--tools/objtool/Makefile2
-rw-r--r--tools/scripts/Makefile.arch32
3 files changed, 34 insertions, 2 deletions
diff --git a/tools/objtool/Build b/tools/objtool/Build
index 2457916a3943..d6cdece5e58b 100644
--- a/tools/objtool/Build
+++ b/tools/objtool/Build
@@ -1,4 +1,4 @@
1objtool-y += arch/$(ARCH)/ 1objtool-y += arch/$(SRCARCH)/
2objtool-y += builtin-check.o 2objtool-y += builtin-check.o
3objtool-y += elf.o 3objtool-y += elf.o
4objtool-y += special.o 4objtool-y += special.o
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 91b5f986d335..0b437700f688 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -33,7 +33,7 @@ elfshdr := $(shell echo '\#include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | gre
33CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) 33CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
34 34
35AWK = awk 35AWK = awk
36export srctree OUTPUT CFLAGS ARCH AWK 36export srctree OUTPUT CFLAGS SRCARCH AWK
37include $(srctree)/tools/build/Makefile.include 37include $(srctree)/tools/build/Makefile.include
38 38
39$(OBJTOOL_IN): fixdep FORCE 39$(OBJTOOL_IN): fixdep FORCE
diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
index 887321ce5827..ad85b921a607 100644
--- a/tools/scripts/Makefile.arch
+++ b/tools/scripts/Makefile.arch
@@ -5,10 +5,42 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
5 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 5 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
6 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ 6 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
7 -e s/tile.*/tile/ ) 7 -e s/tile.*/tile/ )
8
8ifndef ARCH 9ifndef ARCH
9ARCH := $(HOSTARCH) 10ARCH := $(HOSTARCH)
10endif 11endif
11 12
13SRCARCH := $(ARCH)
14
15# Additional ARCH settings for x86
16ifeq ($(ARCH),i386)
17 SRCARCH := x86
18endif
19ifeq ($(ARCH),x86_64)
20 SRCARCH := x86
21endif
22
23# Additional ARCH settings for sparc
24ifeq ($(ARCH),sparc32)
25 SRCARCH := sparc
26endif
27ifeq ($(ARCH),sparc64)
28 SRCARCH := sparc
29endif
30
31# Additional ARCH settings for sh
32ifeq ($(ARCH),sh64)
33 SRCARCH := sh
34endif
35
36# Additional ARCH settings for tile
37ifeq ($(ARCH),tilepro)
38 SRCARCH := tile
39endif
40ifeq ($(ARCH),tilegx)
41 SRCARCH := tile
42endif
43
12LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) 44LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
13ifeq ($(LP64), 1) 45ifeq ($(LP64), 1)
14 IS_64_BIT := 1 46 IS_64_BIT := 1