Skip to contentSkip to conversation

perf probe: Don't compile CFI related code if elfutils is old

PATCH In review Masami Hiramatsu 6 participants 16 messages May 10, 2010 – May 18, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf probe: Don't compile CFI related code if elfutils is old

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>

---

 tools/perf/util/probe-finder.c |    4 ++++
 tools/perf/util/probe-finder.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/util/probe-finder.c +4 -0
index 562b144..93583eb 100644
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
 	if (ret <= 0 || nops == 0) {
 		pf->fb_ops = NULL;
+#if _ELFUTILS_PREREQ(0, 142)
 	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
 		   pf->cfi != NULL) {
 		Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 				   (uintmax_t)pf->addr);
 			return -ENOENT;
 		}
+#endif
 	}
 
 	/* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
 		return -EBADF;
 	}
 
+#if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
 	pf.cfi = dwarf_getcfi(dbg);
+#endif
 
 	off = 0;
 	line_list__init(&pf.lcache);
tools/perf/util/probe-finder.h +3 -0
index 66f1980..e1f61dc 100644
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
 
 #include <dwarf.h>
 #include <libdw.h>
+#include <version.h>
 
 struct probe_finder {
 	struct perf_probe_event	*pev;		/* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
 	struct list_head	lcache;		/* Line cache for lazy match */
 
 	/* For variable searching */
+#if _ELFUTILS_PREREQ(0, 142)
 	Dwarf_CFI		*cfi;		/* Call Frame Information */
+#endif
 	Dwarf_Op		*fb_ops;	/* Frame base attribute */
 	struct perf_probe_arg	*pvar;		/* Current target variable */
 	struct kprobe_trace_arg	*tvar;		/* Current result variable */
Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]
#1 lore raw

Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:

Quoted 3 lines

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

_ELFUTILS_PREREQ was introduced in:

commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60

Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Which was released in elfutils 0.138, guess this is coverage enough? Richard, which version is in your machine?

- Arnaldo

Quoted 68 lines
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>

---

 tools/perf/util/probe-finder.c |    4 ++++
 tools/perf/util/probe-finder.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/util/probe-finder.c +4 -0
index 562b144..93583eb 100644
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
 	if (ret <= 0 || nops == 0) {
 		pf->fb_ops = NULL;
+#if _ELFUTILS_PREREQ(0, 142)
 	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
 		   pf->cfi != NULL) {
 		Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 				   (uintmax_t)pf->addr);
 			return -ENOENT;
 		}
+#endif
 	}
 
 	/* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
 		return -EBADF;
 	}
 
+#if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
 	pf.cfi = dwarf_getcfi(dbg);
+#endif
 
 	off = 0;
 	line_list__init(&pf.lcache);
tools/perf/util/probe-finder.h +3 -0
index 66f1980..e1f61dc 100644
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
 
 #include <dwarf.h>
 #include <libdw.h>
+#include <version.h>
 
 struct probe_finder {
 	struct perf_probe_event	*pev;		/* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
 	struct list_head	lcache;		/* Line cache for lazy match */
 
 	/* For variable searching */
+#if _ELFUTILS_PREREQ(0, 142)
 	Dwarf_CFI		*cfi;		/* Call Frame Information */
+#endif
 	Dwarf_Op		*fb_ops;	/* Frame base attribute */
 	struct perf_probe_arg	*pvar;		/* Current target variable */
 	struct kprobe_trace_arg	*tvar;		/* Current result variable */
Signature · 3 lines
-- 
Masami Hiramatsu
e-mail: [email protected]
#2 lore raw
Quoted 5 lines · Arnaldo Carvalho de Melo

Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:

Quoted 3 lines

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Quoted 8 lines

_ELFUTILS_PREREQ was introduced in:

commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60

Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Which was released in elfutils 0.138, guess this is coverage enough? Richard, which version is in your machine?

Right, this does not work, I am using 0.131. As expected, "_ELFUTILS_PREREQ" is not defined:

gcc -o builtin-probe.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fstack-protector-all -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Iutil/include -Iarch/x86/include -I/usr/include/elfutils -DDWARF_SUPPORT -DNO_NEWT_SUPPORT -DNO_LIBPERL -DSHA1_HEADER='<openssl/sha.h>' builtin-probe.c In file included from builtin-probe.c:43:
util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined
util/probe-finder.h:47:21: error: missing binary operator before token "("
make: *** [builtin-probe.o] Error 1

