--- common/_elftc.h	2012-04-23 07:31:56.000000000 +0200
+++ common/_elftc.h	2012-09-25 11:17:20.000000000 +0200
@@ -244,6 +244,10 @@
 #endif	/* __GNUC__ */
 #endif
 
+#if defined(__APPLE__)
+#define	ELFTC_VCSID(ID)		/**/
+#endif
+
 #endif	/* ELFTC_VCSID */
 
 /*
@@ -252,8 +256,8 @@
 
 #ifndef	ELFTC_GETPROGNAME
 
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__minix) || \
-    defined(__NetBSD__)
+#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || \
+    defined(__minix) || defined(__NetBSD__)
 
 #include <stdlib.h>
 
@@ -384,4 +388,20 @@
 
 #endif	/* __OpenBSD__ */
 
+
+#if defined(__APPLE__)
+
+#include <machine/endian.h>
+
+#define	ELFTC_BYTE_ORDER			__DARWIN_BYTE_ORDER
+#define	ELFTC_BYTE_ORDER_LITTLE_ENDIAN		__DARWIN_LITTLE_ENDIAN
+#define	ELFTC_BYTE_ORDER_BIG_ENDIAN		__DARWIN_BIG_ENDIAN
+
+#define	ELFTC_HAVE_STRMODE			1
+#define	ELFTC_NEED_BYTEORDER_EXTENSIONS		1
+
+#define	roundup2	roundup
+
+#endif /* __APPLE__ */
+
 #endif	/* _ELFTC_H */
