Merge "FDO: support linux-x86 target"

This commit is contained in:
Ying Wang 2013-08-13 17:38:36 +00:00 committed by Gerrit Code Review
commit 2863fa7a96

View file

@ -63,6 +63,8 @@ endif
ifneq ($(wildcard $(TARGET_CC)),)
TARGET_LIBGCC := \
$(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a)
target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@ -72,6 +74,34 @@ libm_root := bionic/libm
libstdc++_root := bionic/libstdc++
libthread_db_root := bionic/libthread_db
# 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
# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
# symlinks located in out/ to point to the appropriate kernel
# headers. see 'config/kernel_headers.make' for more details
@ -191,6 +221,7 @@ $(hide) $(PRIVATE_CXX) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@ -216,6 +247,7 @@ $(hide) $(PRIVATE_CXX) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@ -237,6 +269,7 @@ $(hide) $(PRIVATE_CXX) \
-Wl,--no-whole-archive \
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))