aboutsummaryrefslogtreecommitdiff
path: root/common/_elftc.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/_elftc.h')
-rw-r--r--common/_elftc.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/common/_elftc.h b/common/_elftc.h
index d6c878402747..45f0abd80774 100644
--- a/common/_elftc.h
+++ b/common/_elftc.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: _elftc.h 3139 2015-01-05 03:17:06Z kaiwang27 $
+ * $Id: _elftc.h 3175 2015-03-27 17:21:24Z emaste $
*/
/**
@@ -294,7 +294,8 @@ struct name { \
#define ELFTC_VCSID(ID) __FBSDID(ID)
#endif
-#if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
+#if defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
+ defined(__linux__)
#if defined(__GNUC__)
#define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
#else
@@ -330,8 +331,8 @@ struct name { \
#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>
@@ -340,7 +341,7 @@ struct name { \
#endif /* __DragonFly__ || __FreeBSD__ || __minix || __NetBSD__ */
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined(__linux__)
/*
* GLIBC based systems have a global 'char *' pointer referencing
@@ -350,7 +351,7 @@ extern const char *program_invocation_short_name;
#define ELFTC_GETPROGNAME() program_invocation_short_name
-#endif /* __GLIBC__ */
+#endif /* __GLIBC__ || __linux__ */
#if defined(__OpenBSD__)
@@ -368,6 +369,21 @@ extern const char *__progname;
** Per-OS configuration.
**/
+#if defined(__APPLE__)
+
+#include <machine/endian.h>
+#define roundup2 roundup
+
+#define ELFTC_BYTE_ORDER _BYTE_ORDER
+#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN
+#define ELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN
+
+#define ELFTC_HAVE_MMAP 1
+#define ELFTC_HAVE_STRMODE 1
+
+#endif /* __APPLE__ */
+
+
#if defined(__DragonFly__)
#include <osreldate.h>
@@ -381,7 +397,7 @@ extern const char *__progname;
#endif
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined(__linux__)
#include <endian.h>
@@ -401,7 +417,7 @@ extern const char *__progname;
#define roundup2 roundup
-#endif /* __GLIBC__ */
+#endif /* __GLIBC__ || __linux__ */
#if defined(__FreeBSD__)