Why not create a compile test as for NO_DWARF in tools/perf/Makefile?

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#3 lore raw

Em Mon, May 10, 2010 at 08:36:54PM +0200, Robert Richter escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:

Quoted 2 lines

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Quoted 8 lines

_ELFUTILS_PREREQ was introduced in:

commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60

Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Which was released in elfutils 0.138, guess this is coverage enough? Richard, which version is in your machine?

Quoted 8 lines

Right, this does not work, I am using 0.131. As expected, "_ELFUTILS_PREREQ" is not defined:

util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined util/probe-finder.h:47:21: error: missing binary operator before token "("
make: *** [builtin-probe.o] Error 1

Why not create a compile test as for NO_DWARF in tools/perf/Makefile?

Right, that would be better.

- Arnaldo

#4 lore raw
In reply to Robert Richter
Quoted 18 lines · Robert Richter
Quoted 5 lines · Arnaldo Carvalho de Melo

Em Mon, May 10, 2010 at 01:12:07PM -0400, Masami Hiramatsu escreveu:

Quoted 3 lines

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Quoted 8 lines

_ELFUTILS_PREREQ was introduced in:

commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60

Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Which was released in elfutils 0.138, guess this is coverage enough? Richard, which version is in your machine?

Right, this does not work, I am using 0.131. As expected, "_ELFUTILS_PREREQ" is not defined:

Quoted 7 lines

gcc -o builtin-probe.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fstack-protector-all -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Iutil/include -Iarch/x86/include -I/usr/include/elfutils -DDWARF_SUPPORT -DNO_NEWT_SUPPORT -DNO_LIBPERL -DSHA1_HEADER='<openssl/sha.h>' builtin-probe.c In file included from builtin-probe.c:43:
util/probe-finder.h:47:5: error: "_ELFUTILS_PREREQ" is not defined
util/probe-finder.h:47:21: error: missing binary operator before token "("
make: *** [builtin-probe.o] Error 1

Why not create a compile test as for NO_DWARF in tools/perf/Makefile?

Hmm, ok, version.h is also introduced at the same time.

# git log ./config/version.h.in
commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Install elfutils/version.h header for library compatibility checking.

So, I think we'd better set NO_DWARF if the elfutils is older than 0.138, since we can't check API compatibility easily.

Thank you,

Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]
#5 lore raw

Em Mon, May 10, 2010 at 02:57:34PM -0400, Masami Hiramatsu escreveu:

Quoted 7 lines

Hmm, ok, version.h is also introduced at the same time.

# git log ./config/version.h.in
commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800
Quoted 5 lines

Install elfutils/version.h header for library compatibility checking.

So, I think we'd better set NO_DWARF if the elfutils is older than 0.138, since we can't check API compatibility easily.

Well, for that you can just add some of the code you ifdefed in this patch into the tools/perf/Makefile test, or better, duplicate the test, including just the CPI stuff in the new test, and then set NO_DWARF_CFI and use it as the ifdef condition :-)

- Arnaldo

#6 lore raw
Quoted 10 lines · Arnaldo Carvalho de Melo

Em Mon, May 10, 2010 at 02:57:34PM -0400, Masami Hiramatsu escreveu:

Quoted 9 lines

Hmm, ok, version.h is also introduced at the same time.

# git log ./config/version.h.in
commit fbc7245df72ce0142f0a21fa0f4f88c97278bf60
Author: Roland McGrath <[email protected]>
Date:   Tue Dec 16 17:03:03 2008 -0800

Install elfutils/version.h header for library compatibility checking.

Quoted 8 lines
Quoted 3 lines

So, I think we'd better set NO_DWARF if the elfutils is older than 0.138, since we can't check API compatibility easily.

Well, for that you can just add some of the code you ifdefed in this patch into the tools/perf/Makefile test, or better, duplicate the test, including just the CPI stuff in the new test, and then set NO_DWARF_CFI and use it as the ifdef condition :-)

Hm, I'd like to add just '#ifndef _ELFUTILS_PREREQ;#error;#endif' to NO_DWARF checking in Makefile, because it's easier to expand to another API dependency.

Thank you,

Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]
#7 lore raw

PATCH 1/1 perf probe: Check older elfutils and set NO_DWARF

