1# SPDX-License-Identifier: GPL-2.0 2 3# Enable available and selected Clang AutoFDO features. 4 5CFLAGS_AUTOFDO_CLANG := -fdebug-info-for-profiling -mllvm -enable-fs-discriminator=true -mllvm -improved-fs-discriminator=true 6 7ifndef CONFIG_DEBUG_INFO 8 CFLAGS_AUTOFDO_CLANG += -gmlt 9endif 10 11ifdef CLANG_AUTOFDO_PROFILE 12 CFLAGS_AUTOFDO_CLANG += -fprofile-sample-use=$(CLANG_AUTOFDO_PROFILE) 13endif 14 15ifdef CONFIG_LTO_CLANG_THIN 16 ifdef CLANG_AUTOFDO_PROFILE 17 KBUILD_LDFLAGS += --lto-sample-profile=$(CLANG_AUTOFDO_PROFILE) 18 endif 19 KBUILD_LDFLAGS += --mllvm=-enable-fs-discriminator=true --mllvm=-improved-fs-discriminator=true -plugin-opt=thinlto 20endif 21 22export CFLAGS_AUTOFDO_CLANG 23