diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-10-12 03:57:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-12 04:00:27 -0400 |
commit | 55621ccf2b7a8afe39df8c80f55b28424fd07d13 (patch) | |
tree | b6a4e673f3772b595320542498fe768a5f371cd4 | |
parent | cbef79a82a64ec13e745ce2b0274154ae1e47243 (diff) |
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 <randy.dunlap@oracle.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: Message-Id: <20091005131729.78444bfb.randy.dunlap@oracle.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/Makefile | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 5881943f0c34..742a32eee8fc 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') | |||
157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | 157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
159 | 159 | ||
160 | # If we're on a 64-bit kernel, use -m64 | 160 | # |
161 | ifndef NO_64BIT | 161 | # Add -m32 for cross-builds: |
162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 162 | # |
163 | M64 := -m64 | 163 | ifdef NO_64BIT |
164 | endif | 164 | MBITS := -m32 |
165 | else | ||
166 | # | ||
167 | # If we're on a 64-bit kernel, use -m64: | ||
168 | # | ||
169 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | ||
170 | MBITS := -m64 | ||
171 | endif | ||
165 | endif | 172 | endif |
166 | 173 | ||
167 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 174 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
@@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition | |||
194 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes | 201 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes |
195 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement | 202 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement |
196 | 203 | ||
197 | CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) | 204 | CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) |
198 | LDFLAGS = -lpthread -lrt -lelf -lm | 205 | LDFLAGS = -lpthread -lrt -lelf -lm |
199 | ALL_CFLAGS = $(CFLAGS) | 206 | ALL_CFLAGS = $(CFLAGS) |
200 | ALL_LDFLAGS = $(LDFLAGS) | 207 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin) | |||
416 | endif | 423 | endif |
417 | 424 | ||
418 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; 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) | 425 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; 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) |
419 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | 426 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
420 | endif | 427 | endif |
421 | 428 | ||
422 | ifdef NO_DEMANGLE | 429 | ifdef NO_DEMANGLE |