All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Makefile: Use gcc to determine ARCH
@ 2011-05-07  4:41 Lin Ming
  2011-05-07  9:40 ` Ingo Molnar
  2011-05-07  9:46 ` [tip:perf/urgent] " tip-bot for Lin Ming
  0 siblings, 2 replies; 3+ messages in thread
From: Lin Ming @ 2011-05-07  4:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Riccardo Magliocchetti, Peter Zijlstra, Ingo Molnar,
	Linux Kernel Mailing List

The original Makefile uses "uname -m" to determine ARCH.
This causes problem on x86 when compile perf tool on 32 bit userspace
with a 64 bit kernel.

bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
bench/../../../arch/x86/lib/memcpy_64.S:28: Error: bad register name `%rdi'

This is because "uname -m" returns x86_64 and memcpy_64.S is included in 32 bit build.

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 tools/perf/Makefile |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 91ad5cc..1455413 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -43,15 +43,21 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
 				  -e s/sh[234].*/sh/ )
 
+CC = $(CROSS_COMPILE)gcc
+AR = $(CROSS_COMPILE)ar
+
 # Additional ARCH settings for x86
 ifeq ($(ARCH),i386)
         ARCH := x86
 endif
 ifeq ($(ARCH),x86_64)
-	RAW_ARCH := x86_64
-        ARCH := x86
-	ARCH_CFLAGS := -DARCH_X86_64
-	ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
+	ARCH := x86
+	IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
+	ifeq (${IS_X86_64}, 1)
+		RAW_ARCH := x86_64
+		ARCH_CFLAGS := -DARCH_X86_64
+		ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
+	endif
 endif
 
 #
@@ -127,8 +133,6 @@ lib = lib
 
 export prefix bindir sharedir sysconfdir
 
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
 RM = rm -f
 MKDIR = mkdir
 FIND = find
-- 
1.7.4.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf tools: Makefile: Use gcc to determine ARCH
  2011-05-07  4:41 [PATCH] perf tools: Makefile: Use gcc to determine ARCH Lin Ming
@ 2011-05-07  9:40 ` Ingo Molnar
  2011-05-07  9:46 ` [tip:perf/urgent] " tip-bot for Lin Ming
  1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2011-05-07  9:40 UTC (permalink / raw)
  To: Lin Ming
  Cc: Arnaldo Carvalho de Melo, Riccardo Magliocchetti, Peter Zijlstra,
	Linux Kernel Mailing List


* Lin Ming <ming.m.lin@intel.com> wrote:

> The original Makefile uses "uname -m" to determine ARCH.
> This causes problem on x86 when compile perf tool on 32 bit userspace
> with a 64 bit kernel.
> 
> bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
> bench/../../../arch/x86/lib/memcpy_64.S:28: Error: bad register name `%rdi'
> 
> This is because "uname -m" returns x86_64 and memcpy_64.S is included in 32 bit build.
> 
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>

this changelog is missing an important line:

 Reported-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>

I've added it.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/urgent] perf tools: Makefile: Use gcc to determine ARCH
  2011-05-07  4:41 [PATCH] perf tools: Makefile: Use gcc to determine ARCH Lin Ming
  2011-05-07  9:40 ` Ingo Molnar
@ 2011-05-07  9:46 ` tip-bot for Lin Ming
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Lin Ming @ 2011-05-07  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, riccardo.magliocchetti,
	acme, ming.m.lin, tglx, mingo

Commit-ID:  174a7b1f9692acad7f0ca2b02f696894201a6d94
Gitweb:     http://git.kernel.org/tip/174a7b1f9692acad7f0ca2b02f696894201a6d94
Author:     Lin Ming <ming.m.lin@intel.com>
AuthorDate: Sat, 7 May 2011 12:41:14 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 7 May 2011 11:40:59 +0200

perf tools: Makefile: Use gcc to determine ARCH

The original Makefile uses "uname -m" to determine ARCH.
This causes problem on x86 when compile perf tool on 32 bit
userspace with a 64 bit kernel.

 bench/../../../arch/x86/lib/memcpy_64.S: Assembler messages:
 bench/../../../arch/x86/lib/memcpy_64.S:28: Error: bad register name `%rdi'

This is because "uname -m" returns x86_64 and memcpy_64.S is
included in 32 bit build.

Reported-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Link: http://lkml.kernel.org/r/1304743274.3132.17.camel@localhost
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/Makefile |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 207dee5..0c54256 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -35,15 +35,21 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
 				  -e s/sh[234].*/sh/ )
 
+CC = $(CROSS_COMPILE)gcc
+AR = $(CROSS_COMPILE)ar
+
 # Additional ARCH settings for x86
 ifeq ($(ARCH),i386)
         ARCH := x86
 endif
 ifeq ($(ARCH),x86_64)
-	RAW_ARCH := x86_64
-        ARCH := x86
-	ARCH_CFLAGS := -DARCH_X86_64
-	ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
+	ARCH := x86
+	IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1)
+	ifeq (${IS_X86_64}, 1)
+		RAW_ARCH := x86_64
+		ARCH_CFLAGS := -DARCH_X86_64
+		ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S
+	endif
 endif
 
 #
@@ -119,8 +125,6 @@ lib = lib
 
 export prefix bindir sharedir sysconfdir
 
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
 RM = rm -f
 MKDIR = mkdir
 FIND = find

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-07  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07  4:41 [PATCH] perf tools: Makefile: Use gcc to determine ARCH Lin Ming
2011-05-07  9:40 ` Ingo Molnar
2011-05-07  9:46 ` [tip:perf/urgent] " tip-bot for Lin Ming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.