malloc: Add a Kconfig option for heap protection

Add CONFIG_MCHECK_HEAP_PROTECTION option to enable mcheck heap
protection. Convert all uses of MCHECK_HEAP_PROTECTION to use the
CONFIG_ -prefixed version to work with Kconfig.

Disable this option when tracing is enabled, since the mcheck hooks (mcheck_pedantic_prehook(), etc.) interfere with function tracing.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-02 09:29:47 +00:00
parent d8b19014d7
commit 331063acd0
4 changed files with 17 additions and 7 deletions

View File

@@ -749,7 +749,7 @@ static int setup_reloc(void)
if (gd->flags & GD_FLG_SKIP_RELOC) {
debug("Skipping relocation due to flag\n");
} else {
#ifdef MCHECK_HEAP_PROTECTION
#ifdef CONFIG_MCHECK_HEAP_PROTECTION
mcheck_on_ramrelocation(gd->reloc_off);
#endif
debug("Relocation Offset is: %08lx\n", gd->reloc_off);