aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Tarasov <tarasov@dodologics.com>2008-11-07 11:17:52 +1000
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-29 08:55:34 -0700
commit076abacc918b7a6f0e3a8cc50b71c87c2ba8d469 (patch)
tree85226b322c93fd12fa78fa6d78166afba5886656
parentff8a91f7658a3d34863bbc1695c9ec538f903095 (diff)
downloadelfutils-076abacc918b7a6f0e3a8cc50b71c87c2ba8d469.tar.gz
1. Removed commented include of <endian.h>
2. added config-compat-freebsd.h and updated makefile to include it while compilation.
-rwxr-xr-xAndroid.mk6
-rw-r--r--config-compat-freebsd.h73
-rw-r--r--libelf/elf32_checksum.c1
3 files changed, 79 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index b283024e..ee988f73 100755
--- a/Android.mk
+++ b/Android.mk
@@ -125,6 +125,9 @@ endif
ifeq ($(HOST_OS),windows)
LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-cygwin.h
endif
+ifeq ($(HOST_OS),freebsd)
+LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-freebsd.h
+endif
LOCAL_MODULE:= libelf
@@ -184,6 +187,9 @@ endif
ifeq ($(HOST_OS),windows)
LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-cygwin.h
endif
+ifeq ($(HOST_OS),freebsd)
+LOCAL_CFLAGS +=-include $(LOCAL_PATH)/config-compat-freebsd.h
+endif
LOCAL_MODULE:=libebl
diff --git a/config-compat-freebsd.h b/config-compat-freebsd.h
new file mode 100644
index 00000000..092f9f0a
--- /dev/null
+++ b/config-compat-freebsd.h
@@ -0,0 +1,73 @@
+#ifndef CONFIG_COMPAT_COMPAT_H
+#define CONFIG_COMPAT_COMPAT_H
+
+#define gettext
+#define _gettext
+#define _dgettext
+
+#include <sys/types.h>
+#include <sys/endian.h>
+
+typedef off_t __off64_t;
+
+#define __LITTLE_ENDIAN (1234)
+#define __BIG_ENDIAN (4321)
+#define __BYTE_ORDER __LITTLE_ENDIAN
+
+#include <stddef.h>
+#include <locale.h> //LC_MESSAGES
+#include <assert.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
+
+static inline void __attribute__((noreturn)) error(int status, int errnum, const char *fmt, ...)
+{
+ va_list lst;
+ va_start(lst, fmt);
+ vfprintf(stderr, fmt, lst);
+ fprintf(stderr, "error %d: %s\n", errnum, strerror(errno));
+ va_end(lst);
+ exit(status);
+}
+
+static inline char *dcgettext (char *__domainname, char *__msgid, int __category)
+{
+ error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__);
+ return NULL;
+}
+
+static inline size_t strnlen (const char *__string, size_t __maxlen)
+{
+ int len = 0;
+ while (__maxlen-- && *__string++)
+ len++;
+ return len;
+}
+
+static inline void *mempcpy (void * __dest, const void * __src, size_t __n)
+{
+ memcpy(__dest, __src, __n);
+ return ((char *)__dest) + __n;
+}
+
+#define __mempcpy mempcpy
+
+static inline wchar_t *wmempcpy (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n)
+{
+ error(EXIT_FAILURE, 0, "%s not implemented!", __FUNCTION__);
+ return NULL;
+}
+
+
+#define bswap_16 bswap16
+#define bswap_32 bswap32
+#define bswap_64 bswap64
+
+extern int ___libelf_fill_byte;
+
+#endif /*CONFIG_COMPAT_DARWIN_H*/
diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c
index 0395a940..066da041 100644
--- a/libelf/elf32_checksum.c
+++ b/libelf/elf32_checksum.c
@@ -20,7 +20,6 @@
#endif
#include <assert.h>
-//#include <endian.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>