Skip to content

Commit

Permalink
perf tools: Makefile: Use gcc to determine ARCH
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Lin Ming <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Link: http://lkml.kernel.org/r/1304743274.3132.17.camel@localhost
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Lin Ming authored and Ingo Molnar committed May 7, 2011
1 parent 63b6a67 commit 174a7b1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

#
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 174a7b1

Please sign in to comment.