[PATCH 0/2] make CONFIG_SPL_SYS_MALLOC_SIMPLE && CONFIG_SYS_SPL_MALLOC actually work

Rasmus Villemoes rasmus.villemoes at prevas.dk
Mon Sep 25 10:54:08 CEST 2023


On 21/09/2023 03.02, Simon Glass wrote:
> Hi Rasmus,
> 
> On Fri, 15 Sept 2023 at 11:51, Rasmus Villemoes
> <rasmus.villemoes at prevas.dk> wrote:
>>
>> Currently, setting both CONFIG_SPL_SYS_MALLOC_SIMPLE and
>> CONFIG_SYS_SPL_MALLOC (but not CONFIG_SPL_STACK_R) doesn't work as
>> expected: The SIMPLE option means that all malloc etc. calls are
>> directed at build-time to the implementation in malloc_simple.c, but
> 
> Sort-of. It is control by both a CONFIG and GD_FLG_FULL_MALLOC_INIT.
> 

Eh, no? The CONFIG option completely preempts any run-time gd flag checking

#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
#define malloc malloc_simple
#define realloc realloc_simple
#define memalign memalign_simple

Yes, _without_ that CONFIG option, the "real" malloc() functions do
check that gd flag and if not set fall back to the _simple variants. But
what I wrote is not merely "sort-of" correct.

Rasmus



More information about the U-Boot mailing list