From 5812d7b4694d36b728ff142588861f82abffa49c Mon Sep 17 00:00:00 2001 From: Mark D Horn Date: Tue, 26 Apr 2011 14:15:26 -0700 Subject: [PATCH] Clean up of X86 build flags Review and clean-up of both compiler and linker flags to ensure proper usage and consistency for images, toolchain, SDK, and NDK. Change-Id: Ife75c32cd49b32345712dee28fa5f2283069a90e Signed-off-by: Mark D Horn Author: Bruce Beare --- core/combo/TARGET_linux-x86.mk | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index 8a2f841f0d..0e28d771d3 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -75,11 +75,31 @@ endif 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 @@ endif 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 \