From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Josh Poimboeuf <jpoimboe@redhat.com>,
Andy Lutomirski <luto@amacapital.net>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/11] tools build: Fix objtool build with ARCH=x86_64
Date: Mon, 25 Jul 2016 12:57:56 -0300 [thread overview]
Message-ID: <1469462278-31556-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1469462278-31556-1-git-send-email-acme@kernel.org>
From: Josh Poimboeuf <jpoimboe@redhat.com>
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>
---
tools/objtool/Build | 2 +-
tools/objtool/Makefile | 2 +-
tools/scripts/Makefile.arch | 32 ++++++++++++++++++++++++++++++++
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 @@
-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 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
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
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/ \
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
-e s/tile.*/tile/ )
+
ifndef ARCH
ARCH := $(HOSTARCH)
endif
+SRCARCH := $(ARCH)
+
+# Additional ARCH settings for x86
+ifeq ($(ARCH),i386)
+ SRCARCH := x86
+endif
+ifeq ($(ARCH),x86_64)
+ SRCARCH := x86
+endif
+
+# Additional ARCH settings for sparc
+ifeq ($(ARCH),sparc32)
+ SRCARCH := sparc
+endif
+ifeq ($(ARCH),sparc64)
+ SRCARCH := sparc
+endif
+
+# Additional ARCH settings for sh
+ifeq ($(ARCH),sh64)
+ SRCARCH := sh
+endif
+
+# Additional ARCH settings for tile
+ifeq ($(ARCH),tilepro)
+ SRCARCH := tile
+endif
+ifeq ($(ARCH),tilegx)
+ SRCARCH := tile
+endif
+
LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
ifeq ($(LP64), 1)
IS_64_BIT := 1
--
2.7.4
next prev parent reply other threads:[~2016-07-25 15:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 15:57 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 01/11] x86/insn: perf tools: Fix vcvtph2ps instruction decoding Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 02/11] x86/insn: Add AVX-512 support to the instruction decoder Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 03/11] perf tools: Add AVX-512 support to the instruction decoder used by Intel PT Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 04/11] perf tools: Add AVX-512 instructions to the new instructions test Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 05/11] perf tests kmod-path: Fix build on ubuntu:16.04-x-armhf Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 06/11] tools build: Add HOSTARCH Makefile variable Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 07/11] objtool: Use tools/scripts/Makefile.arch to get ARCH and HOSTARCH Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 08/11] objtool: Always use host headers Arnaldo Carvalho de Melo
2016-07-25 15:57 ` Arnaldo Carvalho de Melo [this message]
2016-07-25 15:57 ` [PATCH 10/11] x86: Make the vdso2c compiler use the host architecture headers Arnaldo Carvalho de Melo
2016-07-25 15:57 ` [PATCH 11/11] Revert "perf tools: event.h needs asm/perf_regs.h" Arnaldo Carvalho de Melo
2016-07-25 17:49 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469462278-31556-10-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome