All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make libelf build on Solaris
@ 2007-01-28 16:38 john.levon
  2007-01-28 18:16 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: john.levon @ 2007-01-28 16:38 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User john.levon@sun.com
# Date 1170001675 28800
# Node ID 132cc7bc2a356aa058b8550b90d5bb491fe0ea8c
# Parent  a484197f951e32da001f56faf6b140c9ac297897
Make libelf build on Solaris.

libelf has a number of Linuxisms. Fix them up.

Signed-off-by: John Levon <john.levon@sun.com>

diff --git a/xen/common/libelf/libelf-private.h b/xen/common/libelf/libelf-private.h
--- a/xen/common/libelf/libelf-private.h
+++ b/xen/common/libelf/libelf-private.h
@@ -33,7 +33,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef __sun__
+#include <sys/byteorder.h>
+#define bswap_16(x) BSWAP_16(x)
+#define bswap_32(x) BSWAP_32(x)
+#define bswap_64(x) BSWAP_64(x)
+#else
 #include <byteswap.h>
+#endif
 #include <xen/elfnote.h>
 #include <xen/libelf.h>
 
diff --git a/xen/include/public/libelf.h b/xen/include/public/libelf.h
--- a/xen/include/public/libelf.h
+++ b/xen/include/public/libelf.h
@@ -7,6 +7,14 @@
 #include <public/features.h>
 typedef uint64_t off_t;
 
+#else /* !__XEN__ */
+
+#include <stddef.h>
+#include <inttypes.h>
+
+#endif
+
+#ifndef BYTE_ORDER
 #define LITTLE_ENDIAN 1234
 #define BIG_ENDIAN    4321
 #if defined(__i386__) || defined(__x86_64) || defined(__ia64__)
@@ -14,13 +22,7 @@ typedef uint64_t off_t;
 #elif defined(__powerpc__)
 #define BYTE_ORDER BIG_ENDIAN
 #endif
-
-#else /* !__XEN__ */
-
-#include <stddef.h>
-#include <inttypes.h>
-
-#endif
+#endif /* !BYTE_ORDER */
 
 #undef ELFSIZE
 #include "elfstructs.h"

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

* Re: [PATCH] Make libelf build on Solaris
  2007-01-28 16:38 [PATCH] Make libelf build on Solaris john.levon
@ 2007-01-28 18:16 ` Keir Fraser
  2007-01-28 19:24   ` John Levon
  0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2007-01-28 18:16 UTC (permalink / raw)
  To: john.levon, xen-devel

On 28/1/07 4:38 pm, "john.levon@sun.com" <john.levon@sun.com> wrote:

> Make libelf build on Solaris.
> 
> libelf has a number of Linuxisms. Fix them up.

Does Solaris define __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN in its
byteorder.h? It might make sense to have the libelf code use those instead
of the non-underscore-prefixed versions, and have the public libelf header
assume the caller has pulled in the necessary headers rather than having at
the namespace itself. I think there must be some rationalisation possible
here, especially now that Xen itself has byteorder headers.

 -- Keir

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

* Re: [PATCH] Make libelf build on Solaris
  2007-01-28 19:24   ` John Levon
@ 2007-01-28 19:18     ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2007-01-28 19:18 UTC (permalink / raw)
  To: John Levon; +Cc: xen-devel

On 28/1/07 19:24, "John Levon" <john.levon@sun.com> wrote:

> Does Solaris define __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN in its
>> byteorder.h?
> 
> No. It defines _LITTLE_ENDIAN and _BIG_ENDIAN as appropriate. There's no
> .*BYTE_ORDER.

Ah, never mind. I took another route to clean things up. Avoiding that whole
area of namespace entirely seemed a good idea. :-)

 -- Keir

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

* Re: [PATCH] Make libelf build on Solaris
  2007-01-28 18:16 ` Keir Fraser
@ 2007-01-28 19:24   ` John Levon
  2007-01-28 19:18     ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: John Levon @ 2007-01-28 19:24 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Sun, Jan 28, 2007 at 06:16:40PM +0000, Keir Fraser wrote:

> > Make libelf build on Solaris.
> > 
> > libelf has a number of Linuxisms. Fix them up.
> 
> Does Solaris define __BYTE_ORDER, __LITTLE_ENDIAN, __BIG_ENDIAN in its
> byteorder.h?

No. It defines _LITTLE_ENDIAN and _BIG_ENDIAN as appropriate. There's no
.*BYTE_ORDER.

regards,
john

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

end of thread, other threads:[~2007-01-28 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-28 16:38 [PATCH] Make libelf build on Solaris john.levon
2007-01-28 18:16 ` Keir Fraser
2007-01-28 19:24   ` John Levon
2007-01-28 19:18     ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.