From: Irina Tirdea Date: Mon, 10 Sep 2012 22:14:59 +0000 (+0300) Subject: perf tools: Update types definitions for Android X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=86d5a70c1eeb3d35bcadc94753fd9651df8835a8;p=linux-beck.git perf tools: Update types definitions for Android Some type definitions are missing from Android or are already defined in bionic and lead to redefinition errors. Android defines in types.h __le32. Since perf is wrapping with a local version, we need to define this constant in the local version too. Error in Android: In file included from bionic/libc/include/unistd.h:36:0, from external/perf/tools/perf/util/util.h:46, from external/perf/tools/perf/util/cache.h:5, from external/perf/tools/perf/util/abspath.c:1: bionic/libc/kernel/common/linux/capability.h:60:2: error: unknown type name '__le32' roundup() definition is missing: util/symbol.c: In function 'symbols__fixup_end': util/symbol.c:106: warning: implicit declaration of function 'roundup' util/symbol.c:106: warning: nested extern declaration of 'roundup' __force macro defined in perf is also defined in libc which leads to redefinition errors. In order to avoid these, we guard these definition with Signed-off-by: Irina Tirdea Acked-by: Pekka Enberg Cc: David Ahern Cc: Ingo Molnar Cc: Irina Tirdea Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/1347315303-29906-3-git-send-email-irina.tirdea@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/include/linux/compiler.h b/tools/perf/util/include/linux/compiler.h index 2dc867128e46..ce2367b7b3f6 100644 --- a/tools/perf/util/include/linux/compiler.h +++ b/tools/perf/util/include/linux/compiler.h @@ -12,4 +12,8 @@ #define __used __attribute__((__unused__)) #define __packed __attribute__((__packed__)) +#ifndef __force +#define __force +#endif + #endif diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h index 4af9a10cc2d2..a978f269d8d2 100644 --- a/tools/perf/util/include/linux/kernel.h +++ b/tools/perf/util/include/linux/kernel.h @@ -46,6 +46,15 @@ _min1 < _min2 ? _min1 : _min2; }) #endif +#ifndef roundup +#define roundup(x, y) ( \ +{ \ + const typeof(y) __y = y; \ + (((x) + (__y - 1)) / __y) * __y; \ +} \ +) +#endif + #ifndef BUG_ON #ifdef NDEBUG #define BUG_ON(cond) do { if (cond) {} } while (0) diff --git a/tools/perf/util/include/linux/types.h b/tools/perf/util/include/linux/types.h index 12de3b8112f9..eb464786c084 100644 --- a/tools/perf/util/include/linux/types.h +++ b/tools/perf/util/include/linux/types.h @@ -3,6 +3,14 @@ #include +#ifndef __bitwise +#define __bitwise +#endif + +#ifndef __le32 +typedef __u32 __bitwise __le32; +#endif + #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)]