Check whether elfutils is older than 0.138 (from which version checking routine has been introduced). And if so, set NO_DWARF because it is hard to check the API dependency without version checking.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>

---

 tools/perf/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index 0ef5cfe..b28bb73 100644
@@ -506,8 +506,8 @@ PERFLIBS = $(LIB_FILE)
 -include config.mak
 
 ifndef NO_DWARF
-ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
-	msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/libdw-dev);
+ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo '\#include <version.h>'; echo '\#ifndef _ELFUTILS_PREREQ'; echo '\#error'; echo '\#endif'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), 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
 endif # Dwarf support
 endif # NO_DWARF
Signature · 2 lines
Masami Hiramatsu
e-mail: [email protected]
#8 lore raw

Re: [PATCH -tip] perf probe: Check older elfutils and set NO_DWARF

Quoted 3 lines · Masami Hiramatsu

Check whether elfutils is older than 0.138 (from which version checking routine has been introduced). And if so, set NO_DWARF because it is hard to check the API dependency without version checking.

This works for me, now the DWARF_SUPPORT macro is undefined and a warning is generated:

Makefile:510: 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

Thanks,

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#9 lore raw

[tip:perf/core] perf probe: Check older elfutils and set NO_DWARF

In reply to Masami Hiramatsu
Commit-ID:  6b3c4ef50441e85dc9b2c9b67e95e8ad1185c15e
Gitweb:     http://git.kernel.org/tip/6b3c4ef50441e85dc9b2c9b67e95e8ad1185c15e
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Tue, 11 May 2010 00:59:53 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 11 May 2010 12:43:11 -0300

perf probe: Check older elfutils and set NO_DWARF

Check whether elfutils is older than 0.138 (from which version checking routine has been introduced). And if so, set NO_DWARF because it is hard to check the API dependency without version checking.

LKML-Reference: <[email protected]>

---
 tools/perf/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index 0ef5cfe..b28bb73 100644
@@ -506,8 +506,8 @@ PERFLIBS = $(LIB_FILE)
 -include config.mak
 
 ifndef NO_DWARF
-ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
-	msg := $(warning No libdw.h found or old libdw.h found, disables dwarf support. Please install elfutils-devel/libdw-dev);
+ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdw.h>'; echo '\#include <version.h>'; echo '\#ifndef _ELFUTILS_PREREQ'; echo '\#error'; echo '\#endif'; echo 'int main(void) { Dwarf *dbg; dbg = dwarf_begin(0, DWARF_C_READ); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -I/usr/include/elfutils -ldw -lelf -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), 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
 endif # Dwarf support
 endif # NO_DWARF
#10 lore raw
In reply to Masami Hiramatsu
Quoted 3 lines · Masami Hiramatsu

Hm, I'd like to add just '#ifndef _ELFUTILS_PREREQ;#error;#endif' to NO_DWARF checking in Makefile, because it's easier to expand to another API dependency.

You might want to check systemtap/dwarf-wrappers.h which handles missing _ELFUTILS_PREREQ, so you can use it as if it is always defined. That said, 0.138 is pretty old (latest is 0.147), so just requiring something fresh might not be a bad thing.

Cheers,

Mark

#11 lore raw
In reply to Masami Hiramatsu
Commit-ID:  7752f1b096e13991f20b59fd11ba73da3809d93c
Gitweb:     http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 10 May 2010 13:12:07 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 17 May 2010 22:13:51 -0300

perf probe: Don't compile CFI related code if elfutils is old

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

LKML-Reference: <[email protected]>

---
 tools/perf/util/probe-finder.c |    4 ++++
 tools/perf/util/probe-finder.h |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
tools/perf/util/probe-finder.c +4 -0
index 562b144..93583eb 100644
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
 	if (ret <= 0 || nops == 0) {
 		pf->fb_ops = NULL;
+#if _ELFUTILS_PREREQ(0, 142)
 	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
 		   pf->cfi != NULL) {
 		Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 				   (uintmax_t)pf->addr);
 			return -ENOENT;
 		}
