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