From 1a6f09a48c2047a6611b3f01088530b2ec895f7b Mon Sep 17 00:00:00 2001 From: Tim Murray Date: Tue, 5 Mar 2013 11:07:15 -0800 Subject: [PATCH] Add support for multiple architectures with RS compat lib. Change-Id: I310f6f72e1124c06e9c59b0f59d33f168dc1e632 --- core/config.mk | 8 +++++++- core/definitions.mk | 6 +++--- core/java.mk | 18 +----------------- core/llvm_config.mk | 3 +++ 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/core/config.mk b/core/config.mk index d8d7871093..be2c23b236 100644 --- a/core/config.mk +++ b/core/config.mk @@ -443,4 +443,10 @@ INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/publi # objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so TARGET_PREBUILT_TAG := android-$(TARGET_ARCH) -include $(BUILD_SYSTEM)/dumpvar.mk +# Set up RS prebuilt variables for compatibility library + +RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libclcore.bc +RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib +RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a + +include $(BUILD_SYSTEM)/dumpvar.mk \ No newline at end of file diff --git a/core/definitions.mk b/core/definitions.mk index e895f95b1a..2cf5283c33 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -826,13 +826,13 @@ define transform-bc-to-so @echo "Renderscript compatibility: $(notdir $@) <= $(notdir $<)" $(hide) mkdir -p $(dir $@) $(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \ - -rt-path $(PRIVATE_LIBCLCORE) $< + -rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_TRIPLE) $< $(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \ -Wl,-rpath,\$$ORIGIN/../lib \ $(dir $@)/$(notdir $(<:.bc=.o)) \ - $(PRIVATE_COMPILER_RT) \ + $(RS_PREBUILT_COMPILER_RT) \ -o $@ -L prebuilts/gcc/ \ - -L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(PRIVATE_LIBPATH) \ + -L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(RS_PREBUILT_LIBPATH) \ -lRSSupport -lm endef diff --git a/core/java.mk b/core/java.mk index 22b4e75cc8..da670f94d9 100644 --- a/core/java.mk +++ b/core/java.mk @@ -196,10 +196,6 @@ $(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api) $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) $(transform-renderscripts-to-java-and-bc) -# Now LOCAL_RENDERSCRIPT_COMPATIBILITY only supports arm -ifneq ($(TARGET_ARCH),arm) -LOCAL_RENDERSCRIPT_COMPATIBILITY := -endif ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),) bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources)))) rs_generated_bc := $(addprefix \ @@ -212,26 +208,14 @@ rs_compatibility_jni_libs := $(addprefix \ $(rs_generated_bc) : $(RenderScript_file_stamp) -ifeq (,$(TARGET_BUILD_APPS)) -rs_built_clcore := $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libclcore.bc_intermediates/libclcore.bc -rs_extra_libpath := -rs_compiler_rt := $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler_rt)/libcompiler_rt.a -else -rs_built_clcore := prebuilts/sdk/renderscript/lib/libclcore.bc -rs_extra_libpath := -L prebuilts/ndk/8/platforms/android-9/arch-arm/usr/lib -rs_compiler_rt := prebuilts/sdk/renderscript/lib/libcompiler_rt.a -endif # TARGET_BUILD_APPS rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so LOCAL_JNI_SHARED_LIBRARIES += libRSSupport librsjni -$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(rs_built_clcore) \ +$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \ $(rs_support_lib) $(rs_jni_lib) $(rs_compiler_rt) $(rs_compatibility_jni_libs): | $(BCC_COMPAT) $(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX) -$(rs_compatibility_jni_libs): PRIVATE_LIBCLCORE := $(rs_built_clcore) -$(rs_compatibility_jni_libs): PRIVATE_COMPILER_RT := $(rs_compiler_rt) -$(rs_compatibility_jni_libs): PRIVATE_LIBPATH := $(rs_extra_libpath) $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \ $(renderscript_intermediate.COMMON)/res/raw/%.bc $(transform-bc-to-so) diff --git a/core/llvm_config.mk b/core/llvm_config.mk index 2f59edd709..7d1c4e1f90 100644 --- a/core/llvm_config.mk +++ b/core/llvm_config.mk @@ -20,6 +20,7 @@ CLANG_CONFIG_UNKNOWN_CFLAGS := \ -funswitch-loops ifeq ($(TARGET_ARCH),arm) + RS_TRIPLE := armv7-unknown-linux CLANG_CONFIG_EXTRA_ASFLAGS += \ -target arm-linux-androideabi \ -nostdlibinc \ @@ -41,6 +42,7 @@ ifeq ($(TARGET_ARCH),arm) -Wa,--noexecstack endif ifeq ($(TARGET_ARCH),mips) + RS_TRIPLE := mips-unknown-linux CLANG_CONFIG_EXTRA_ASFLAGS += \ -target mipsel-linux-androideabi \ -nostdlibinc \ @@ -65,6 +67,7 @@ ifeq ($(TARGET_ARCH),mips) -msynci endif ifeq ($(TARGET_ARCH),x86) + RS_TRIPLE := i686-unknown-linux CLANG_CONFIG_EXTRA_ASFLAGS += \ -target i686-linux-android \ -nostdlibinc \