Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qw #3

Open
wants to merge 10 commits into
base: android-5.0
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
*.swp
*~
27 changes: 27 additions & 0 deletions core/O3.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2014-2015 The SaberMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

ifneq (1,$(words $(filter $(LOCAL_DISABLE_O3),$(LOCAL_MODULE))))
ifdef LOCAL_CONLYFLAGS
LOCAL_CONLYFLAGS += $(O3_FLAGS)
else
LOCAL_CONLYFLAGS := $(O3_FLAGS)
endif
ifdef LOCAL_CPPFLAGS
LOCAL_CPPFLAGS += $(O3_FLAGS)
else
LOCAL_CPPFLAGS := $(O3_FLAGS)
endif
endif
59 changes: 59 additions & 0 deletions core/binary.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,65 @@ else
endif
endif

##########################################################################
# Copyright (C) 2014-2015 The SaberMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################

# arm thumb, not used on the host compiler.
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true)
include $(BUILD_SYSTEM)/thumb_interwork.mk
endif

# O3
ifeq ($(strip $(O3_OPTIMIZATIONS)),true)
include $(BUILD_SYSTEM)/O3.mk
endif

# posix thread (pthread) support
ifeq ($(strip $(ENABLE_PTHREAD)),true)
include $(BUILD_SYSTEM)/pthread.mk
endif

# Do not use graphite on host modules or the clang compiler.
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true)
ifneq ($(strip $(LOCAL_CLANG)),true)

# If it gets this far enable graphite by default from here on out.
include $(BUILD_SYSTEM)/graphite.mk
endif
endif

# Have anything that builds with libtinycompress as a shared lib use kernel headers.

ifdef LOCAL_SHARED_LIBRARIES
ifeq (1,$(words $(filter libtinycompress, $(LOCAL_SHARED_LIBRARIES))))
ifdef LOCAL_C_INCLUDES
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
else
LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
endif
ifdef LOCAL_ADDITIONAL_DEPENDENCIES
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
else
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
endif
endif
endif

#end SaberMod

# The following LOCAL_ variables will be modified in this file.
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
# we can't modify them in place.
Expand Down
38 changes: 38 additions & 0 deletions core/clang/HOST_x86_common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \
-no-integrated-as

ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),)
ifneq ($(strip $(USE_LEGACY_GCC)),true)
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \
-no-integrated-as

CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \
-no-integrated-as
else
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
Expand All @@ -31,6 +49,25 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \
-no-integrated-as
endif
else
ifneq ($(strip $(USE_LEGACY_GCC)),true)
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux/32 \
-isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \
-no-integrated-as

CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \
-no-integrated-as
else
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
Expand All @@ -49,6 +86,7 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
-L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \
-no-integrated-as
endif
endif
endif # Linux

ifeq ($(HOST_OS),windows)
Expand Down
3 changes: 2 additions & 1 deletion core/clang/arm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
-fno-builtin-sin \
-fno-strict-volatile-bitfields \
-fno-align-jumps \
-Wa,--noexecstack
-Wa,--noexecstack \
-mfpu=neon-vfpv4

define subst-clang-incompatible-arm-flags
$(subst -march=armv5te,-march=armv5t,\
Expand Down
3 changes: 2 additions & 1 deletion core/clang/arm64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ CLANG_CONFIG_arm64_UNKNOWN_CFLAGS := \
-frename-registers \
-fno-strict-volatile-bitfields \
-fno-align-jumps \
-Wa,--noexecstack
-Wa,--noexecstack \
-mfpu=neon-vfpv4

# We don't have any arm64 flags to substitute yet.
define subst-clang-incompatible-arm64-flags
Expand Down
8 changes: 8 additions & 0 deletions core/combo/HOST_linux-x86.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
# Included by combo/select.mk

ifeq ($(strip $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)),)
ifneq ($(strip $(USE_LEGACY_GCC)),true)
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
else
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
endif
endif
# Don't do anything if the toolchain is not there
ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc)))
$(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc
Expand All @@ -28,7 +32,11 @@ $(combo_2nd_arch_prefix)HOST_AR := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PRE
endif # $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc exists

# gcc location for clang; to be updated when clang is updated
ifneq ($(strip $(USE_LEGACY_GCC)),true)
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/
else
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
endif

# We expect SSE3 floating point math.
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack -march=prescott
Expand Down
8 changes: 8 additions & 0 deletions core/combo/HOST_linux-x86_64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
# Included by combo/select.mk

ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
ifneq ($(strip $(USE_LEGACY_GCC)),true)
HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
else
HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
endif
endif
# Don't do anything if the toolchain is not there
ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc)))
HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
Expand All @@ -28,7 +32,11 @@ HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists

