Skip to contentSkip to conversation

libelf portability

PATCH New Christoph Egger 1 participant 1 message Sep 20, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libelf portability

Hi!

Attached patch adds support for OpenBSD and NetBSD to libelf in relation to tools/libxc.

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
xen/common/libelf/libelf-private.h +13 -1
diff -r a00cc97b392a xen/common/libelf/libelf-private.h
@@ -33,8 +33,20 @@
 #define bswap_16(x) BSWAP_16(x)
 #define bswap_32(x) BSWAP_32(x)
 #define bswap_64(x) BSWAP_64(x)
+#elif defined(__NetBSD__)
+#include <sys/bswap.h>
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+#elif defined(__OpenBSD__)
+#include <machine/endian.h>
+#define bswap_16(x) swap16(x)
+#define bswap_32(x) swap32(x)
+#define bswap_64(x) swap64(x)
+#elif defined(__linux__) || defined(__Linux__)
+#include <byteswap.h>
 #else
-#include <byteswap.h>
+#error Unsupported OS
 #endif
 #include <xen/elfnote.h>
 #include <xen/libelf.h>

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel