diff mbox series

[v2,1/1] sandbox: don't refer to symbol _init

Message ID 20210519100239.8829-1-xypron.glpk@gmx.de
State Accepted
Commit 3c9fc23c44317be82be94e461ff260ec7f083523
Delegated to: Simon Glass
Headers show
Series [v2,1/1] sandbox: don't refer to symbol _init | expand

Commit Message

Heinrich Schuchardt May 19, 2021, 10:02 a.m. UTC
GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on
RISC-V. The following lines leads to a build error for sandbox_defconfig on
RISC-V due to the missing symbol:

    common/board_f.c:269:
    #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
            gd->mon_len = (ulong)&_end - (ulong)_init;

The sandbox code is not copied into the memory allocated using mmap().
Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
v2:
	fix typo in commit message
---
 common/board_f.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--
2.31.1

Comments

Rick Chen May 20, 2021, 3:21 a.m. UTC | #1
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Heinrich Schuchardt
> Sent: Wednesday, May 19, 2021 6:03 PM
> To: Simon Glass <sjg@chromium.org>
> Cc: Ovidiu Panait <ovidiu.panait@windriver.com>; Bin Meng <bmeng.cn@gmail.com>; Stefan Roese <sr@denx.de>; Masahiro Yamada <masahiroy@kernel.org>; u-boot@lists.denx.de; Heinrich Schuchardt <xypron.glpk@gmx.de>
> Subject: [PATCH v2 1/1] sandbox: don't refer to symbol _init
>
> GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on RISC-V. The following lines leads to a build error for sandbox_defconfig on RISC-V due to the missing symbol:
>
>     common/board_f.c:269:
>     #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
>             gd->mon_len = (ulong)&_end - (ulong)_init;
>
> The sandbox code is not copied into the memory allocated using mmap().
> Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> v2:
>         fix typo in commit message
> ---
>  common/board_f.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Rick Chen <rick@andestech.com>
Simon Glass July 4, 2021, 8:15 p.m. UTC | #2
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Heinrich Schuchardt
> Sent: Wednesday, May 19, 2021 6:03 PM
> To: Simon Glass <sjg@chromium.org>
> Cc: Ovidiu Panait <ovidiu.panait@windriver.com>; Bin Meng <bmeng.cn@gmail.com>; Stefan Roese <sr@denx.de>; Masahiro Yamada <masahiroy@kernel.org>; u-boot@lists.denx.de; Heinrich Schuchardt <xypron.glpk@gmx.de>
> Subject: [PATCH v2 1/1] sandbox: don't refer to symbol _init
>
> GCC provides a symbol _init in crti.o on x86_64 and aarch64 but not on RISC-V. The following lines leads to a build error for sandbox_defconfig on RISC-V due to the missing symbol:
>
>     common/board_f.c:269:
>     #elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
>             gd->mon_len = (ulong)&_end - (ulong)_init;
>
> The sandbox code is not copied into the memory allocated using mmap().
> Hence we can safely use gd->mon_len = 0 to avoid the reference to _init.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> v2:
>         fix typo in commit message
> ---
>  common/board_f.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Rick Chen <rick@andestech.com>

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 203e965799..c1b8e63e56 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -265,7 +265,9 @@  static int setup_mon_len(void)
 {
 #if defined(__ARM__) || defined(__MICROBLAZE__)
 	gd->mon_len = (ulong)&__bss_end - (ulong)_start;
-#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
+#elif defined(CONFIG_SANDBOX)
+	gd->mon_len = 0;
+#elif defined(CONFIG_EFI_APP)
 	gd->mon_len = (ulong)&_end - (ulong)_init;
 #elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA)
 	gd->mon_len = CONFIG_SYS_MONITOR_LEN;