[U-Boot] Linker error when using CONFIG_SPL_SYS_MALLOC_SIMPLE=y

Simon Glass sjg at chromium.org
Mon Mar 20 02:29:53 UTC 2017


Hi Dan,

On 17 March 2017 at 12:58, Dan Murphy <dmurphy at ti.com> wrote:
> Simon
>
> On 03/17/2017 01:46 PM, Simon Glass wrote:
>> Hi Dan,
>>
>> On 17 March 2017 at 12:33, Dan Murphy <dmurphy at ti.com> wrote:
>>> Simon
>>>
>>> On 03/17/2017 01:24 PM, Simon Glass wrote:
>>>> +ML
>>>>
>>>> Hi Dan,
>>>>
>>>> On 17 March 2017 at 12:16, Dan Murphy <dmurphy at ti.com> wrote:
>>>>> Simon
>>>>>
>>>>> I wanted to drop you a note to see if you have any advice on how to fix this issue.
>>>>>
>>>>> In the attached .config file we enable
>>>>>
>>>>> CONFIG_SPL_SYS_MALLOC_SIMPLE and CONFIG_SPL_DFU_SUPPORT which we need CONFIG_SPL_DFU_RAM
>>>>>
>>>>> When doing this we find that there is a build error
>>>>>
>>>>> common/built-in.o: In function `xrealloc':
>>>>> common/cli_hush.c:3349: undefined reference to `realloc_simple'
>>>>> common/built-in.o: In function `done_word':
>>>>> common/cli_hush.c:2494: undefined reference to `realloc_simple'
>>>>> cli_hush.c:2499: undefined reference to `realloc_simple'
>>>>> common/built-in.o: In function `b_check_space':
>>>>> common/cli_hush.c:876: undefined reference to `realloc_simple'
>>>>> make[1]: *** [spl/u-boot-spl] Error 1
>>>>> make: *** [spl/u-boot-spl] Error 2
>>>>>
>>>>> In digging into this I am finding that realloc_simple is not defined anywhere in uboot.  malloc_simple.c seems
>>>>> to be missing the implementation.
>>>>>
>>>>> I am looking to see if you have a patch that fixes this issue or if you can guide us to a resolution.
>>>>>
>>>>> Right now our only work around is to disable the HUSH_PARSER or turn off the MALLOC simple.  Which according to
>>>>> Lokesh, CC'd, is needed for DM support.
>>>> So SPL is using hush? Is there a description somewhere of what it does
>>>> with that?
>>> HUSH_PARSER was added to the TI config in commit adad96e60 configs: Re-sync HUSH options.
>>>
>>> HUSH calls realloc in the builtin functions.  I am not sure what SPL would do with the HUSH.
>>>
>>>> If you have enough space for hush I wonder whether you can just use
>>>> full malloc() in SPL? You could implement realloc_simple() by just
>>>> calling malloc_simple() and copying the old data over, but it is
>>>> inefficient.
>>> We could work around it but the undef reference will still exist for other code that would need realloc.
>> Right, but the point of simple malloc() is to be simple, and realloc()
>> is assumed not to be needed until you have a proper malloc().
>
> By proper malloc you mean the dlmalloc code?
>
> If thats true then why is realloc even defined in the simple malloc case?

To avoid it trying to use realloc(). Perhaps instead of a link error
it should be defined to some sort of error message?

Regards,
Simon


More information about the U-Boot mailing list