linux-loongson/include/linux/compiler-version.h
Kees Cook 11bb1678e2 integer-wrap: Force full rebuild when .scl file changes
Since the integer wrapping sanitizer's behavior depends on its associated
.scl file, we must force a full rebuild if the file changes. If not,
instrumentation may differ between targets based on when they were built.

Generate a new header file, integer-wrap.h, any time the Clang .scl
file changes. Include the header file in compiler-version.h when its
associated feature name, INTEGER_WRAP, is defined. This will be picked
up by fixdep and force rebuilds where needed.

Acked-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20250503184623.2572355-3-kees@kernel.org
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Kees Cook <kees@kernel.org>
2025-05-08 09:42:06 -07:00

45 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifdef __LINUX_COMPILER_VERSION_H
#error "Please do not include <linux/compiler-version.h>. This is done by the build system."
#endif
#define __LINUX_COMPILER_VERSION_H
/*
* This header exists to force full rebuild when the compiler is upgraded.
*
* When fixdep scans this, it will find this string "CONFIG_CC_VERSION_TEXT"
* and add dependency on include/config/CC_VERSION_TEXT, which is touched
* by Kconfig when the version string from the compiler changes.
*/
/* Additional tree-wide dependencies start here. */
/*
* If any of the GCC plugins change, we need to rebuild everything that
* was built with them, as they may have changed their behavior and those
* behaviors may need to be synchronized across all translation units.
*/
#ifdef GCC_PLUGINS
#include <generated/gcc-plugins.h>
#endif
/*
* If the randstruct seed itself changes (whether for GCC plugins or
* Clang), the entire tree needs to be rebuilt since the randomization of
* structures may change between compilation units if not.
*/
#ifdef RANDSTRUCT
#include <generated/randstruct_hash.h>
#endif
/*
* If any external changes affect Clang's integer wrapping sanitizer
* behavior, a full rebuild is needed as the coverage for wrapping types
* may have changed, which may impact the expected behaviors that should
* not differ between compilation units.
*/
#ifdef INTEGER_WRAP
#include <generated/integer-wrap.h>
#endif