mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Starting with Rust 1.100.0 (expected 2026-11-12), the
`-Zprofile-sample-use` flag has been stabilized as
`-Cprofile-sample-use` and the former is not available anymore [1].
Without this change, when building with `CLANG_AUTOFDO_PROFILE` set, one
gets in the latest betas and nightlies:
error: unknown unstable option: `profile-sample-use`
Thus pass the right name.
Cc: [email protected] # 7.3.x
Link: https://github.com/rust-lang/rust/pull/155942 [1]
Reviewed-by: Alice Ryhl <[email protected]>
Acked-by: Nicolas Schier <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
29 lines
1.3 KiB
Makefile
29 lines
1.3 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Enable available and selected Clang AutoFDO features.
|
|
|
|
CFLAGS_AUTOFDO_CLANG := -fdebug-info-for-profiling -mllvm -enable-fs-discriminator=true -mllvm -improved-fs-discriminator=true
|
|
RUSTFLAGS_AUTOFDO_CLANG := $(if $(call rustc-min-version,109800),-Zdebuginfo-for-profiling,-Zdebug-info-for-profiling) -Cllvm-args=-enable-fs-discriminator=true -Cllvm-args=-improved-fs-discriminator=true
|
|
|
|
ifndef CONFIG_DEBUG_INFO
|
|
CFLAGS_AUTOFDO_CLANG += -gmlt
|
|
RUSTFLAGS_AUTOFDO_CLANG += -Cdebuginfo=line-tables-only
|
|
endif
|
|
|
|
ifdef CLANG_AUTOFDO_PROFILE
|
|
CFLAGS_AUTOFDO_CLANG += -fprofile-sample-use=$(CLANG_AUTOFDO_PROFILE) -ffunction-sections
|
|
CFLAGS_AUTOFDO_CLANG += -fsplit-machine-functions
|
|
RUSTFLAGS_AUTOFDO_CLANG += $(if $(call rustc-min-version,110000),-Cprofile-sample-use,-Zprofile-sample-use)=$(CLANG_AUTOFDO_PROFILE) -Zfunction-sections=y
|
|
RUSTFLAGS_AUTOFDO_CLANG += -Cllvm-args=-split-machine-functions
|
|
endif
|
|
|
|
ifdef CONFIG_LTO_CLANG_THIN
|
|
ifdef CLANG_AUTOFDO_PROFILE
|
|
KBUILD_LDFLAGS += --lto-sample-profile=$(CLANG_AUTOFDO_PROFILE)
|
|
endif
|
|
KBUILD_LDFLAGS += --mllvm=-enable-fs-discriminator=true --mllvm=-improved-fs-discriminator=true -plugin-opt=thinlto
|
|
KBUILD_LDFLAGS += $(call ld-option,-plugin-opt=-function-splitting=all,-plugin-opt=-split-machine-functions)
|
|
endif
|
|
|
|
export CFLAGS_AUTOFDO_CLANG RUSTFLAGS_AUTOFDO_CLANG
|