Remove ExtractCodeAndPrelink and switch Portable to MCLinker
Change-Id: Ia2459c7da6b79e0a1c0f1148c6e28ad9cbbe27a2
diff --git a/build/Android.common.mk b/build/Android.common.mk
index f30cf01..43755b4 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -141,7 +141,6 @@
src/common_throws.cc \
src/compiled_method.cc \
src/compiler/driver/compiler_driver.cc \
- src/compiler/llvm/procedure_linkage_table.cc \
src/compiler/llvm/runtime_support_llvm.cc \
src/debugger.cc \
src/dex_file.cc \
@@ -379,6 +378,7 @@
src/compiler/jni/jni_compiler_test.cc \
src/dex_file_test.cc \
src/dex_instruction_visitor_test.cc \
+ src/dex_method_iterator_test.cc \
src/elf_writer_test.cc \
src/exception_test.cc \
src/gc/space_bitmap_test.cc \
@@ -447,15 +447,21 @@
ART_BUILD_TARGET := false
ART_BUILD_HOST := false
+ART_BUILD_NDEBUG := false
+ART_BUILD_DEBUG := false
ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
ART_BUILD_TARGET := true
+ ART_BUILD_NDEBUG := true
endif
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
ART_BUILD_TARGET := true
+ ART_BUILD_DEBUG := true
endif
ifeq ($(ART_BUILD_HOST_NDEBUG),true)
ART_BUILD_HOST := true
+ ART_BUILD_NDEBUG := true
endif
ifeq ($(ART_BUILD_HOST_DEBUG),true)
ART_BUILD_HOST := true
+ ART_BUILD_DEBUG := true
endif
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index 730c980..afb335e 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -112,13 +112,20 @@
$(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
$(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
endif
-ifeq ($(ART_BUILD_HOST_NDEBUG),true)
+
+# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
+ifeq ($(ART_BUILD_NDEBUG),true)
$(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
+endif
+ifeq ($(ART_BUILD_NDEBUG),true)
+ $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
+endif
+
+ifeq ($(ART_BUILD_HOST_NDEBUG),true)
$(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
$(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
endif
ifeq ($(ART_BUILD_HOST_DEBUG),true)
- $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
$(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
$(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
endif
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk
index 9e11e22..8f0ccf8 100644
--- a/build/Android.libart-compiler.mk
+++ b/build/Android.libart-compiler.mk
@@ -48,6 +48,7 @@
src/compiler/dex/ralloc.cc \
src/compiler/dex/ssa_transformation.cc \
src/compiler/dex/write_elf.cc \
+ src/compiler/driver/dex_compilation_unit.cc \
src/compiler/invoke_stubs/portable/stub_compiler.cc \
src/compiler/invoke_stubs/quick/jni_internal_arm.cc \
src/compiler/invoke_stubs/quick/jni_internal_mips.cc \
@@ -184,9 +185,22 @@
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
$(eval $(call build-libart-compiler,target,debug))
endif
-ifeq ($(ART_BUILD_HOST_NDEBUG),true)
+# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
+ifeq ($(ART_BUILD_NDEBUG),true)
$(eval $(call build-libart-compiler,host,ndebug))
endif
-ifeq ($(ART_BUILD_HOST_DEBUG),true)
+ifeq ($(ART_BUILD_DEBUG),true)
$(eval $(call build-libart-compiler,host,debug))
endif
+
+# Rule to build /system/lib/libcompiler-rt.a
+# Usually static libraries are not installed on the device.
+ifeq ($(ART_USE_PORTABLE_COMPILER),true)
+ifeq ($(ART_BUILD_TARGET),true)
+# TODO: Move to external/compiler-rt
+$(eval $(call copy-one-file, $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler-rt,,)/libcompiler-rt.a, $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a))
+
+$(DEX2OAT): $(TARGET_OUT_SHARED_LIBRARIES)/libcompiler-rt.a
+
+endif
+endif
diff --git a/build/Android.libart.mk b/build/Android.libart.mk
index 630f05a..67461be 100644
--- a/build/Android.libart.mk
+++ b/build/Android.libart.mk
@@ -120,9 +120,11 @@
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
$(eval $(call build-libart,target,debug))
endif
-ifeq ($(ART_BUILD_HOST_NDEBUG),true)
+
+# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
+ifeq ($(ART_BUILD_NDEBUG),true)
$(eval $(call build-libart,host,ndebug))
endif
-ifeq ($(ART_BUILD_HOST_DEBUG),true)
+ifeq ($(ART_BUILD_DEBUG),true)
$(eval $(call build-libart,host,debug))
endif
diff --git a/build/Android.oat.mk b/build/Android.oat.mk
index b4e1266..feeede5 100644
--- a/build/Android.oat.mk
+++ b/build/Android.oat.mk
@@ -16,11 +16,19 @@
# DEX2OAT defined in build/core/config.mk
DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
+
+LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX)
+LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX)
+
# TODO: for now, override with debug version for better error reporting
DEX2OAT := $(DEX2OATD)
+LIBART_COMPILER := $(LIBARTD_COMPILER)
-DEX2OAT_DEPENDENCY := | $(DEX2OAT) # by default, do not run rerun dex2oat if the tool changes
-# DEX2OAT_DEPENDENCY := $(DEX2OAT) # uncomment to force dex2oat to rerun on after all changes
+# By default, do not run rerun dex2oat if the tool changes.
+# Comment out the | to force dex2oat to rerun on after all changes.
+DEX2OAT_DEPENDENCY := |
+DEX2OAT_DEPENDENCY += $(DEX2OAT)
+DEX2OAT_DEPENDENCY += $(LIBART_COMPILER)
OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
@@ -52,7 +60,7 @@
$(HOST_CORE_IMG_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY)
@echo "host dex2oat: $@ ($?)"
@mkdir -p $(dir $@)
- $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(IMG_HOST_BASE_ADDRESS) --instruction-set=$(HOST_ARCH)
+ $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(IMG_HOST_BASE_ADDRESS) --instruction-set=$(HOST_ARCH) --host
$(TARGET_CORE_IMG_OUT): $(TARGET_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY)
@echo "target dex2oat: $@ ($?)"
@@ -80,18 +88,22 @@
TARGET_BOOT_IMG_OUT := $(DEFAULT_DEX_PREOPT_IMAGE)
TARGET_BOOT_OAT_OUT := $(patsubst %.art,%.oat,$(TARGET_BOOT_IMG_OUT))
TARGET_BOOT_OAT := $(subst $(PRODUCT_OUT),,$(TARGET_BOOT_OAT_OUT))
+TARGET_BOOT_OAT_UNSTRIPPED_OUT := $(TARGET_OUT_UNSTRIPPED)$(TARGET_BOOT_OAT)
$(TARGET_BOOT_IMG_OUT): $(TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY)
@echo "target dex2oat: $@ ($?)"
@mkdir -p $(dir $@)
- $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(TARGET_BOOT_DEX_FILES)) $(addprefix --dex-location=,$(TARGET_BOOT_DEX_LOCATIONS)) --oat-file=$(TARGET_BOOT_OAT_OUT) --oat-location=$(TARGET_BOOT_OAT) --image=$(TARGET_BOOT_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --instruction-set=$(TARGET_ARCH) --host-prefix=$(PRODUCT_OUT)
+ @mkdir -p $(dir $(TARGET_BOOT_OAT_UNSTRIPPED_OUT))
+ $(hide) $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) $(addprefix --dex-file=,$(TARGET_BOOT_DEX_FILES)) $(addprefix --dex-location=,$(TARGET_BOOT_DEX_LOCATIONS)) --oat-symbols=$(TARGET_BOOT_OAT_UNSTRIPPED_OUT) --oat-file=$(TARGET_BOOT_OAT_OUT) --oat-location=$(TARGET_BOOT_OAT) --image=$(TARGET_BOOT_IMG_OUT) --base=$(IMG_TARGET_BASE_ADDRESS) --instruction-set=$(TARGET_ARCH) --host-prefix=$(PRODUCT_OUT)
-$(TARGET_BOOT_OAT_OUT): $(TARGET_BOOT_IMG_OUT)
+$(TARGET_BOOT_OAT_UNSTRIPPED_OUT): $(TARGET_BOOT_IMG_OUT)
-ifeq ($(ART_BUILD_TARGET),true)
+$(TARGET_BOOT_OAT_OUT): $(TARGET_BOOT_OAT_UNSTRIPPED_OUT)
+
+ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
include $(CLEAR_VARS)
LOCAL_MODULE := boot.art
LOCAL_MODULE_TAGS := optional
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_BOOT_IMG_OUT)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_BOOT_IMG_OUT) $(TARGET_BOOT_OAT_OUT)
include $(BUILD_PHONY_PACKAGE)
endif
diff --git a/build/Android.oattest.mk b/build/Android.oattest.mk
index 744a01d..c2163bd 100644
--- a/build/Android.oattest.mk
+++ b/build/Android.oattest.mk
@@ -23,27 +23,31 @@
# $(2): input test directory
# $(3): target output module path (default module path is used on host)
define build-art-test-dex
- include $(CLEAR_VARS)
- LOCAL_MODULE := $(1)-$(2)
- LOCAL_MODULE_TAGS := tests
- LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2))
- LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
- LOCAL_NO_STANDARD_LIBRARIES := true
- LOCAL_MODULE_PATH := $(3)
- LOCAL_DEX_PREOPT_IMAGE := $(TARGET_CORE_IMG_OUT)
- LOCAL_DEX_PREOPT := false
- include $(BUILD_JAVA_LIBRARY)
- ART_TEST_TARGET_DEX_FILES += $(3)/$$(LOCAL_MODULE).jar
+ ifeq ($(ART_BUILD_TARGET),true)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := $(1)-$(2)
+ LOCAL_MODULE_TAGS := tests
+ LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2))
+ LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS)
+ LOCAL_NO_STANDARD_LIBRARIES := true
+ LOCAL_MODULE_PATH := $(3)
+ LOCAL_DEX_PREOPT_IMAGE := $(TARGET_CORE_IMG_OUT)
+ LOCAL_DEX_PREOPT := false
+ include $(BUILD_JAVA_LIBRARY)
+ ART_TEST_TARGET_DEX_FILES += $(3)/$$(LOCAL_MODULE).jar
+ endif
- include $(CLEAR_VARS)
- LOCAL_MODULE := $(1)-$(2)
- LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2))
- LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
- LOCAL_NO_STANDARD_LIBRARIES := true
- LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_OUT)
- LOCAL_BUILD_HOST_DEX := true
- include $(BUILD_HOST_JAVA_LIBRARY)
- ART_TEST_HOST_DEX_FILES += $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE).jar
+ ifeq ($(ART_BUILD_HOST),true)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := $(1)-$(2)
+ LOCAL_SRC_FILES := $(call all-java-files-under, test/$(2))
+ LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS)
+ LOCAL_NO_STANDARD_LIBRARIES := true
+ LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_OUT)
+ LOCAL_BUILD_HOST_DEX := true
+ include $(BUILD_HOST_JAVA_LIBRARY)
+ ART_TEST_HOST_DEX_FILES += $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE).jar
+ endif
endef
$(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-test-dex,$(dir),$(ART_NATIVETEST_OUT))))
$(foreach dir,$(TEST_OAT_DIRECTORIES), $(eval $(call build-art-test-dex,oat-test-dex,$(dir),$(ART_TEST_OUT))))
@@ -66,7 +70,7 @@
$(hide) rm /tmp/test-art-target-oat-$(1)
$(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat: $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar $(HOST_CORE_IMG_OUT) | $(DEX2OAT)
- $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$$< --oat-file=$$@ --instruction-set=$(HOST_ARCH) --host-prefix=""
+ $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --boot-image=$(HOST_CORE_IMG_OUT) --dex-file=$$< --oat-file=$$@ --instruction-set=$(HOST_ARCH) --host --host-prefix=""
.PHONY: test-art-host-oat-$(1)
test-art-host-oat-$(1): $(HOST_OUT_JAVA_LIBRARIES)/oat-test-dex-$(1).jar.oat test-art-host-dependencies