Expand non-const comment

This commit is contained in:
David Woodhouse
2025-12-11 22:49:32 +09:00
parent 0b1ea8f2ca
commit 54ed6154eb

View File

@@ -22,7 +22,11 @@ namespace esphome {
namespace buildinfo {
// Reference the linker symbols as uintptr_t from the *data* section to
// avoid issues with pc-relative relocations on 64-bit platforms.
// avoid issues with pc-relative relocations on 64-bit platforms. And
// don't let the compiler know they're const or it'll optimise away the
// whole thing and emit a relocation to the ESPHOME_XXX symbols above
// directly, which defaults the whole point!
//
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
static uintptr_t config_hash = (uintptr_t) &ESPHOME_CONFIG_HASH;
static uintptr_t build_time = (uintptr_t) &ESPHOME_BUILD_TIME;