blob: ed78372cf440be96b53def9bef457b079b550d48 [file] [log] [blame]
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -08001#
2# Copyright (C) 2006 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
The Android Open Source Project88b60792009-03-03 19:28:42 -080017# Configuration for Linux on x86 as a target.
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080018# Included by combo/select.mk
19
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080020# Provide a default variant.
Qiming Shi310324d2014-02-17 15:13:48 +080021ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
22TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := x86
Jean-Baptiste Queru9b4a8122010-02-23 12:36:56 -080023endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080024
Ben Cheng4de6fa42014-04-10 22:46:26 -070025# Decouple NDK library selection with platform compiler version
Christopher Ferrisc9d29522015-03-25 18:27:21 +000026$(combo_2nd_arch_prefix)TARGET_NDK_GCC_VERSION := 4.8
Ben Cheng4de6fa42014-04-10 22:46:26 -070027
Ben Cheng914f7fd2012-12-12 16:22:54 -080028ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
Christopher Ferrisc9d29522015-03-25 18:27:21 +000029$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
Ben Cheng914f7fd2012-12-12 16:22:54 -080030else
Qiming Shi310324d2014-02-17 15:13:48 +080031$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
Ben Cheng054ffd22012-12-11 14:01:10 -080032endif
33
David 'Digit' Turner6371da12011-12-13 17:21:56 +010034# Include the arch-variant-specific configuration file.
35# Its role is to define various ARCH_X86_HAVE_XXX feature macros,
36# plus initial values for TARGET_GLOBAL_CFLAGS
37#
Qiming Shi310324d2014-02-17 15:13:48 +080038TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
David 'Digit' Turner6371da12011-12-13 17:21:56 +010039ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
Qiming Shi310324d2014-02-17 15:13:48 +080040$(error Unknown $(TARGET_$(combo_2nd_arch_prefix)ARCH) architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
David 'Digit' Turner6371da12011-12-13 17:21:56 +010041endif
42
43include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
Dehao Chen25671e12014-07-23 14:28:58 -070044include $(BUILD_SYSTEM)/combo/fdo.mk
David 'Digit' Turner6371da12011-12-13 17:21:56 +010045
The Android Open Source Project88b60792009-03-03 19:28:42 -080046# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
Qiming Shi310324d2014-02-17 15:13:48 +080047ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
48$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
49$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/x86_64-linux-android-
The Android Open Source Project88b60792009-03-03 19:28:42 -080050endif
51
Qiming Shi310324d2014-02-17 15:13:48 +080052$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
53$(combo_2nd_arch_prefix)TARGET_CXX := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
54$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
55$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
56$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
Christopher Ferrisa6e2f932014-03-18 14:50:09 -070057$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
Qiming Shi310324d2014-02-17 15:13:48 +080058$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
The Android Open Source Project88b60792009-03-03 19:28:42 -080059
Qiming Shi310324d2014-02-17 15:13:48 +080060ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
61$(combo_2nd_arch_prefix)TARGET_LIBGCC := \
62 $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcc.a)
Andrew Hsieh4c952d72014-05-29 02:47:27 -070063$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := \
64 $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libatomic.a)
Dan Albert4bbc6c72014-09-19 14:25:57 -070065$(combo_2nd_arch_prefix)TARGET_LIBGCOV := \
66 $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcov.a)
The Android Open Source Project88b60792009-03-03 19:28:42 -080067endif
68
Qiming Shi310324d2014-02-17 15:13:48 +080069$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
The Android Open Source Project88b60792009-03-03 19:28:42 -080070
71libc_root := bionic/libc
72libm_root := bionic/libm
The Android Open Source Project88b60792009-03-03 19:28:42 -080073
Elliott Hughesdddb5662014-01-10 16:35:08 -080074KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
Elliott Hughes171e9402014-01-28 13:07:55 -080075KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
Elliott Hughese5df0952013-11-25 16:38:47 -080076KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -080077
Ying Wangf4723fa2013-08-15 11:01:10 -070078android_config_h := $(call select-android-config-h,target_linux-x86)
79
Qiming Shi310324d2014-02-17 15:13:48 +080080$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
Mark D Horn5812d7b2011-04-26 14:15:26 -070081 -O2 \
Mark D Horn5812d7b2011-04-26 14:15:26 -070082 -Wa,--noexecstack \
83 -Werror=format-security \
Nick Kralevichfb45baa2013-04-29 12:41:53 -070084 -D_FORTIFY_SOURCE=2 \
Mark D Horn5812d7b2011-04-26 14:15:26 -070085 -Wstrict-aliasing=2 \
Mark D Horn5812d7b2011-04-26 14:15:26 -070086 -ffunction-sections \
87 -finline-functions \
88 -finline-limit=300 \
Mark D Horn5812d7b2011-04-26 14:15:26 -070089 -fno-short-enums \
90 -fstrict-aliasing \
91 -funswitch-loops \
92 -funwind-tables \
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +030093 -fstack-protector \
Ying Wang4a712bf2013-09-19 10:15:38 -070094 -m32 \
Andrew Hsieh48f239c2014-05-09 14:13:13 +080095 -no-canonical-prefixes \
96 -fno-canonical-system-headers \
Ying Wangf4723fa2013-08-15 11:01:10 -070097 -include $(android_config_h) \
98 -I $(dir $(android_config_h))
The Android Open Source Project88b60792009-03-03 19:28:42 -080099
Qiming Shi310324d2014-02-17 15:13:48 +0800100$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
Bruce Beare3343b272011-12-09 13:27:08 -0800101
David 'Digit' Turner6371da12011-12-13 17:21:56 +0100102ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3!
Qiming Shi310324d2014-02-17 15:13:48 +0800103 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -mssse3
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +0300104endif
105ifeq ($(ARCH_X86_HAVE_SSE4),true)
Qiming Shi310324d2014-02-17 15:13:48 +0800106 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +0300107endif
108ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
Qiming Shi310324d2014-02-17 15:13:48 +0800109 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4.1
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +0300110endif
111ifeq ($(ARCH_X86_HAVE_SSE4_2),true)
Qiming Shi310324d2014-02-17 15:13:48 +0800112 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4.2
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +0300113endif
114ifeq ($(ARCH_X86_HAVE_AVX),true)
Qiming Shi310324d2014-02-17 15:13:48 +0800115 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mavx
Negreanu Marius Adrianae5c0ab2011-09-28 17:47:50 +0300116endif
117ifeq ($(ARCH_X86_HAVE_AES_NI),true)
Qiming Shi310324d2014-02-17 15:13:48 +0800118 $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -maes
David 'Digit' Turner6371da12011-12-13 17:21:56 +0100119endif
120
Qiming Shi310324d2014-02-17 15:13:48 +0800121$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -m32
David 'Digit' Turner6371da12011-12-13 17:21:56 +0100122
Qiming Shi310324d2014-02-17 15:13:48 +0800123$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
124$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,-z,relro -Wl,-z,now
Dehao Chen734de7a2015-01-14 11:21:22 -0800125$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--build-id=md5
Qiming Shi310324d2014-02-17 15:13:48 +0800126$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--warn-shared-textrel
127$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
128$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
Dmitriy Ivanov179685c2014-11-13 14:51:10 -0800129$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--hash-style=gnu
Bruce Beareccec9c42010-10-14 14:12:46 -0700130
Qiming Shi310324d2014-02-17 15:13:48 +0800131$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800132 $(libc_root)/arch-x86/include \
133 $(libc_root)/include \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800134 $(KERNEL_HEADERS) \
135 $(libm_root)/include \
136 $(libm_root)/include/i387 \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800137
Qiming Shi310324d2014-02-17 15:13:48 +0800138$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
139$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
140$(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
The Android Open Source Project88b60792009-03-03 19:28:42 -0800141
Qiming Shi310324d2014-02-17 15:13:48 +0800142$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
143$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project88b60792009-03-03 19:28:42 -0800144
Dmitriy Ivanov1d4804c2015-04-23 18:43:05 -0700145$(combo_2nd_arch_prefix)TARGET_PACK_MODULE_RELOCATIONS := true
146
Dan Albertb05f2ca2014-09-12 14:46:57 -0700147$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
The Android Open Source Project88b60792009-03-03 19:28:42 -0800148
Dan Alberte088c0d2014-11-13 10:15:46 -0800149$(combo_2nd_arch_prefix)TARGET_LINKER := /system/bin/linker
Ying Wangfe1e5c32015-03-09 18:57:40 -0700150
151$(combo_2nd_arch_prefix)TARGET_GLOBAL_YASM_FLAGS := -f elf32 -m x86