aboutsummaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile5
-rw-r--r--tools/perf/compat-android.h29
-rw-r--r--tools/perf/util/pager.c1
-rw-r--r--tools/perf/util/util.h2
4 files changed, 34 insertions, 3 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 16d4c64d9718..efd3e801f3a5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -501,7 +501,8 @@ ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
ifeq ($(call try-cc,$(SOURCE_BIONIC),$(FLAGS_GLIBC)),y)
# Found Bionic instead of glibc...
# That works too, but needs a bit of special treatment
- BASIC_CFLAGS += -DANDROID -DHAVE_STRLCPY -include $(CURDIR)/compat-android.h
+ ANDROID_CFLAGS := -DANDROID -DHAVE_STRLCPY -include $(CURDIR)/compat-android.h
+ BASIC_CFLAGS += $(ANDROID_CFLAGS)
ANDROID := 1
else
msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
@@ -958,7 +959,7 @@ $(LIB_FILE): $(LIB_OBJS)
# libtraceevent.a
$(LIBTRACEEVENT):
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) VERBOSE=2 CFLAGS="$(ALL_CFLAGS)" O=$(OUTPUT) libtraceevent.a
+ $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) ANDROID_CFLAGS="$(ANDROID_CFLAGS)" O=$(OUTPUT) libtraceevent.a
$(LIBTRACEEVENT)-clean:
$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) clean
diff --git a/tools/perf/compat-android.h b/tools/perf/compat-android.h
index b8fb93679329..fce9573d257b 100644
--- a/tools/perf/compat-android.h
+++ b/tools/perf/compat-android.h
@@ -20,13 +20,35 @@
#ifndef _COMPAT_ANDROID_H_
#define _COMPAT_ANDROID_H_ 1
+/* Stuff Bionic assumes to be present, but that doesn't exist
+ * anymore after the uabi kernel header reorg
+ */
+#include <stdint.h>
+#include <stdbool.h>
+typedef unsigned short __kernel_nlink_t;
+typedef intptr_t phys_addr_t;
+#include <linux/types.h>
+typedef uint32_t u32;
+typedef uint64_t u64;
+#ifndef CONFIG_DRAM_BASEUL
+#ifdef CONFIG_DRAM_BASE
+#define CONFIG_DRAM_BASEUL UL(CONFIG_DRAM_BASE)
+#else
+#define CONFIG_DRAM_BASEUL 0
+#endif
+#endif
+#define __deprecated
+#include <asm-generic/bitsperlong.h>
+
+#undef BITS_PER_LONG /* Something seems to define this incorrectly */
+#define BITS_PER_LONG _BITSIZE
+
#include <stdio.h>
#include <signal.h>
#include <asm/page.h> /* for PAGE_SIZE */
#include <asm/termios.h> /* for winsize */
#ifndef __WORDSIZE
-#include <stdint.h>
#define __WORDSIZE _BITSIZE
#endif
@@ -42,6 +64,11 @@
#define __le32 uint32_t
#endif
+#ifndef FD_SET
+#define FD_SET(fd, fdsetp) (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
+#define FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
+#endif
+
/* Assorted functions that are missing from Bionic */
/* Android prior to 4.2 lacks psignal().
* What we're doing here is fairly evil - but necessary since
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 3322b8446e89..cd543418c721 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "run-command.h"
#include "sigchain.h"
+#include <sys/select.h>
/*
* This is split up from the rest of git so that we can do
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 10e8a478ae4c..ebee70529cdc 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -253,11 +253,13 @@ void event_attr_init(struct perf_event_attr *attr);
* *not* considered a power of two.
*/
+#ifndef _LINUX_LOG2_H // defined there too
static inline __attribute__((const))
bool is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}
+#endif
size_t hex_width(u64 v);