From 63152fd929265b73195492e64b29352e1d068287 Mon Sep 17 00:00:00 2001 From: Bruce Beare Date: Thu, 8 Jul 2010 14:59:16 -0700 Subject: [PATCH] x86: Add proper gcc-4.4.3 x86 toolchain support. This patch combines 7 AOSP patches to add proper support to build x86 platform images using the 4.4.3 toolchain. The Orig-Changed-Id fields below correspond to the change ids of the original changes in the AOSP master branch history. Define __ANDROID__ for x86 to be on par with ARM build requirements Orig-Change-Id: I79c8f29af1f20b694f22a39f848216022809a5c6 Signed-off-by: Bruce Beare Enables x86-atom as a valid TARGET_ARCH_VARIANT for the simulator build. Orig-Change-Id: Idbceb6c7d4117fbecd35e4261330e6405666189e IA: enable SSE fpmath, Separate ARCH_VARIANT and ARCH makefile settings Change-Id: I9ba661d68a3b375c21eb6b56442d8ba66a5369b3 Orig-Change-Id: I60b8121c92b39a60b513bc2496a1e0a21015c586 Signed-off-by: Bruce Beare x86: Use GCC 4.4.3 Orig-Change-Id: I083c1afcbb98cfeb48d7bcb7681e5c34db52e767 Author: H.J. Lu Signed-off-by: Bruce Beare x86: the -mbionic flag is needed for IA builds. Orig-Change-Id: I00c75f37d7ea46b9f8ad3d7b2ff7094477ff0916 Signed-off-by: Bruce Beare x86: Disable stack-protector until bionic is fixed Orig-Change-Id: I2862de5c1b02490197704f4578a8a91d0565eef0 Signed-off-by: Bruce Beare Clean up of X86 build flags Orig-Change-Id: Ife75c32cd49b32345712dee28fa5f2283069a90e Signed-off-by: Mark D Horn Author: Bruce Beare x86: Enable -fstack-protector Orig-Change-Id: I1fe10159b7a29452ecfc6ba328164948cf9950d6 Signed-off-by: Bruce Beare --- core/combo/TARGET_linux-x86.mk | 50 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index d5bcba225..a683a0ec6 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -25,7 +25,9 @@ TARGET_AR := $(HOST_AR) TARGET_GLOBAL_CFLAGS := $(HOST_GLOBAL_CFLAGS) -m32 TARGET_GLOBAL_LDFLAGS := $(HOST_GLOBAL_LDFLAGS) -m32 -lpthread TARGET_NO_UNDEFINED_LDFLAGS := $(HOST_NO_UNDEFINED_LDFLAGS) +ifeq ($(strip $(TARGET_ARCH_VARIANT)),) TARGET_ARCH_VARIANT := x86 +endif else #simulator # Provide a default variant. @@ -36,7 +38,7 @@ endif # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) TARGET_TOOLS_PREFIX := \ - prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu- + prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-android-linux-4.4.3/bin/i686-android-linux- endif TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) @@ -49,8 +51,7 @@ TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ ifneq ($(wildcard $(TARGET_CC)),) TARGET_LIBGCC := \ - $(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a) \ - $(shell $(TARGET_CC) -m32 -print-file-name=libgcc_eh.a) + $(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a) endif TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined @@ -74,14 +75,48 @@ endif KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) TARGET_GLOBAL_CFLAGS += \ - -march=i686 \ - -m32 \ + -O2 \ + -Ulinux \ + -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) +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 + TARGET_GLOBAL_CPPFLAGS += \ -fno-use-cxa-atexit +ifeq ($(TARGET_ARCH_VARIANT),x86-atom) + TARGET_GLOBAL_CFLAGS += -march=atom -mstackrealign -DUSE_SSSE3 -DUSE_SSE2 -mfpmath=sse +else + TARGET_GLOBAL_CFLAGS += -march=i686 +endif + +TARGET_GLOBAL_CFLAGS += -mbionic +TARGET_GLOBAL_CFLAGS += -D__ANDROID__ + +TARGET_GLOBAL_LDFLAGS += -m32 +TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack +TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections + TARGET_C_INCLUDES := \ $(libc_root)/arch-x86/include \ $(libc_root)/include \ @@ -109,7 +144,7 @@ $(TARGET_CXX) \ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \ -nostdlib -Wl,-soname,$(notdir $@) \ -shared -Bsymbolic \ - -fPIC -march=i686 \ + $(TARGET_GLOBAL_CFLAGS) \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(PRIVATE_TARGET_CRTBEGIN_SO_O) \ $(PRIVATE_ALL_OBJECTS) \ @@ -159,7 +194,4 @@ $(TARGET_CXX) \ $(TARGET_CRTEND_O) endef -TARGET_GLOBAL_CFLAGS += -m32 -TARGET_GLOBAL_LDFLAGS += -m32 - endif #simulator -- 2.11.0