linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 02/13] perf tools: update types definitions for Android
@ 2012-08-28 22:33 Irina Tirdea
  2012-08-29 16:18 ` David Ahern
  0 siblings, 1 reply; 4+ messages in thread
From: Irina Tirdea @ 2012-08-28 22:33 UTC (permalink / raw)
  To: Steven Rostedt, Arnaldo Carvalho de Melo, Ingo Molnar
  Cc: LKML, Namhyung Kim, Peter Zijlstra, Frederic Weisbecker

Some systems (e.g. Android) define in their libc types.h
__le16, __be16, etc. Since perf is wrapping
<linux/types.h> with a local version, we need to define this
constants in the local version too.

Errors in Android:
In file included from bionic/libc/include/netinet/in.h:34:0,
                 from util/util.h:73,
                 from util/cache.h:5,
                 from util/abspath.c:1:
bionic/libc/kernel/common/linux/in6.h:20:2: error: unknown type name '__be16'
bionic/libc/kernel/common/linux/in6.h:21:2: error: unknown type name '__be32'
bionic/libc/kernel/common/linux/in6.h:30:2: error: unknown type name '__be16'
bionic/libc/kernel/common/linux/in6.h:31:2: error: unknown type name '__be32'
bionic/libc/kernel/common/linux/in6.h:47:2: error: unknown type name '__be32'

roundup() definition is also 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'

Some macro defined in perf are also defined in libc which
leads to redefinition errors. In order to avoid these, we
guard these definitions with #ifndef.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 tools/perf/util/include/linux/compiler.h |    4 ++++
 tools/perf/util/include/linux/kernel.h   |   11 +++++++++++
 tools/perf/util/include/linux/types.h    |   15 +++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/tools/perf/util/include/linux/compiler.h
b/tools/perf/util/include/linux/compiler.h
index 2dc8671..ce2367b 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 b6842c1..391c425 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -46,6 +46,17 @@
 	_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
 #define BUG_ON(cond) assert(!(cond))
 #endif
diff --git a/tools/perf/util/include/linux/types.h
b/tools/perf/util/include/linux/types.h
index 12de3b8..60a97bb 100644
--- a/tools/perf/util/include/linux/types.h
+++ b/tools/perf/util/include/linux/types.h
@@ -3,6 +3,21 @@

 #include <asm/types.h>

+#ifndef __bitwise__
+#define __bitwise__
+#endif
+
+#ifndef __bitwise
+#define __bitwise
+#endif
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+
 #define DECLARE_BITMAP(name,bits) \
 	unsigned long name[BITS_TO_LONGS(bits)]

-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 02/13] perf tools: update types definitions for Android
  2012-08-28 22:33 [PATCH 02/13] perf tools: update types definitions for Android Irina Tirdea
@ 2012-08-29 16:18 ` David Ahern
  2012-09-02 19:59   ` Irina Tirdea
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2012-08-29 16:18 UTC (permalink / raw)
  To: Irina Tirdea
  Cc: Steven Rostedt, Arnaldo Carvalho de Melo, Ingo Molnar, LKML,
	Namhyung Kim, Peter Zijlstra, Frederic Weisbecker

On 8/28/12 4:33 PM, Irina Tirdea wrote:
> Some systems (e.g. Android) define in their libc types.h
> __le16, __be16, etc. Since perf is wrapping
> <linux/types.h> with a local version, we need to define this
> constants in the local version too.
>
> Errors in Android:
> In file included from bionic/libc/include/netinet/in.h:34:0,
>                   from util/util.h:73,
>                   from util/cache.h:5,
>                   from util/abspath.c:1:
> bionic/libc/kernel/common/linux/in6.h:20:2: error: unknown type name '__be16'
> bionic/libc/kernel/common/linux/in6.h:21:2: error: unknown type name '__be32'
> bionic/libc/kernel/common/linux/in6.h:30:2: error: unknown type name '__be16'
> bionic/libc/kernel/common/linux/in6.h:31:2: error: unknown type name '__be32'
> bionic/libc/kernel/common/linux/in6.h:47:2: error: unknown type name '__be32'

This https://lkml.org/lkml/2012/8/29/150 should fix the netinet/in.h 
build problem.

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 02/13] perf tools: update types definitions for Android
  2012-08-29 16:18 ` David Ahern
