spl: binman: Fix use of undeclared u_boot_any symbols
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Sat, 18 Jun 2022 12:13:06 +0000 (15:13 +0300)
committerSimon Glass <sjg@chromium.org>
Tue, 28 Jun 2022 02:09:52 +0000 (03:09 +0100)
commitd7f071725287a5462c57242bf04a752cd5ddfff1
treea28644d326f59b6e53b3554344415455ad581e97
parentd4462ba0443d4ea7de290b2ccf90b2a1c0122b93
spl: binman: Fix use of undeclared u_boot_any symbols

Some SPL functions directly use the binman 'u_boot_any' symbols to get
U-Boot's binman image position. These symbols are declared by the
SPL/TPL_BINMAN_SYMBOLS configs, but they are accessed by macros defined
by just CONFIG_BINMAN. So when BINMAN is enabled and BINMAN_SYMBOLS is
disabled, the code tries to use undeclared symbols and we get an error.

Therefore, any use of 'u_boot_any' symbols in the code is an implicit
dependency on SPL/TPL_BINMAN_SYMBOLS. However, in the current uses
they are meant to be the next phase's values, where that happens to be
U-Boot. In the meantime, helper funcions spl_get_image_pos/size() were
introduced to get these values.

Convert all uses of u_boot_any symbols to these functions, so we only
access these symbols at one place. Make sure they will not use these
symbols when the BINMAN_SYMBOLS configs are disabled, by returning early
in those cases.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
common/spl/spl.c
common/spl/spl_ram.c