mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Iles <jamie.iles@picochip.com>
To: linux-kernel@vger.kernel.org
Cc: Jamie Iles <jamie.iles@picochip.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH] perf tools: allow cross compiling with DWARF support
Date: Fri, 25 Jun 2010 11:38:38 +0100	[thread overview]
Message-ID: <1277462318-6516-1-git-send-email-jamie.iles@picochip.com> (raw)

The path to elfutils was previously hardcoded as /usr/include/elfutils
which does not work with cross compilers. If CROSS_COMPILE is set, try
to set an include path from GCC's sysroot if GCC was built with sysroot
support, if sysroot support isn't enabled, don't specify a path for
elfutils allowing the user to set it with EXTRA_CFLAGS.

Signed-off-by: Jamie Iles <jamie.iles@picochip.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/Makefile |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 6aa2fe3..6217839 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -503,8 +503,18 @@ PERFLIBS = $(LIB_FILE)
 -include config.mak.autogen
 -include config.mak
 
+ifndef CROSS_COMPILE
+ELFUTILS_INCLUDE = -I/usr/include/elfutils
+else
+# See if the compiler has been built with sysroot support
+SYSROOT_PATH = $(shell $(CC) -print-sysroot 2> /dev/null || echo "")
+ifneq ($(SYSROOT_PATH),)
+ELFUTILS_INCLUDE := -I$(SYSROOT_PATH)/usr/include/elfutils
+endif
+endif
+
 ifndef NO_DWARF
-FLAGS_DWARF=$(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
+FLAGS_DWARF=$(ALL_CFLAGS) $(ELFUTILS_INCLUDE) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
 	msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
 	NO_DWARF := 1
@@ -551,7 +561,7 @@ ifndef NO_DWARF
 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
 else
-	BASIC_CFLAGS += -I/usr/include/elfutils -DDWARF_SUPPORT
+	BASIC_CFLAGS += $(ELFUTILS_INCLUDE) -DDWARF_SUPPORT
 	EXTLIBS += -lelf -ldw
 	LIB_OBJS += $(OUTPUT)util/probe-finder.o
 endif # PERF_HAVE_DWARF_REGS
-- 
1.6.5.4


             reply	other threads:[~2010-06-25 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 10:38 Jamie Iles [this message]
2010-06-25 11:16 ` Masami Hiramatsu
2010-06-25 11:41   ` Jamie Iles
2010-06-25 12:03     ` Masami Hiramatsu
2010-06-25 13:33       ` Jamie Iles
2010-06-28  1:34         ` Masami Hiramatsu

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=1277462318-6516-1-git-send-email-jamie.iles@picochip.com \
    --to=jamie.iles@picochip.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®