[PATCH 1/1] sandbox: add symbol _init for RISC-V compilation
Heinrich Schuchardt
xypron.glpk at gmx.de
Wed May 19 04:26:33 CEST 2021
On 5/18/21 11:36 PM, Jim Wilson wrote:
> On Tue, May 18, 2021 at 2:32 PM Jim Wilson <jimw at sifive.com
> <mailto:jimw at sifive.com>> wrote:
>
> On Tue, May 18, 2021 at 1:58 PM Heinrich Schuchardt
> <xypron.glpk at gmx.de <mailto:xypron.glpk at gmx.de>> wrote:
>
> I am compiling the sandbox_defconfig target of upstream U-Boot
> with GCC
> 11. Please, indicate what "legacy user code" you are referring to.
>
>
> I have no idea what that is. I'm not a uboot developer.
>
>
> By "user code" I mean that it isn't toolchain code, as the toolchain
> doesn't use init.
>
> Jim
This seems to be the culprit:
common/board_f.c:269:
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP)
gd->mon_len = (ulong)&_end - (ulong)_init;
gd->mon_len is used here:
common/board_f.c:344
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
@Simon:
We don't relocate the sandbox code into the mmap'ed memory.
Why should we use a nonzero value of gd->mon_len on the sandbox?
When compiling the sandbox on x86_64 u-boot.map has:
.init 0x0000000000031000 0x17
*(SORT_NONE(.init))
.init 0x0000000000031000 0x12
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o
0x0000000000031000 _init
.init 0x0000000000031012 0x5
/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o
This relates to
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/i386/crti.S
This file defines symbols _init and _fini.
For aarch64 we have:
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/aarch64/crti.S
This file contains symbols _init and _fini, too.
For RISC-V we have:
https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/riscv/crti.S
It contains only a comment
/* crti.S is empty because .init_array/.fini_array are used exclusively. */
Symbols _init and _fini don't exist on RISC-V.
As the usage of _init is deprecated in GCC we should not use it in any
U-Boot configuration, neither for SANDBOX nor for EFI_APP.
Best regards
Heinrich
More information about the U-Boot
mailing list