scripts/Makefile.autofdo

Source file repositories/reference/linux-study-clean/scripts/Makefile.autofdo

File Facts

System
Linux kernel
Corpus path
scripts/Makefile.autofdo
Extension
.autofdo
Size
1258 bytes
Lines
29
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: build/configuration rule
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

# 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 += -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 += -plugin-opt=-split-machine-functions
endif

export CFLAGS_AUTOFDO_CLANG RUSTFLAGS_AUTOFDO_CLANG

Annotation

Implementation Notes