Skip to contentSkip to conversation

perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and older.

PATCH In review Vinson Lee 3 participants 3 messages Feb 10, 2015 – Feb 18, 2015 perf events

lore
Share & tools
lore

Vinson Lee

author
#0 lore raw

PATCH 1/1 perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and older.

From: Vinson Lee <[email protected]>

The token STT_GNU_IFUNC is not available with glibc 2.9 and older. Define this token if it is not already defined.

This patch fixes this build errors with older versions of glibc.

CC util/symbol-elf.o
util/symbol-elf.c: In function ‘elf_sym__is_function’:
util/symbol-elf.c:75: error: ‘STT_GNU_IFUNC’ undeclared (first use in this function) util/symbol-elf.c:75: error: (Each undeclared identifier is reported only once util/symbol-elf.c:75: error: for each function it appears in.)
make: *** [util/symbol-elf.o] Error 1

---
 tools/perf/util/symbol-elf.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/util/symbol-elf.c +4 -0
index 06fcd1b..eafee11 100644
@@ -69,6 +69,10 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
 	return GELF_ST_TYPE(sym->st_info);
 }
 
+#ifndef STT_GNU_IFUNC
+#define STT_GNU_IFUNC 10
+#endif
+
 static inline int elf_sym__is_function(const GElf_Sym *sym)
 {
 	return (elf_sym__type(sym) == STT_FUNC ||
Signature · 1 line
1.8.2.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Vinson,

Quoted 14 lines · Vinson Lee

From: Vinson Lee <[email protected]>

The token STT_GNU_IFUNC is not available with glibc 2.9 and older. Define this token if it is not already defined.

This patch fixes this build errors with older versions of glibc.

CC util/symbol-elf.o
util/symbol-elf.c: In function ‘elf_sym__is_function’:
util/symbol-elf.c:75: error: ‘STT_GNU_IFUNC’ undeclared (first use in this function) util/symbol-elf.c:75: error: (Each undeclared identifier is reported only once util/symbol-elf.c:75: error: for each function it appears in.)
make: *** [util/symbol-elf.o] Error 1

Quoted 2 lines

Thanks,
Namhyung

Quoted 22 lines
---
 tools/perf/util/symbol-elf.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/util/symbol-elf.c +4 -0
index 06fcd1b..eafee11 100644
@@ -69,6 +69,10 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
 	return GELF_ST_TYPE(sym->st_info);
 }
 
+#ifndef STT_GNU_IFUNC
+#define STT_GNU_IFUNC 10
+#endif
+
 static inline int elf_sym__is_function(const GElf_Sym *sym)
 {
 	return (elf_sym__type(sym) == STT_FUNC ||
Signature · 1 line
1.8.2.1
#2 lore raw
In reply to Vinson Lee
perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and older.
Commit-ID:  4e31050f482c02c822b150d71cf1ea5be7c9d6e4
Gitweb:     http://git.kernel.org/tip/4e31050f482c02c822b150d71cf1ea5be7c9d6e4
Author:     Vinson Lee <[email protected]>
AuthorDate: Mon, 9 Feb 2015 16:29:37 -0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Feb 2015 12:37:32 -0300

perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and older.

The token STT_GNU_IFUNC is not available with glibc 2.9 and older. Define this token if it is not already defined.

This patch fixes this build errors with older versions of glibc.

CC util/symbol-elf.o
util/symbol-elf.c: In function ‘elf_sym__is_function’:
util/symbol-elf.c:75: error: ‘STT_GNU_IFUNC’ undeclared (first use in this function) util/symbol-elf.c:75: error: (Each undeclared identifier is reported only once util/symbol-elf.c:75: error: for each function it appears in.)
make: *** [util/symbol-elf.o] Error 1

---
 tools/perf/util/symbol-elf.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/perf/util/symbol-elf.c +4 -0
index 225eb73..b02731a 100644
@@ -69,6 +69,10 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym)
 	return GELF_ST_TYPE(sym->st_info);
 }
 
+#ifndef STT_GNU_IFUNC
+#define STT_GNU_IFUNC 10
+#endif
+
 static inline int elf_sym__is_function(const GElf_Sym *sym)
 {
 	return (elf_sym__type(sym) == STT_FUNC ||