From 60021a4daa9720ae89e31def9483a09a78ead049 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Tue, 4 Apr 2017 22:11:46 +0200 Subject: common: spl: don't optimize away version string With CONFIG_SPL_SILENT_CONSOLE the 'U-Boot SPL...' version string is no longer linked into the SPL binary. Factor out the version string and make sure that it is not optimize away by lto. Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- common/spl/spl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index 0e50137cdf..8aee799faa 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -462,12 +462,22 @@ void board_init_r(gd_t *dummy1, ulong dummy2) jump_to_image_no_args(&spl_image); } +/* factor out puts, otherwise lto removes the version string when + * CONFIG_SPL_SILENT_CONSOLE is set */ +static void putsver(char *ver) +{ + if(ver[0] != 0) + puts(ver); +} + /* * This requires UART clocks to be enabled. In order for this to work the * caller must ensure that the gd pointer is valid. */ void preloader_console_init(void) { + char *ver = "\nU-Boot SPL " \ + PLAIN_VERSION " (" U_BOOT_DATE " - " U_BOOT_TIME ")\n"; gd->bd = &bdata; gd->baudrate = CONFIG_BAUDRATE; @@ -476,11 +486,13 @@ void preloader_console_init(void) gd->have_console = 1; #ifndef CONFIG_SPL_SILENT_CONSOLE - puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")\n"); + putsver(ver); #ifdef CONFIG_SPL_DISPLAY_PRINT spl_display_print(); #endif +#else + ver[0] = 0; + putsver(ver); #endif } -- cgit v1.2.3