Skip to content
  • Stephen Warren's avatar
    malloc: use hidden visibility · 2f0bcd4d
    Stephen Warren authored
    When running sandbox, the following phases occur, each with different
    malloc implementations or behaviors:
    
    1) Dynamic linker execution, using the dynamic linker's own malloc()
    implementation. This is fully functional.
    
    2) After U-Boot's malloc symbol has been hooked into the GOT, but before
    any U-Boot code has run. This phase is entirely non-functional, since
    U-Boot's gd symbol is NULL and U-Boot's initf_malloc() and
    mem_malloc_init() have not been called.
    
    At least on Ubuntu Xenial, the dynamic linker does make both malloc() and
    free() calls during this phase. Currently these free() calls crash since
    they dereference gd, which is NULL.
    
    U-Boot itself makes no use of malloc() during this phase.
    
    3) U-Boot execution after gd is set and initf_malloc() has been called.
    This is fully functional, albeit via a very simple malloc()
    implementation.
    
    4) U-Boot execution after mem_malloc_init() has been called. This is fully
    functional with a complete malloc() implementation.
    
    Further...
    2f0bcd4d