summaryrefslogtreecommitdiff
authorTanguy Pruvot <tanguy.pruvot@gmail.com>2014-11-07 11:33:48 (GMT)
committer Tanguy Pruvot <tanguy.pruvot@gmail.com>2014-11-07 13:20:29 (GMT)
commit0d6f1493013fc6f2bef823c8d238ae16235a9568 (patch)
tree37c9255e93cd3d8f3c87416ebac8f5933f01bd65
parentedbd464a9401b9c90671ec4b48fabdee85ab4713 (diff)
downloadbusybox-0d6f1493013fc6f2bef823c8d238ae16235a9568.zip
busybox-0d6f1493013fc6f2bef823c8d238ae16235a9568.tar.gz
busybox-0d6f1493013fc6f2bef823c8d238ae16235a9568.tar.bz2
Android: Fix for 64bit arm and x86_64 targets
tested on kitkat arm and lollipop x86_64/arm64 Change-Id: I6049c7d935f08db51bea8f3fb98fe025171f2ef9
Diffstat
-rw-r--r--Android.mk9
-rw-r--r--android/libc/__set_errno.c4
-rw-r--r--android/librpc/bindresvport.c2
-rw-r--r--busybox-full.sources1
-rw-r--r--busybox-minimal.sources1
-rw-r--r--include/android.h2
-rw-r--r--include/libbb.h2
-rw-r--r--shell/ash.c6
8 files changed, 13 insertions, 14 deletions
diff --git a/Android.mk b/Android.mk
index f5f6d73..a6f4f2a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -32,10 +32,10 @@ LOCAL_PATH := $(BB_PATH)
include $(CLEAR_VARS)
# Explicitly set an architecture specific CONFIG_CROSS_COMPILER_PREFIX
-ifeq ($(TARGET_ARCH),arm)
+ifneq ($(filter arm arm64,$(TARGET_ARCH)),)
BUSYBOX_CROSS_COMPILER_PREFIX := arm-linux-androideabi-
endif
-ifeq ($(TARGET_ARCH),x86)
+ifneq ($(filter x86 x86_64,$(TARGET_ARCH)),)
BUSYBOX_CROSS_COMPILER_PREFIX := $(if $(filter x86_64,$(HOST_ARCH)),x86_64,i686)-linux-android-
endif
ifeq ($(TARGET_ARCH),mips)
@@ -93,8 +93,6 @@ endif
ifneq ($(filter arm x86 mips,$(TARGET_ARCH)),)
BUSYBOX_SRC_FILES += \
$(addprefix android/libc/arch-$(TARGET_ARCH)/syscalls/,$(BUSYBOX_ASM_FILES))
-else
- $(error $(TARGET_ARCH) is not supported)
endif
BUSYBOX_C_INCLUDES = \
@@ -162,9 +160,6 @@ include $(CLEAR_VARS)
BUSYBOX_CONFIG:=full
BUSYBOX_SUFFIX:=bionic
LOCAL_SRC_FILES := $(BUSYBOX_SRC_FILES)
-ifeq ($(BIONIC_ICS),true)
-LOCAL_SRC_FILES += android/libc/__set_errno.c
-endif
LOCAL_C_INCLUDES := $(bb_gen)/full/include $(BUSYBOX_C_INCLUDES)
LOCAL_CFLAGS := $(BUSYBOX_CFLAGS)
LOCAL_ASFLAGS := $(BUSYBOX_AFLAGS)
diff --git a/android/libc/__set_errno.c b/android/libc/__set_errno.c
index 163d404..e952363 100644
--- a/android/libc/__set_errno.c
+++ b/android/libc/__set_errno.c
@@ -29,7 +29,7 @@
#include <errno.h>
-int __set_errno(int n)
+long __set_errno(int n)
{
errno = n;
return -1;
@@ -41,7 +41,7 @@ int __set_errno(int n)
*/
__LIBC_HIDDEN__
-int __set_syscall_errno(int n)
+long __set_syscall_errno(int n)
{
/* some syscalls, mmap() for example, have valid return
** values that are "negative". Since errno values are not
diff --git a/android/librpc/bindresvport.c b/android/librpc/bindresvport.c
index b526e34..0181612 100644
--- a/android/librpc/bindresvport.c
+++ b/android/librpc/bindresvport.c
@@ -38,7 +38,7 @@
#include <string.h>
#ifdef ANDROID
#include <rpc/types.h>
-extern int __set_errno(int n);
+extern long __set_errno(int n);
#else
#include <sys/types.h>
#endif
diff --git a/busybox-full.sources b/busybox-full.sources
index 789b12d..bd5b59c 100644
--- a/busybox-full.sources
+++ b/busybox-full.sources
@@ -1,3 +1,4 @@
+android/libc/__set_errno.c
archival/bbunzip.c archival/bzip2.c archival/cpio.c archival/gzip.c
archival/libarchive/lzo1x_1.c archival/libarchive/lzo1x_1o.c archival/libarchive/lzo1x_9x.c archival/libarchive/lzo1x_d.c archival/lzop.c
diff --git a/busybox-minimal.sources b/busybox-minimal.sources
index 6445ff2..84950cf 100644
--- a/busybox-minimal.sources
+++ b/busybox-minimal.sources
@@ -1,3 +1,4 @@
+android/libc/__set_errno.c
archival/bbunzip.c archival/bzip2.c archival/cpio.c archival/gzip.c archival/libarchive/lzo1x_1.c archival/libarchive/lzo1x_1o.c archival/libarchive/lzo1x_d.c archival/lzop.c archival/tar.c archival/unzip.c
archival/libarchive/data_align.c archival/libarchive/data_extract_all.c archival/libarchive/data_extract_to_stdout.c archival/libarchive/data_skip.c archival/libarchive/decompress_bunzip2.c archival/libarchive/decompress_gunzip.c archival/libarchive/filter_accept_all.c archival/libarchive/filter_accept_list.c archival/libarchive/filter_accept_reject_list.c archival/libarchive/find_list_entry.c archival/libarchive/get_header_cpio.c archival/libarchive/get_header_tar.c archival/libarchive/get_header_tar_bz2.c archival/libarchive/get_header_tar_gz.c archival/libarchive/header_list.c archival/libarchive/header_skip.c archival/libarchive/header_verbose_list.c archival/libarchive/init_handle.c archival/libarchive/open_transformer.c archival/libarchive/seek_by_jump.c archival/libarchive/seek_by_read.c archival/libarchive/decompress_unlzma.c archival/libarchive/decompress_unxz.c
diff --git a/include/android.h b/include/android.h
index dbf17cd..651f7df 100644
--- a/include/android.h
+++ b/include/android.h
@@ -83,8 +83,10 @@ char *hasmntopt(const struct mntent *, const char *);
/* bionic's vfork is rather broken; for now a terrible bandaid: */
#define vfork fork
+#if !defined(BIONIC_L) && !defined(BLOATCHECK)
#define _SOCKLEN_T_DECLARED
typedef int socklen_t;
+#endif
/* wait3 was removed in android L */
#ifdef BIONIC_L
diff --git a/include/libbb.h b/include/libbb.h
index 3730474..2884506 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -271,7 +271,7 @@ struct BUG_off_t_size_is_misdetected {
char BUG_off_t_size_is_misdetected[sizeof(off_t) == sizeof(uoff_t) ? 1 : -1];
};
-#ifdef __BIONIC__
+#if defined(__BIONIC__) && !defined(__LP64__)
/* bionic uses stat64 which has long long file sizes, whereas off_t is only long bits */
typedef long long filesize_t;
#define FILESIZE_FMT "ll"
diff --git a/shell/ash.c b/shell/ash.c
index f9d5f38..c79ef74 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2212,10 +2212,10 @@ setvar(const char *name, const char *val, int flags)
INT_OFF;
nameeq = ckmalloc(namelen + vallen + 2);
- p = (char*) ((uint32_t) memcpy(nameeq, name, namelen) + namelen);
+ p = (char*) ((uintptr_t) memcpy(nameeq, name, namelen) + namelen);
if (val) {
*p++ = '=';
- p = (char*) ((uint32_t) memcpy(p, val, vallen) + vallen);
+ p = (char*) ((uintptr_t) memcpy(p, val, vallen) + vallen);
}
*p = '\0';
setvareq(nameeq, flags | VNOSAVE);
@@ -6350,7 +6350,7 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
#if ENABLE_ASH_BASH_COMPAT
case VSSUBSTR:
- loc = str = (char*) ((uint32_t) stackblock() + strloc);
+ loc = str = (char*) ((uintptr_t) stackblock() + strloc);
/* Read POS in ${var:POS:LEN} */
pos = atoi(loc); /* number(loc) errors out on "1:4" */
len = str - startp - 1;