Makefile.propeller 1.4 KB

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