diff options
author | Dehao Chen <dehao@google.com> | 2014-07-23 23:44:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-23 18:44:51 +0000 |
commit | 1cd4638594d21ca4643b3b96c894f93a0bd1e87a (patch) | |
tree | 94caee6b0619c62ed0df8a8472e909eef8c0e0a9 | |
parent | e7998698236cf460b91f4245a5447498015cf439 (diff) | |
parent | 25671e15cc1b199ca693f95864ab93a63909a526 (diff) | |
download | build-1cd4638594d21ca4643b3b96c894f93a0bd1e87a.zip build-1cd4638594d21ca4643b3b96c894f93a0bd1e87a.tar.gz build-1cd4638594d21ca4643b3b96c894f93a0bd1e87a.tar.bz2 |
Merge "Refactor FDO support code to ensure arm64 can also be built with FDO." into lmp-dev
-rw-r--r-- | core/binary.mk | 1 | ||||
-rw-r--r-- | core/combo/TARGET_linux-arm.mk | 30 | ||||
-rw-r--r-- | core/combo/TARGET_linux-arm64.mk | 1 | ||||
-rw-r--r-- | core/combo/TARGET_linux-mips.mk | 30 | ||||
-rw-r--r-- | core/combo/TARGET_linux-mips64.mk | 30 | ||||
-rw-r--r-- | core/combo/TARGET_linux-x86.mk | 30 | ||||
-rw-r--r-- | core/combo/TARGET_linux-x86_64.mk | 30 | ||||
-rw-r--r-- | core/combo/fdo.mk | 41 |
8 files changed, 47 insertions, 146 deletions
diff --git a/core/binary.mk b/core/binary.mk index be0776e..f5dac69 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -179,7 +179,6 @@ my_compiler_dependencies := ifneq ($(strip $(LOCAL_FDO_SUPPORT)),) ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),) my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) - my_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) endif endif diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk index 37c56dc..d11aaa8 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -49,6 +49,7 @@ $(error Unknown ARM architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_ endif include $(TARGET_ARCH_SPECIFIC_MAKEFILE) +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),) @@ -168,35 +169,6 @@ target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arc -print-file-name=libgcov.a) endif -# Define FDO (Feedback Directed Optimization) options. - -$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:= -$(combo_2nd_arch_prefix)TARGET_FDO_LIB:= - -ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) - # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. - # The profile will be generated on /data/local/tmp/profile on the device. - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) -else - # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations. - # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. - ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),) - $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT) - else - ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.) - endif - endif - - # If the FDO profile directory can't be found, then FDO is off. - ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) - endif -endif - - KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_$(combo_2nd_arch_prefix)ARCH) KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk index 02c4b99..f57f695 100644 --- a/core/combo/TARGET_linux-arm64.mk +++ b/core/combo/TARGET_linux-arm64.mk @@ -49,6 +49,7 @@ $(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT)) endif include $(TARGET_ARCH_SPECIFIC_MAKEFILE) +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk index d702cc5..96ec210 100644 --- a/core/combo/TARGET_linux-mips.mk +++ b/core/combo/TARGET_linux-mips.mk @@ -49,6 +49,7 @@ $(error Unknown MIPS architecture variant: $(TARGET_$(combo_2nd_arch_prefix)ARCH endif include $(TARGET_ARCH_SPECIFIC_MAKEFILE) +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),) @@ -159,35 +160,6 @@ target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arc --print-file-name=libgcov.a) endif -# Define FDO (Feedback Directed Optimization) options. - -$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:= -$(combo_2nd_arch_prefix)TARGET_FDO_LIB:= - -ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) - # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. - # The profile will be generated on /data/local/tmp/profile on the device. - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) -else - # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations. - # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. - ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),) - $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT) - else - ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.) - endif - endif - - # If the FDO profile directory can't be found, then FDO is off. - ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) - endif -endif - - KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips # mips covers both mips and mips64. KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk index aa456ef..6dd3280 100644 --- a/core/combo/TARGET_linux-mips64.mk +++ b/core/combo/TARGET_linux-mips64.mk @@ -52,6 +52,7 @@ endif WITHOUT_TARGET_CLANG := true include $(TARGET_ARCH_SPECIFIC_MAKEFILE) +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) @@ -163,35 +164,6 @@ target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \ --print-file-name=libgcov.a) endif -# Define FDO (Feedback Directed Optimization) options. - -TARGET_FDO_CFLAGS:= -TARGET_FDO_LIB:= - -ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) - # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. - # The profile will be generated on /data/local/tmp/profile on the device. - TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO - TARGET_FDO_LIB := $(target_libgcov) -else - # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations. - # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. - ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),) - TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT) - else - ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),) - $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.) - endif - endif - - # If the FDO profile directory can't be found, then FDO is off. - ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),) - TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO - TARGET_FDO_LIB := $(target_libgcov) - endif -endif - - KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips # TODO: perhaps use $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH) instead of asm-mips ? diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index 2ca99ef..18331d5 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -41,7 +41,7 @@ $(error Unknown $(TARGET_$(combo_2nd_arch_prefix)ARCH) architecture version: $(T endif include $(TARGET_ARCH_SPECIFIC_MAKEFILE) - +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),) @@ -72,34 +72,6 @@ libc_root := bionic/libc libm_root := bionic/libm libstdc++_root := bionic/libstdc++ -# Define FDO (Feedback Directed Optimization) options. - -$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:= -$(combo_2nd_arch_prefix)TARGET_FDO_LIB:= - -ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) - # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. - # The profile will be generated on /data/local/tmp/profile on the device. - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) -else - # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations. - # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. - ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),) - $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT) - else - ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.) - endif - endif - - # If the FDO profile directory can't be found, then FDO is off. - ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) - $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO - $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) - endif -endif - KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64. KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk index 9dbcc19..4482a17 100644 --- a/core/combo/TARGET_linux-x86_64.mk +++ b/core/combo/TARGET_linux-x86_64.mk @@ -41,7 +41,7 @@ $(error Unknown $(TARGET_ARCH) architecture version: $(TARGET_ARCH_VARIANT)) endif include $(TARGET_ARCH_SPECIFIC_MAKEFILE) - +include $(BUILD_SYSTEM)/combo/fdo.mk # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) @@ -72,34 +72,6 @@ libc_root := bionic/libc libm_root := bionic/libm libstdc++_root := bionic/libstdc++ -# Define FDO (Feedback Directed Optimization) options. - -TARGET_FDO_CFLAGS:= -TARGET_FDO_LIB:= - -ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) - # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. - # The profile will be generated on /data/local/tmp/profile on the device. - TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO - TARGET_FDO_LIB := $(target_libgcov) -else - # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations. - # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. - ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),) - TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT) - else - ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),) - $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.) - endif - endif - - # If the FDO profile directory can't be found, then FDO is off. - ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),) - TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO - TARGET_FDO_LIB := $(target_libgcov) - endif -endif - KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64. KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH) diff --git a/core/combo/fdo.mk b/core/combo/fdo.mk new file mode 100644 index 0000000..26e842f --- /dev/null +++ b/core/combo/fdo.mk @@ -0,0 +1,41 @@ +# +# Copyright (C) 2006 The Android Open Source 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. +# + +# Setup FDO related flags. + +$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:= +$(combo_2nd_arch_prefix)TARGET_FDO_LIB:= + +ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),) + # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation. + # The profile will be generated on /data/local/tmp/profile on the device. + $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/fdo_profile -DANDROID_FDO + $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) +else + ifneq ($(strip $(BUILD_FDO_OPTIMIZE)),) + # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build. + ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),) + $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo_profiles + endif + + ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),) + $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO -fprofile-correction -Wcoverage-mismatch -Wno-error + $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov) + else + $(warning Profile directory $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) does not exist. Turn off FDO.) + endif + endif +endif |