[PATCH 1/1] sandbox: add symbol _init for RISC-V compilation

Heinrich Schuchardt xypron.glpk at gmx.de
Fri May 14 09:09:00 CEST 2021


On 5/14/21 1:00 AM, Bin Meng wrote:
> On Thu, May 13, 2021 at 10:46 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>
>> The sandbox does not build on RISC-V when _init is not defined. Errors like
>> the following were observed. Which function was referred to depended on the
>> configuration.
>>
>>      /usr/bin/ld: common/built-in.o: in function `parse_stream_outer':
>>      /common/cli_hush.c:3175: undefined reference to `_init'
>>      collect2: error: ld returned 1 exit status
>>      make: *** [Makefile:1726: u-boot] Error 1
>>
>>      /usr/bin/ld: common/built-in.o: in function `bootdelay_process':
>>      common/autoboot.c:335: undefined reference to `_init'
>>      collect2: error: ld returned 1 exit status
>>      make: *** [Makefile:1726: u-boot] Error 1
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>>   arch/sandbox/cpu/u-boot.lds | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
>> index a1f509c9ab..d9e7ffcea3 100644
>> --- a/arch/sandbox/cpu/u-boot.lds
>> +++ b/arch/sandbox/cpu/u-boot.lds
>> @@ -9,6 +9,8 @@ SECTIONS
>>   {
>>
>>          . = ALIGN(4);
>> +       /* RISC-V GCC wants this dummy symbol */
>
> Native GCC on RISC-V?

I was compiling natively on the BeagleV board.
The same result can be observed in a chroot using qemu-riscv64-static.

chroot: gcc (Debian 11-20210327-1) 11.0.1 20210327
BeagleV: gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)

Best regards

Heinrich

>
> RISC-V GCC sounds like cross-compile for RISC-V
>
>> +       _init = .;
>>          .u_boot_list : {
>>                  KEEP(*(SORT(.u_boot_list*)));
>>          }
>> --
>
>
> Regards,
> Bin
>



More information about the U-Boot mailing list