mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
perf tools: Fix compile with libelf without get_phdrnum
Add a feature check for get_phdrnum() and implement a replacement if it is not present. Signed-off-by: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
5b6a42fcb3
commit
e955d5c434
3 changed files with 28 additions and 0 deletions
|
|
@ -180,6 +180,9 @@ FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
|
|||
ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
|
||||
CFLAGS += -DLIBELF_MMAP
|
||||
endif
|
||||
ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM),y)
|
||||
CFLAGS += -DHAVE_ELF_GETPHDRNUM
|
||||
endif
|
||||
|
||||
# include ARCH specific config
|
||||
-include $(src-perf)/arch/$(ARCH)/Makefile
|
||||
|
|
|
|||
|
|
@ -61,6 +61,15 @@ int main(void)
|
|||
}
|
||||
endef
|
||||
|
||||
define SOURCE_ELF_GETPHDRNUM
|
||||
#include <libelf.h>
|
||||
int main(void)
|
||||
{
|
||||
size_t dst;
|
||||
return elf_getphdrnum(0, &dst);
|
||||
}
|
||||
endef
|
||||
|
||||
ifndef NO_SLANG
|
||||
define SOURCE_SLANG
|
||||
#include <slang.h>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,22 @@
|
|||
#include "symbol.h"
|
||||
#include "debug.h"
|
||||
|
||||
#ifndef HAVE_ELF_GETPHDRNUM
|
||||
static int elf_getphdrnum(Elf *elf, size_t *dst)
|
||||
{
|
||||
GElf_Ehdr gehdr;
|
||||
GElf_Ehdr *ehdr;
|
||||
|
||||
ehdr = gelf_getehdr(elf, &gehdr);
|
||||
if (!ehdr)
|
||||
return -1;
|
||||
|
||||
*dst = ehdr->e_phnum;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NT_GNU_BUILD_ID
|
||||
#define NT_GNU_BUILD_ID 3
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue