1# SPDX-License-Identifier: GPL-2.0 2 3# Enable available and selected Clang Propeller features. 4ifdef CLANG_PROPELLER_PROFILE_PREFIX 5 CFLAGS_PROPELLER_CLANG := -fbasic-block-sections=list=$(CLANG_PROPELLER_PROFILE_PREFIX)_cc_profile.txt -ffunction-sections 6 KBUILD_LDFLAGS += --symbol-ordering-file=$(CLANG_PROPELLER_PROFILE_PREFIX)_ld_profile.txt --no-warn-symbol-ordering 7else 8 # Starting with Clang v20, the '-fbasic-block-sections=labels' option is 9 # deprecated. Use the recommended '-fbasic-block-address-map' option. 10 # Link: https://github.com/llvm/llvm-project/pull/110039 11 ifeq ($(call clang-min-version, 200000),y) 12 CFLAGS_PROPELLER_CLANG := -fbasic-block-address-map 13 else 14 CFLAGS_PROPELLER_CLANG := -fbasic-block-sections=labels 15 endif 16endif 17 18# Propeller requires debug information to embed module names in the profiles. 19# If CONFIG_DEBUG_INFO is not enabled, set -gmlt option. Skip this for AutoFDO, 20# as the option should already be set. 21ifndef CONFIG_DEBUG_INFO 22 ifndef CONFIG_AUTOFDO_CLANG 23 CFLAGS_PROPELLER_CLANG += -gmlt 24 endif 25endif 26 27ifdef CONFIG_LTO_CLANG_THIN 28 ifdef CLANG_PROPELLER_PROFILE_PREFIX 29 KBUILD_LDFLAGS += --lto-basic-block-sections=$(CLANG_PROPELLER_PROFILE_PREFIX)_cc_profile.txt 30 else 31 ifeq ($(call test-ge, $(CONFIG_LLD_VERSION), 200000),y) 32 KBUILD_LDFLAGS += --lto-basic-block-address-map 33 else 34 KBUILD_LDFLAGS += --lto-basic-block-sections=labels 35 endif 36 endif 37endif 38 39export CFLAGS_PROPELLER_CLANG 40