From: Ingo Molnar Date: Mon, 12 Oct 2009 07:57:25 +0000 (+0200) Subject: perf tools: Fix the NO_64BIT build on pure 64-bit systems X-Git-Tag: 2.1b_release~10437^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55621ccf2b7a8afe39df8c80f55b28424fd07d13;p=platform%2Fkernel%2Fkernel-mfld-blackbay.git perf tools: Fix the NO_64BIT build on pure 64-bit systems Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems. The reason is that we dont pass in the -m32 and GCC defaults to -m64. So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library. Reported-by: Randy Dunlap Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: Mike Galbraith Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo LKML-Reference: Message-Id: <20091005131729.78444bfb.randy.dunlap@oracle.com> Signed-off-by: Ingo Molnar --- diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 5881943..742a32e 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile @@ -157,11 +157,18 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') -# If we're on a 64-bit kernel, use -m64 -ifndef NO_64BIT - ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) - M64 := -m64 - endif +# +# Add -m32 for cross-builds: +# +ifdef NO_64BIT + MBITS := -m32 +else + # + # If we're on a 64-bit kernel, use -m64: + # + ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) + MBITS := -m64 + endif endif # CFLAGS and LDFLAGS are for the users to override from the command line. @@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement -CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) +CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) LDFLAGS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) ALL_LDFLAGS = $(LDFLAGS) @@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin) endif ifneq ($(shell sh -c "(echo '\#include '; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) - msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); + msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); endif ifdef NO_DEMANGLE