From 630e7a2904a271a519093aff611f50e06d55085c Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 22 Jul 2016 09:59:24 -0300 Subject: objtool: Use tools/scripts/Makefile.arch to get ARCH and HOSTARCH objtool's Makefile was setting up ARCH but fixing up just the x86_64 -> x86, using Makefile.arch will do the necessary fixups for all arches. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Josh Poimboeuf Cc: Namhyung Kim Cc: Stephen Rothwell Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-hbq0bbh03u2b722vozcyql31@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/objtool/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tools/objtool') diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 1f75b0a..988129c 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -1,11 +1,9 @@ include ../scripts/Makefile.include +include ../scripts/Makefile.arch -ifndef ($(ARCH)) -ARCH ?= $(shell uname -m) ifeq ($(ARCH),x86_64) ARCH := x86 endif -endif # always use the host compiler CC = gcc -- cgit v1.1 From 0cf6eb603b83ea386f26363b5b12e64297822bb1 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 22 Jul 2016 16:28:46 -0300 Subject: objtool: Always use host headers From a conversation with Josh: From http://lkml.kernel.org/r/20160722034118.guckaniobf3f7czc@treble : It needs to be compiled with the host (powerpc) compiler, but then it needs to disassemble target (x86) files. ---- So use HOSTARCH instead of ARCH. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Josh Poimboeuf Cc: Namhyung Kim Cc: Stephen Rothwell Cc: Wang Nan Link: http://lkml.kernel.org/r/20160722034118.guckaniobf3f7czc@treble Link: http://lkml.kernel.org/n/tip-le1m1yzxnfpt3msbblu40nm8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/objtool/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/objtool') diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 988129c..91b5f98 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -24,7 +24,7 @@ OBJTOOL_IN := $(OBJTOOL)-in.o all: $(OBJTOOL) -INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi +INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi CFLAGS += -Wall -Werror $(EXTRA_WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) LDFLAGS += -lelf $(LIBSUBCMD) -- cgit v1.1 From 60cbdf5d051d4f4db23d267d511ca241d4be7c0d Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 22 Jul 2016 14:19:20 -0500 Subject: 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 Signed-off-by: Josh Poimboeuf Cc: Andy Lutomirski Cc: H. Peter Anvin Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20160722191920.ej62fnspnqurbaa7@treble Signed-off-by: Arnaldo Carvalho de Melo --- tools/objtool/Build | 2 +- tools/objtool/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/objtool') diff --git a/tools/objtool/Build b/tools/objtool/Build index 2457916..d6cdece 100644 --- a/tools/objtool/Build +++ b/tools/objtool/Build @@ -1,4 +1,4 @@ -objtool-y += arch/$(ARCH)/ +objtool-y += arch/$(SRCARCH)/ objtool-y += builtin-check.o objtool-y += elf.o objtool-y += special.o diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 91b5f98..0b43770 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -33,7 +33,7 @@ elfshdr := $(shell echo '\#include ' | $(CC) $(CFLAGS) -x c -E - | gre CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk -export srctree OUTPUT CFLAGS ARCH AWK +export srctree OUTPUT CFLAGS SRCARCH AWK include $(srctree)/tools/build/Makefile.include $(OBJTOOL_IN): fixdep FORCE -- cgit v1.1