@ 2012-09-02 19:59   ` Irina Tirdea
  0 siblings, 0 replies; 4+ messages in thread
From: Irina Tirdea @ 2012-09-02 19:59 UTC (permalink / raw)
  To: David Ahern
  Cc: Steven Rostedt, Arnaldo Carvalho de Melo, Ingo Molnar, LKML,
	Namhyung Kim, Peter Zijlstra, Frederic Weisbecker

> This https://lkml.org/lkml/2012/8/29/150 should fix the netinet/in.h build
> problem.

Thanks! I'll change this patch and resubmit.

Irina

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 02/13] perf tools: update types definitions for Android
@ 2012-08-28 21:59 Irina Tirdea
  0 siblings, 0 replies; 4+ messages in thread
From: Irina Tirdea @ 2012-08-28 21:59 UTC (permalink / raw)
  To: Steven Rostedt, Arnaldo Carvalho de Melo, Ingo Molnar
  Cc: LKML, Namhyung Kim, Peter Zijlstra, Frederic Weisbecker

Some systems (e.g. Android) define in their libc types.h
__le16, __be16, etc. Since perf is wrapping
<linux/types.h> with a local version, we need to define this
constants in the local version too.

Errors in Android:
In file included from bionic/libc/include/netinet/in.h:34:0,
                 from util/util.h:73,
                 from util/cache.h:5,
                 from util/abspath.c:1:
bionic/libc/kernel/common/linux/in6.h:20:2: error: unknown type name '__be16'
bionic/libc/kernel/common/linux/in6.h:21:2: error: unknown type name '__be32'
bionic/libc/kernel/common/linux/in6.h:30:2: error: unknown type name '__be16'
bionic/libc/kernel/common/linux/in6.h:31:2: error: unknown type name '__be32'
bionic/libc/kernel/common/linux/in6.h:47:2: error: unknown type name '__be32'

roundup() definition is also 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'

Some macro defined in perf are also defined in libc which
leads to redefinition errors. In order to avoid these, we
guard these definitions with #ifndef.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 tools/perf/util/include/linux/compiler.h |    4 ++++
 tools/perf/util/include/linux/kernel.h   |   11 +++++++++++
 tools/perf/util/include/linux/types.h    |   15 +++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/tools/perf/util/include/linux/compiler.h
b/tools/perf/util/include/linux/compiler.h
index 2dc8671..ce2367b 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 b6842c1..391c425 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -46,6 +46,17 @@
     _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
 #define BUG_ON(cond) assert(!(cond))
 #endif
diff --git a/tools/perf/util/include/linux/types.h
b/tools/perf/util/include/linux/types.h
index 12de3b8..60a97bb 100644
--- a/tools/perf/util/include/linux/types.h
+++ b/tools/perf/util/include/linux/types.h
@@ -3,6 +3,21 @@

 #include <asm/types.h>

+#ifndef __bitwise__
+#define __bitwise__
+#endif
+
+#ifndef __bitwise
+#define __bitwise
+#endif
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+
 #define DECLARE_BITMAP(name,bits) \
     unsigned long name[BITS_TO_LONGS(bits)]

--
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-02 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 22:33 [PATCH 02/13] perf tools: update types definitions for Android Irina Tirdea
2012-08-29 16:18 ` David Ahern
2012-09-02 19:59   ` Irina Tirdea
  -- strict thread matches above, loose matches on Subject: below --
2012-08-28 21:59 Irina Tirdea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).