+#endif
 	}
 
 	/* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
 		return -EBADF;
 	}
 
+#if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
 	pf.cfi = dwarf_getcfi(dbg);
+#endif
 
 	off = 0;
 	line_list__init(&pf.lcache);
tools/perf/util/probe-finder.h +3 -0
index 66f1980..e1f61dc 100644
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
 
 #include <dwarf.h>
 #include <libdw.h>
+#include <version.h>
 
 struct probe_finder {
 	struct perf_probe_event	*pev;		/* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
 	struct list_head	lcache;		/* Line cache for lazy match */
 
 	/* For variable searching */
+#if _ELFUTILS_PREREQ(0, 142)
 	Dwarf_CFI		*cfi;		/* Call Frame Information */
+#endif
 	Dwarf_Op		*fb_ops;	/* Frame base attribute */
 	struct perf_probe_arg	*pvar;		/* Current target variable */
 	struct kprobe_trace_arg	*tvar;		/* Current result variable */
#12 lore raw
Quoted 12 lines · tip-bot for Masami Hiramatsu
Commit-ID:  7752f1b096e13991f20b59fd11ba73da3809d93c
Gitweb:     http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 10 May 2010 13:12:07 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 17 May 2010 22:13:51 -0300

perf probe: Don't compile CFI related code if elfutils is old

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Quoted 7 lines

LKML-Reference: <[email protected]>

---

I think this patch is not needed as we came up with an alternative solution with commit:

6b3c4ef perf probe: Check older elfutils and set NO_DWARF

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#13 lore raw
Quoted 21 lines · Robert Richter
Quoted 12 lines · tip-bot for Masami Hiramatsu

Commit-ID:  7752f1b096e13991f20b59fd11ba73da3809d93c
Gitweb:     http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 10 May 2010 13:12:07 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 17 May 2010 22:13:51 -0300

perf probe: Don't compile CFI related code if elfutils is old

Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

Quoted 7 lines

LKML-Reference: <[email protected]>

---

Quoted 5 lines

I think this patch is not needed as we came up with an alternative solution with commit:

 6b3c4ef perf probe: Check older elfutils and set NO_DWARF

But I am compiling tip, so this patch is in and I still got the problem. It is because the test program does not check for Dwarf_CFI so it assumes you have the right version of libdw.

If I understand Masami's patch, you can still compile dwarf support in despite the lack of Dwarf_CFI.

#14 lore raw
Quoted 2 lines · Stephane Eranian

If I understand Masami's patch, you can still compile dwarf support in despite the lack of Dwarf_CFI.

I see, so the #if macros are effectively needed only for versions 138 to 141.

-Robert

Signature · 3 lines
Advanced Micro Devices, Inc.
Operating System Research Center
email: [email protected]
#15 lore raw
In reply to Stephane Eranian

Em Tue, May 18, 2010 at 11:39:58AM +0200, Stephane Eranian escreveu:

Quoted 20 lines · Robert Richter
Quoted 18 lines · tip-bot for Masami Hiramatsu
Quoted 17 lines

Commit-ID:  7752f1b096e13991f20b59fd11ba73da3809d93c
Gitweb:     http://git.kernel.org/tip/7752f1b096e13991f20b59fd11ba73da3809d93c
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 10 May 2010 13:12:07 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 17 May 2010 22:13:51 -0300

perf probe: Don't compile CFI related code if elfutils is old Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils.

LKML-Reference: <[email protected]>

Quoted 4 lines
Quoted 4 lines

I think this patch is not needed as we came up with an alternative solution with commit:

 6b3c4ef perf probe: Check older elfutils and set NO_DWARF

Yeah, that was confusing, my understanding was that 6b3c4ef superseeded 7752f1b, but it was needed in addition to it, as can be seen by Stephane's report.

6b3c4ef worked for you because it used the heavy hammer, by not noticing the _ELFUTILS_PREREQ macro it decided that the elfutils version installed was way too old, so disable everything related to it, i.e. perf probe will work just with /proc/kallsyms. I.e. your version of elfutils was <= 0.138, that is when the PREREQ macro was introduced.

But Stephanes is > 0.138 _but_ < 0.142, that is when Dwarf_CFI appeared, so he can use the PREREQ macro to build only removing the code that depends on Dwarf_CFI being available.

Quoted 6 lines

But I am compiling tip, so this patch is in and I still got the problem. It is because the test program does not check for Dwarf_CFI so it assumes you have the right version of libdw.

If I understand Masami's patch, you can still compile dwarf support in despite the lack of Dwarf_CFI.

Right.

- Arnaldo