1 # SPDX-License-Identifier: GPL-2.0
3 # Enable available and selected Clang AutoFDO features.
5 CFLAGS_AUTOFDO_CLANG := -fdebug-info-for-profiling -mllvm -enable-fs-discriminator=true -mllvm -improved-fs-discriminator=true
7 ifndef CONFIG_DEBUG_INFO
8 CFLAGS_AUTOFDO_CLANG += -gmlt
11 ifdef CLANG_AUTOFDO_PROFILE
12 CFLAGS_AUTOFDO_CLANG += -fprofile-sample-use=$(CLANG_AUTOFDO_PROFILE) -ffunction-sections
13 CFLAGS_AUTOFDO_CLANG += -fsplit-machine-functions
16 ifdef CONFIG_LTO_CLANG_THIN
17 ifdef CLANG_AUTOFDO_PROFILE
18 KBUILD_LDFLAGS += --lto-sample-profile=$(CLANG_AUTOFDO_PROFILE)
20 KBUILD_LDFLAGS += --mllvm=-enable-fs-discriminator=true --mllvm=-improved-fs-discriminator=true -plugin-opt=thinlto
21 KBUILD_LDFLAGS += -plugin-opt=-split-machine-functions
24 export CFLAGS_AUTOFDO_CLANG