# gcc location for clang; to be updated when clang is updated
ifneq ($(strip $(USE_LEGACY_GCC)),true)
HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/
else
HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
endif

HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
Expand Down
52 changes: 36 additions & 16 deletions core/combo/arch/arm/armv7-a-neon.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,60 @@
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
ARCH_ARM_HAVE_ARMV7A := true
ARCH_ARM_HAVE_TLS_REGISTER := true
ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true

ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
CORTEX_A15_TYPE := \
cortex-a15 \
krait \
denver

# arm64 doesn't like cortex-a15
ifeq (denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT))
# Export cflags and cpu variant to the kernel.
export kernel_arch_variant_cflags := -march=armv8-a
endif
ifneq (,$(filter $(CORTEX_A15_TYPE),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
# NOTE: krait is not a cortex-a15, we set the variant to cortex-a15 so that
# hardware divide operations are generated.
arch_variant_cflags := -mcpu=cortex-a15

# Fake an ARM compiler flag as these processors support LPAE which GCC/clang
# don't advertise.
arch_variant_cflags += -D__ARM_FEATURE_LPAE=1
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a9)
arch_variant_cflags := -mcpu=cortex-a9
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a8)
ifneq (,$(filter cortex-a8 scorpion,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a8
arch_variant_ldflags := -Wl,--fix-cortex-a8
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7)
arch_variant_cflags := -mcpu=cortex-a7
else
ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a5)
arch_variant_cflags := -mcpu=cortex-a5
else
ifeq ($(strip $(TARGET_CPU_VARIANT)),krait)
arch_variant_cflags := -mcpu=cortex-a9
else
ifeq ($(strip $(TARGET_CPU_VARIANT)),scorpion)
arch_variant_cflags := -mcpu=cortex-a8
else
arch_variant_cflags := -march=armv7-a
endif
endif
endif
endif
endif
endif

arch_variant_cflags += \
-mfloat-abi=softfp \
-mfpu=neon

arch_variant_ldflags := \
-Wl,--fix-cortex-a8
# For neon vfpv4 type, override -mfpu=neon with -mfpu=neon-vfpv4
# Have the clang compiler ignore unknow flag option -mfpu=neon-vfpv4
# Once ignored by clang, clang will default back to -mfpu=neon
neon_vfpv4_type := \
cortex-a15 \
krait

ifneq ($(filter $(neon_vfpv4_type),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),)
arch_variant_cflags += \
-mfpu=neon-vfpv4
# Export cflags and cpu variant to the kernel.
export kernel_arch_variant_cflags := $(arch_variant_cflags)
endif

35 changes: 35 additions & 0 deletions core/graphite.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (C) 2014-2015 The SaberMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

ifneq (1,$(words $(filter $(LOCAL_DISABLE_GRAPHITE),$(LOCAL_MODULE))))
ifdef LOCAL_CONLYFLAGS
LOCAL_CONLYFLAGS += $(GRAPHITE_FLAGS)
else
LOCAL_CONLYFLAGS := $(GRAPHITE_FLAGS)
endif

ifdef LOCAL_CPPFLAGS
LOCAL_CPPFLAGS += $(GRAPHITE_FLAGS)
else
LOCAL_CPPFLAGS := $(GRAPHITE_FLAGS)
endif

ifndef LOCAL_LDFLAGS
LOCAL_LDFLAGS := $(GRAPHITE_FLAGS)
else
LOCAL_LDFLAGS += $(GRAPHITE_FLAGS)
endif
endif
#####
22 changes: 22 additions & 0 deletions core/pthread.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2015 The SaberMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Add pthread flags globally
ifneq (1,$(words $(filter $(LOCAL_DISABLE_PTHREAD),$(LOCAL_MODULE))))
ifdef LOCAL_CFLAGS
LOCAL_CFLAGS += -pthread
else
LOCAL_CFLAGS := -pthread
endif
endif