Skip to content

Commit c65ff92

Browse files
xur-llvmopsiff
authored andcommitted
kbuild: Fix Propeller build option
[ Upstream commit d63b852 ] The '-fbasic-block-sections=labels' option has been deprecated in tip of tree clang (20.0.0) [1]. While the option still works, a warning is emitted: clang: warning: argument '-fbasic-block-sections=labels' is deprecated, use '-fbasic-block-address-map' instead [-Wdeprecated] Add a version check to set the proper option. Link: llvm/llvm-project#110039 [1] Signed-off-by: Rong Xu <[email protected]> Reported-by: Nathan Chancellor <[email protected]> Suggested-by: Nathan Chancellor <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> [ Backport from v6.13 ] Signed-off-by: WangYuli <[email protected]>
1 parent 5bfd415 commit c65ff92

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

scripts/Makefile.propeller

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ ifdef CLANG_PROPELLER_PROFILE_PREFIX
55
CFLAGS_PROPELLER_CLANG := -fbasic-block-sections=list=$(CLANG_PROPELLER_PROFILE_PREFIX)_cc_profile.txt -ffunction-sections
66
KBUILD_LDFLAGS += --symbol-ordering-file=$(CLANG_PROPELLER_PROFILE_PREFIX)_ld_profile.txt --no-warn-symbol-ordering
77
else
8-
CFLAGS_PROPELLER_CLANG := -fbasic-block-sections=labels
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
916
endif
1017

1118
# Propeller requires debug information to embed module names in the profiles.
@@ -21,7 +28,11 @@ ifdef CONFIG_LTO_CLANG_THIN
2128
ifdef CLANG_PROPELLER_PROFILE_PREFIX
2229
KBUILD_LDFLAGS += --lto-basic-block-sections=$(CLANG_PROPELLER_PROFILE_PREFIX)_cc_profile.txt
2330
else
24-
KBUILD_LDFLAGS += --lto-basic-block-sections=labels
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
2536
endif
2637
endif
2738

0 commit comments

Comments
 (0)