undefined reference to 'gEfiLoadedImageProtocolGuid'
frasercadger opened this issue · 3 comments
While linking SELoader I get the following error:
Efi/Lib/libSELoader.a(Image.o): In function LoadImage':Image.c:(.text+0x26): undefined reference to
gEfiLoadedImageProtocolGuid'
x86_64-poky-linux-ld:Efi/Lib/libSELoader.a(Image.o): relocation R_X86_64_PC32 against undefined hidden symbol `gEfiLoadedImageProtocolGuid' can not be used when making a shared object
x86_64-poky-linux-ld: final link failed: Bad value
I can see why this happens:
In Src/Efi/Lib/Image.c EfiLoadedImageProtocolGuid declaration is dependent on:
#if GNU_EFI_VERSION <= 303
Then in LoadImage(), EfiLoadedImageProtocolGuid is accessed unconditionally:
Status = EfiProtocolOpen(gThisImage, &gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage);
Causing the undefined symbol.
Therefore if the GNU_EFI_VERSION is > 303, linking will fail.
Is this the correct behaviour? Should versions of gnu-efi above 3.0.3 be supported with some alternative? Or is it intended, that only versions below 3.0.3 are supported (despite Mak.env having a default of 3.0.5)?
@frasercadger I definitely miss this for a while :(
gEfiLoadedImageProtocolGuid is defined since gnu-efi 3.0.4 rather than 3.0.3. I guess you are using gnu-efi 3.0.3. This issue is fixed by 9c2723a.
gEfiLoadedImageProtocolGuid is defined since gnu-efi 3.0.4 rather than 3.0.3.
Ah, that makes sense. At the time I wasn't very familiar with the codebase, and was unsure why the define would only be for versions < 3.0.3.
I guess you are using gnu-efi 3.0.3
Yes, for now. I'm building this through Yocto, and I'm not sure when we'll be upgrading.
This issue is fixed by 9c2723a
Thanks!
I believe this issue has been resolved. Plz reopen this if you have further issues. Thanks.