64-bit emulator
Patch to allow emulator searches for emulator64-${ARCH} first on
64-bit OS. If none is found, the original behavior which searchs
for 32-bit emulator-${ARCH} is performed as usual.
64-bit emulator (which still emulates Android built in 32-bit) offers
up to 20% speedup compared to its 32-bit counterpart.
Details:
android/main-emulator.c
1) search emulator64 based on the OS
2) dlopen lib64OpenglRender in 64-bit
Makefile.*
1) Rules to build 64-bit executable emulator64-{x86,arm} and libraries
emulator64-{libui,libqemu,target-i386,target-arm,libelff,common}
2) remove -Wa,-32
3) Changes prebuit toolchain path
android-configure.h
android/build/common.h
1) no longer force 32-bit build (because now prebuilts/tools/gcc-sdk/gcc
can now handle 64-bit
2) set ANDROID_PREBUILTS to correctly locate ccache
android/config/*/config-host.h
1) Detect HOST_X86_64 and HOST_X86_64/HOST_I386
Misc 64-bit porting clean-up
1) use %zx to print variable of type size_t in hex
2) use %zu to print variable of type size_t in dec
3) Initialize query_parm to NULL
4) use PRIu64 to replace PDUd64
5) use PRId64/PRIu64/PRIX64 to print 64-bit
6) drop PRUx64 because PRIx64 does the same
7) cast pointer arith to intptr_t before casting to int
8) fixed 1ULL<<63
Change-Id: Ife62a20063a6ec38d4a9b23977e840af1fce149a
diff --git a/Makefile.android b/Makefile.android
index 22d7438..6fccf71 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -45,20 +45,23 @@
MY_LDLIBS :=
-# this is needed to build the emulator on 64-bit Linux systems
-ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
- MY_CFLAGS += -Wa,--32
-endif
-
ifeq ($(HOST_OS),freebsd)
- MY_CFLAGS += -Wa,--32 -I /usr/local/include
+ MY_CFLAGS += -I /usr/local/include
endif
ifeq ($(HOST_OS),windows)
- MY_CFLAGS += -D_WIN32
- # we need Win32 features that are available since Windows 2000 Professional/Server (NT 5.0)
+ # we need Win32 features that are available since Windows 2000 Professional/Server (NT 5.0)
MY_CFLAGS += -DWINVER=0x501
- MY_LDLIBS += -lvfw32
+ MY_CFLAGS += -D_WIN32
+ ifneq ($(BUILD_HOST_64bit),)
+ # Microsoft 64-bit compiler define both _WIN32 and _WIN64
+ MY_CFLAGS += -D_WIN64
+ # amd64-mingw32msvc- toolchain still name it vfw32. May change it once amd64-mingw32msvc-
+ # is stabilized
+ MY_LDLIBS += -lvfw32
+ else
+ MY_LDLIBS += -lvfw32
+ endif
endif
ifeq ($(HOST_ARCH),ppc)
@@ -91,17 +94,17 @@
# adequate values for HOST_CC
#
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
- # On Linux, use our custom 32-bit host toolchain, which contains the
- # relevant headers and 32-bit libraries for audio (The host 64-bit Lucid
- # doesn't provide these anymore, only their 64-bit versions).
+ # On Linux, use our custom 32-bit host toolchain (unless BUILD_HOST_64bit=1)
+ # which contains the relevant headers and 32-bit libraries for audio (The host 64-bit
+ # Lucid doesn't provide these anymore, only their 64-bit versions).
ifeq ($(HOST_OS),linux)
- HOST_SDK_TOOLCHAIN_PREFIX := prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/bin/i686-linux
+ HOST_SDK_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk
# Don't do anything if the toolchain is not there
- ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc)))
- MY_CC := $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc
- MY_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)-g++
- MY_AR := $(HOST_SDK_TOOLCHAIN_PREFIX)-ar
- endif # $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc exists
+ ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc)))
+ MY_CC := $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc
+ MY_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)/g++
+ MY_AR := $(HOST_SDK_TOOLCHAIN_PREFIX)/ar
+ endif # $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc exists
endif # HOST_OS == linux
ifneq ($(USE_CCACHE),)
@@ -109,6 +112,7 @@
ccache := $(strip $(wildcard $(ccache)))
ifneq ($(ccache),$(firstword $(MY_CC)))
MY_CC := $(ccache) $(MY_CC)
+ MY_CXX := $(ccache) $(MY_CXX)
endif
ccache :=
endif
@@ -116,9 +120,14 @@
ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true)
- ifneq ($(HOST_ARCH),x86_64)
- MY_CFLAGS += -m32
- MY_LDLIBS += -m32
+ ifneq ($(BUILD_HOST_64bit),)
+ MY_CFLAGS += -m64
+ MY_LDLIBS += -m64
+ else
+ ifneq ($(HOST_ARCH),x86_64)
+ MY_CFLAGS += -m32
+ MY_LDLIBS += -m32
+ endif
endif
endif
@@ -184,6 +193,8 @@
endif
ifeq ($(HOST_OS),windows)
+ # amd64-mingw32msvc- toolchain still name it ws2_32. May change it once amd64-mingw32msvc-
+ # is stabilized
QEMU_SYSTEM_LDLIBS += -lwinmm -lws2_32 -liphlpapi
else
QEMU_SYSTEM_LDLIBS += -lpthread