Merge "post process the system properties"
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 25564b2..02b04d6 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -368,10 +368,11 @@
 	) \
     )
   # The arguments to jar that will include these files in a jar file.
+  # Quote the file name to handle special characters (such as #) correctly.
   extra_jar_args := \
     $(foreach group,$(java_resource_file_groups), \
-	$(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \
-	    $(wordlist 2,9999,$(subst :,$(space),$(group))) \
+	$(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
+	    $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
 	) \
     )
   java_resource_file_groups :=
diff --git a/core/binary.mk b/core/binary.mk
index d6ccfbf..61026d2 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -575,7 +575,9 @@
       NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
 
 # Default is -fno-rtti.
-LOCAL_RTTI_FLAG ?= -fno-rtti
+ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
+LOCAL_RTTI_FLAG := -fno-rtti
+endif
 
 ###########################################################
 # Rule-specific variable definitions
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index ab6efd4..bc085f5 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -42,6 +42,7 @@
 LOCAL_ASFLAGS:=
 LOCAL_CFLAGS:=
 LOCAL_CPPFLAGS:=
+LOCAL_RTTI_FLAG:=
 LOCAL_C_INCLUDES:=
 LOCAL_LDFLAGS:=
 LOCAL_LDLIBS:=
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index dac092c..d8056e3 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -75,11 +75,31 @@
 KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
 
 TARGET_GLOBAL_CFLAGS += \
+			-O2 \
 			-Ulinux \
-			-m32 \
+			-Wa,--noexecstack \
+			-Werror=format-security \
+			-Wstrict-aliasing=2 \
 			-fPIC \
+			-ffunction-sections \
+			-finline-functions \
+			-finline-limit=300 \
+			-fno-inline-functions-called-once \
+			-fno-short-enums \
+			-fstrict-aliasing \
+			-funswitch-loops \
+			-funwind-tables \
 			-include $(call select-android-config-h,target_linux-x86)
 
+# Needs to be fixed later
+#TARGET_GLOBAL_CFLAGS += \
+#			-fstack-protector
+
+# Needs to be added for RELEASE
+#TARGET_GLOBAL_CFLAGS += \
+#			-DNDEBUG
+
+
 # Fix this after ssp.c is fixed for x86
 # TARGET_GLOBAL_CFLAGS += -fstack-protector
 
@@ -94,8 +114,10 @@
 
 TARGET_GLOBAL_CFLAGS += -mbionic
 TARGET_GLOBAL_CFLAGS += -D__ANDROID__
-TARGET_GLOBAL_LDFLAGS += -m32
 
+TARGET_GLOBAL_LDFLAGS += -m32
+TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
+TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
 
 TARGET_C_INCLUDES := \
 	$(libc_root)/arch-x86/include \
diff --git a/core/config.mk b/core/config.mk
index 3240e94..82238e9 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -270,6 +270,12 @@
 endif
 endif
 
+# Is the host JDK 64-bit version?
+HOST_JDK_IS_64BIT_VERSION :=
+ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
+HOST_JDK_IS_64BIT_VERSION := true
+endif
+
 # It's called md5 on Mac OS and md5sum on Linux
 ifeq ($(HOST_OS),darwin)
 MD5SUM:=md5 -q
diff --git a/core/definitions.mk b/core/definitions.mk
index 89db88e..9251017 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1576,7 +1576,9 @@
 endef
 
 define add-java-resources-to-package
-$(hide) jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS)
+$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
+$(hide) jar uf $@ @$(dir $@)jar-arg-list
+@rm -f $(dir $@)jar-arg-list
 endef
 
 # Sign a package using the specified key/cert.
@@ -1619,7 +1621,7 @@
 define transform-host-java-to-package
 @echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
 $(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
-$(hide) if [ ! -z "$(PRIVATE_EXTRA_JAR_ARGS)" ]; then jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS); fi
+$(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package))
 endef
 
 ###########################################################
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 2642626..91d8166 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -154,7 +154,7 @@
 	$(hide) ( \
 		javadoc \
                 \@$(PRIVATE_SRC_LIST_FILE) \
-                -J-Xmx1024m \
+                -J-Xmx1280m \
                 $(PRIVATE_PROFILING_OPTIONS) \
                 -quiet \
                 -doclet com.google.doclava.Doclava \
diff --git a/core/main.mk b/core/main.mk
index a8679e1..f918dfd 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -73,17 +73,6 @@
 
 $(info Checking build tools versions...)
 
-ifeq ($(BUILD_OS),linux)
-build_arch := $(shell uname -m)
-ifneq (64,$(findstring 64,$(build_arch)))
-$(warning ************************************************************)
-$(warning You are attempting to build on a 32-bit system.)
-$(warning Only 64-bit build environments are supported beyond froyo/2.2.)
-$(warning ************************************************************)
-$(error stop)
-endif
-endif
-
 ifneq ($(HOST_OS),windows)
 ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
 # check for a case sensitive file system
diff --git a/target/product/core.mk b/target/product/core.mk
index 7b4c3cd..604b87c 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -48,6 +48,7 @@
     libdex \
     libdvm \
     libexpat \
+    libgabi++ \
     libicui18n \
     libicuuc \
     libjavacore \
@@ -67,8 +68,10 @@
     libstagefright_soft_vpxdec \
     libwilhelm \
     libfilterfw \
+    libfilterpack_imageproc \
     libz \
     wpa_supplicant.conf \
+    KeyChain \
     Browser \
     Contacts \
     Home \