[PATCH v2 1/3] scripts/Makefile.lib: add PLATFORM_LIBS to efi linking

Heinrich Schuchardt xypron.glpk at gmx.de
Sun May 11 13:58:07 CEST 2025


On 5/11/25 12:52, Heinrich Schuchardt wrote:
> On 5/8/25 20:30, Adriano Cordova wrote:
>> Link .efi applications using libgcc
>>
>> Signed-off-by: Adriano Cordova <adriano.cordova at canonical.com>
>> ---
>>
>> changes in v2:
>>      - Address the root of the problem. In v1 I was modifying
>>        printx in initrddump.efi not to generate __lshrdi3 instructions,
>>        but a better fix is to provide those instructions with libgcc
>>
>>   scripts/Makefile.lib | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
>> index 83fd5ff6c31..3a86cf375c3 100644
>> --- a/scripts/Makefile.lib
>> +++ b/scripts/Makefile.lib
>> @@ -497,7 +497,7 @@ KBUILD_EFILDFLAGS = -nostdlib -zexecstack - 
>> znocombreloc -znorelro
>>   KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
>>   quiet_cmd_efi_ld = LD      $@
>>   cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -L $(srctree) -T 
>> $(EFI_LDS_PATH) \
>> -        -shared -Bsymbolic -s $^ -o $@
>> +        -shared -Bsymbolic -s $^ $(PLATFORM_LIBS) -o $@
>>   EFI_LDS_PATH = arch/$(ARCH)/lib/$(EFI_LDS)
> 
> Building with this series fails:
> 
>     sandbox:  +   sandbox_noinst
> +ld.bfd: cannot find -lrt: No such file or directory
> +ld.bfd: cannot find -lSDL2: No such file or directory
> +make[3]: *** [scripts/Makefile.lib:512: lib/efi_loader/ 
> helloworld_efi.so] Error 1
> +make[2]: *** [scripts/Makefile.build:398: lib/efi_loader] Error 2
> +make[1]: *** [Makefile:1919: lib] Error 2
> +make: *** [Makefile:177: sub-make] Error 2
> 
>      0    0    1 /1              sandbox_noinst
> 
> See https://source.denx.de/u-boot/custodians/u-boot-efi/-/jobs/1131665/raw
> 
> Best regards
> 
> Heinrich

Using PLATFORM_LIBGCC instead of PLATFORM_LIBS resolves the problem.

PLATFORM_LIBGCC should match your intention to link in libgcc according 
to our prior communication. I will adjust the patch accordingly.

Best regards

Heinrich


More information about the U-Boot mailing list