summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-03-10 21:55:51 -0800
committerShih-wei Liao <sliao@google.com>2012-03-13 10:26:51 -0700
commitc4c9881e5d22432f3f1a30eeec5aa109dfc08a7d (patch)
tree98f1125db961451699880019c8663d76e7b94d02 /build
parent1580379bb02ee7866ca94d54851a4d08de12a5a4 (diff)
downloadart-c4c9881e5d22432f3f1a30eeec5aa109dfc08a7d.zip
art-c4c9881e5d22432f3f1a30eeec5aa109dfc08a7d.tar.gz
art-c4c9881e5d22432f3f1a30eeec5aa109dfc08a7d.tar.bz2
Fix the LLVM build. Separate out libart-compiler-llvm.so.
After this refactoring: If (!USE_LLVM_COMPILER), I pass the test-art and boot the phone alright. The behavior is the same for non-LLVM builds as before. Multi-target art-compiler shared libraries are generated as before. If (USE_LLVM_COMPILER), I generate libart-compiler-llvm.so successfully. Note that the ideal refactoring for the next step will be to always build art-compiler and LLVM-[arm|mips|x86] shared libraries. Currently, we haven't removed all the ifdefs for libart.so yet, so this is not ideal yet. Reason for not-done-yet is that the next step requires discussions. I can remove all the ifdefs today, but then the (!USE_LLVM_COMPILER) build will incur extra fields and overhead. This refactoring allows us to restore the LLVM build situation to be before the breakage yesterday, so we can continue making forward progress again. One difficulty in the refactoring is that LLVM is not a method compiler in default, unlike (!USE_LLVM_COMPILER). LLVM actually compiles an LLVM module at a time normally. So we need to do more call backs and tell libart-compiler-llvm.so in each invocation where we are in terms of OatCompilationUnit. Another difficulty is that currently our LLVM compiler is not multithreaded and requires locking, unlike (!USE_LLVM_COMPILER). So more callbacks are needed. This will be fixed when we fix the multithreading issue. Change-Id: I93bce21b6d673254188f2a60b1a7f91b508e497f
Diffstat (limited to 'build')
-rw-r--r--build/Android.common.mk13
-rw-r--r--build/Android.executable.mk10
-rw-r--r--build/Android.gtest.mk10
-rw-r--r--build/Android.libart-compiler-llvm.mk198
-rw-r--r--build/Android.libart.mk15
5 files changed, 225 insertions, 21 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk
index 7d9ef81..df4c5a9 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -56,10 +56,6 @@ art_cflags := \
-fno-align-jumps \
-fstrict-aliasing
-ifeq ($(ART_USE_LLVM_COMPILER),true)
-art_cflags += -DART_USE_LLVM_COMPILER=1
-endif
-
ifeq ($(HOST_OS),linux)
art_non_debug_cflags := \
-Wframe-larger-than=1728
@@ -206,17 +202,8 @@ LIBART_COMMON_SRC_FILES := \
ifeq ($(ART_USE_LLVM_COMPILER),true)
LIBART_COMMON_SRC_FILES += \
- src/compiler_llvm/compilation_unit.cc \
- src/compiler_llvm/compiler_llvm.cc \
- src/compiler_llvm/dalvik_reg.cc \
- src/compiler_llvm/frontend.cc \
- src/compiler_llvm/generated/art_module.cc \
src/compiler_llvm/inferred_reg_category_map.cc \
- src/compiler_llvm/ir_builder.cc \
- src/compiler_llvm/jni_compiler.cc \
- src/compiler_llvm/method_compiler.cc \
src/compiler_llvm/runtime_support_llvm.cc \
- src/compiler_llvm/upcall_compiler.cc \
src/compiler_llvm/utils_llvm.cc
endif
diff --git a/build/Android.executable.mk b/build/Android.executable.mk
index cc71aac..5f139ee 100644
--- a/build/Android.executable.mk
+++ b/build/Android.executable.mk
@@ -17,6 +17,11 @@
ART_HOST_EXECUTABLES :=
ART_TARGET_EXECUTABLES :=
+ART_EXECUTABLES_CFLAGS :=
+ifeq ($(ART_USE_LLVM_COMPILER),true)
+ ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1
+endif
+
# $(1): executable ("d" will be appended for debug version)
# $(2): source
# $(3): target or host
@@ -55,15 +60,16 @@ define build-art-executable
LOCAL_MODULE := $$(art_executable)d
endif
+ LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
+ LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
ifeq ($$(art_ndebug_or_debug),debug)
LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
else
LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
endif
else # host
- LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
+ LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
ifeq ($$(art_ndebug_or_debug),debug)
LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
else
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index c44a5e3..c85b170 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -19,6 +19,11 @@ ART_TARGET_TEST_EXECUTABLES :=
ART_HOST_TEST_TARGETS :=
ART_TARGET_TEST_TARGETS :=
+ART_TEST_CFLAGS :=
+ifeq ($(ART_USE_LLVM_COMPILER),true)
+ ART_TEST_CFLAGS += -DART_USE_LLVM_COMPILER=1
+endif
+
# $(1): target or host
# $(2): file name
define build-art-test
@@ -61,8 +66,9 @@ define build-art-test
LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClass_bar -Wl,-u,Java_MyClass_sbar
endif
+ LOCAL_CFLAGS := $(ART_TEST_CFLAGS)
ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS)
+ LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS)
LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libstlport libz
LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
LOCAL_MODULE_PATH := $(ART_NATIVETEST_OUT)
@@ -70,7 +76,7 @@ define build-art-test
art_gtest_exe := $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE)
ART_TARGET_TEST_EXECUTABLES += $$(art_gtest_exe)
else # host
- LOCAL_CFLAGS := $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
+ LOCAL_CFLAGS += $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS)
LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host
# glibc complains about double frees if you include both libraries, but Mac OS
# complains about unresolved symbols if you don't!
diff --git a/build/Android.libart-compiler-llvm.mk b/build/Android.libart-compiler-llvm.mk
new file mode 100644
index 0000000..bb7b458
--- /dev/null
+++ b/build/Android.libart-compiler-llvm.mk
@@ -0,0 +1,198 @@
+#
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+LIBART_COMPILER_LLVM_CFLAGS := -DART_USE_LLVM_COMPILER=1
+
+LIBART_COMPILER_LLVM_SRC_FILES += \
+ src/compiler_llvm/compilation_unit.cc \
+ src/compiler_llvm/compiler_llvm.cc \
+ src/compiler_llvm/dalvik_reg.cc \
+ src/compiler_llvm/frontend.cc \
+ src/compiler_llvm/generated/art_module.cc \
+ src/compiler_llvm/inferred_reg_category_map.cc \
+ src/compiler_llvm/ir_builder.cc \
+ src/compiler_llvm/jni_compiler.cc \
+ src/compiler_llvm/method_compiler.cc \
+ src/compiler_llvm/runtime_support_llvm.cc \
+ src/compiler_llvm/upcall_compiler.cc \
+ src/compiler_llvm/utils_llvm.cc
+
+# $(1): target or host
+# $(2): ndebug or debug
+# $(3): architecture name
+# $(4): list of source files
+define build-libart-compiler-llvm
+ ifneq ($(1),target)
+ ifneq ($(1),host)
+ $$(error expected target or host for argument 1, received $(1))
+ endif
+ endif
+ ifneq ($(2),ndebug)
+ ifneq ($(2),debug)
+ $$(error expected ndebug or debug for argument 2, received $(2))
+ endif
+ endif
+
+ art_target_or_host := $(1)
+ art_ndebug_or_debug := $(2)
+ libart_compiler_llvm_src_files := $(3)
+
+ include $(CLEAR_VARS)
+ ifeq ($$(art_target_or_host),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ ifeq ($$(art_ndebug_or_debug),ndebug)
+ LOCAL_MODULE := libart-compiler-llvm
+ else # debug
+ LOCAL_MODULE := libartd-compiler-llvm
+ endif
+
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+ LOCAL_SRC_FILES := $(libart_compiler_llvm_src_files)
+ LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
+ else # host
+ LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
+ endif
+
+ LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
+ LOCAL_C_INCLUDES += frameworks/compile/linkloader
+ libart_compiler_llvm_arm_STATIC_LIBRARIES := \
+ libLLVMARMInfo \
+ libLLVMARMDisassembler \
+ libLLVMARMAsmParser \
+ libLLVMARMAsmPrinter \
+ libLLVMARMCodeGen \
+ libLLVMARMDesc
+
+ libart_compiler_llvm_mips_STATIC_LIBRARIES := \
+ libLLVMMipsInfo \
+ libLLVMMipsCodeGen \
+ libLLVMMipsDesc \
+ libLLVMMipsAsmPrinter \
+
+ libart_compiler_llvm_x86_STATIC_LIBRARIES := \
+ libLLVMX86Info \
+ libLLVMX86AsmParser \
+ libLLVMX86CodeGen \
+ libLLVMX86Disassembler \
+ libLLVMX86Desc \
+ libLLVMX86AsmPrinter \
+ libLLVMX86Utils
+
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_STATIC_LIBRARIES += \
+ $$(libart_compiler_llvm_arm_STATIC_LIBRARIES)
+ else
+ LOCAL_STATIC_LIBRARIES += \
+ $$(libart_compiler_llvm_arm_STATIC_LIBRARIES) \
+ $$(libart_compiler_llvm_mips_STATIC_LIBRARIES) \
+ $$(libart_compiler_llvm_x86_STATIC_LIBRARIES)
+ endif
+
+ LOCAL_STATIC_LIBRARIES += \
+ libLLVMLinker \
+ libLLVMipo \
+ libLLVMBitWriter \
+ libLLVMBitReader \
+ libLLVMAsmPrinter \
+ libLLVMSelectionDAG \
+ libLLVMCodeGen \
+ libLLVMScalarOpts \
+ libLLVMInstCombine \
+ libLLVMInstrumentation \
+ libLLVMTransformUtils \
+ libLLVMipa \
+ libLLVMAnalysis \
+ libLLVMTarget \
+ libLLVMMC \
+ libLLVMMCParser \
+ libLLVMCore \
+ libLLVMSupport \
+ librsloader
+ LOCAL_SHARED_LIBRARIES := liblog libnativehelper
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
+ LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
+ LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
+ else # host
+ LOCAL_STATIC_LIBRARIES += libcutils
+ LOCAL_SHARED_LIBRARIES += libz-host
+ LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
+ LOCAL_LDLIBS := -ldl -lpthread
+ ifeq ($(HOST_OS),linux)
+ LOCAL_LDLIBS += -lrt
+ endif
+ endif
+ ifeq ($$(art_ndebug_or_debug),debug)
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
+ else # host
+ LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
+ endif
+ LOCAL_SHARED_LIBRARIES += libartd
+ else
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
+ else # host
+ LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
+ endif
+ LOCAL_SHARED_LIBRARIES += libart
+ endif
+ ifeq ($$(art_target_or_host),target)
+ include $(LLVM_GEN_INTRINSICS_MK)
+ include $(LLVM_DEVICE_BUILD_MK)
+ include $(BUILD_SHARED_LIBRARY)
+ else # host
+ LOCAL_IS_HOST_MODULE := true
+ include $(LLVM_GEN_INTRINSICS_MK)
+ include $(LLVM_HOST_BUILD_MK)
+ include $(BUILD_HOST_SHARED_LIBRARY)
+ endif
+
+ ifeq ($$(art_target_or_host),target)
+ ifeq ($$(art_ndebug_or_debug),debug)
+ $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
+ else
+ $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
+ endif
+ else # host
+ ifeq ($$(art_ndebug_or_debug),debug)
+ $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
+ else
+ $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
+ endif
+ endif
+
+endef
+
+ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
+ $(eval $(call build-libart-compiler-llvm,target,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
+endif
+ifeq ($(ART_BUILD_TARGET_DEBUG),true)
+ $(eval $(call build-libart-compiler-llvm,target,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
+endif
+ifeq ($(ART_BUILD_HOST_NDEBUG),true)
+ $(eval $(call build-libart-compiler-llvm,host,ndebug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
+endif
+ifeq ($(ART_BUILD_HOST_DEBUG),true)
+ $(eval $(call build-libart-compiler-llvm,host,debug,$(LIBART_COMPILER_LLVM_SRC_FILES)))
+endif
diff --git a/build/Android.libart.mk b/build/Android.libart.mk
index db05eac..5bc8f46 100644
--- a/build/Android.libart.mk
+++ b/build/Android.libart.mk
@@ -14,6 +14,11 @@
# limitations under the License.
#
+LIBART_CFLAGS :=
+ifeq ($(ART_USE_LLVM_COMPILER),true)
+ LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1
+endif
+
# $(1): target or host
# $(2): ndebug or debug
define build-libart
@@ -50,10 +55,12 @@ define build-libart
else # host
LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
endif
+
+ LOCAL_CFLAGS := $(LIBART_CFLAGS)
ifeq ($$(art_target_or_host),target)
- LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
+ LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
else # host
- LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
+ LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
endif
ifeq ($$(art_ndebug_or_debug),debug)
ifeq ($$(art_target_or_host),target)
@@ -72,6 +79,7 @@ define build-libart
LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
ifeq ($(ART_USE_LLVM_COMPILER),true)
LOCAL_C_INCLUDES += frameworks/compile/linkloader
+ LOCAL_STATIC_LIBRARIES += librsloader
libart_arm_STATIC_LIBRARIES := \
libLLVMARMInfo \
libLLVMARMDisassembler \
@@ -123,8 +131,7 @@ define build-libart
libLLVMMC \
libLLVMMCParser \
libLLVMCore \
- libLLVMSupport \
- librsloader
+ libLLVMSupport
endif
LOCAL_SHARED_LIBRARIES := liblog libnativehelper
ifeq ($$(art_target_or_host),target)