Since I'm building on FreeBSD, I'm using the generic UNIX instructions for
building with the EDK2. This means I'm using the cross-compiler tools
generated by the mingw-gcc-build.py script.
For the most part this works fine, but I noticed that when I build OVMF, I see
the following warnings:
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbGetPhysicalAddress':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:249: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbGetVolumeAttributes':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:289: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbSetVolumeAttributes':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:428: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbProtocolGetAttributes':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:289: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:289: note:
'FwhInstance' was declared here
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbProtocolGetPhysicalAddress':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:249: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:249: note:
'FwhInstance' was declared here
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbProtocolEraseBlocks':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:692: error:
'FwhInstance' may be used uninitialized in this function
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c: In function
'FvbGetLbaAddress':
edk2/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c:342: error:
'FwhInstance' may be used uninitialized in this function
This appears to be due to lines like this:
EFI_FW_VOL_INSTANCE *FwhInstance;
which should be this:
EFI_FW_VOL_INSTANCE *FwhInstance = NULL;
This is easily corrected, but I'm wondering why nobody else seems to have
noticed it. Maybe newer versions of GCC ignore it? Maybe people are using
Windows?
Also, I also noticed a few glitches when trying to build the sample apps in
AppPkg.
For example:
edk2/StdLib/BsdSocketLib/ns_print.c: In function '__ns_sprintrrf':
edk2/StdLib/BsdSocketLib/ns_print.c:231: error: format '%Lu' expects type
'long long unsigned int', but argument 3 has type 'u_long'
edk2/StdLib/BsdSocketLib/ns_print.c:519: error: format '%Lu' expects type
'long long unsigned int', but argument 5 has type 'u_long'
Apparently it wants the %Lu to be just %u
Similarly:
edk2/StdLib/BsdSocketLib/res_debug.c: In function '__p_option':
edk2/StdLib/BsdSocketLib/res_debug.c:539: error: format '%Lx' expects type
'long long unsigned int', but argument 3 has type 'u_long'
%Lx should be %x
Lastly, during the link phase, I get errors like this:
edk2/Build/AppPkg/RELEASE_UNIXGCC/IA32/StdLib/EfiSocketLib/EfiSocketLib/OUTPUT/EfiSocketLib.lib(Init.obj):/home/wpaul/edk/edk2/StdLib/EfiSocketLib/Init.c:57:
undefined reference to `mpfnEslConstructor'
This is defined in StdLib/EfiSocketLib/UseEfiSocketLib.c along with a bunch of
other globals as follows:
PFN_ESL_xSTRUCTOR mpfnEslConstructor __attribute__((weak)) =
EslServiceNetworkConnect; ///< Constructor for EfiSocketLib
The issue seems to be that when using the weak attribute, the compiler ends up
producing objects with symbols like this:
00000000 D .weak._mpfnEslConstructor._EslServiceNetworkDisconnect
The linker seems unable to resolve them because of the .weak prefix. I hacked
around this in my local tree by just getting rid of the __attribute__((weak))
tag.
It's possible that all of this may be attributable to the cross compiler
toolchain being out of date, but these seem like genuine bugs to me. Again,
I'm surprised they haven't been noticed before.
-Bill
--
=============================================================================
-Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
[email protected] | Master of Unix-Fu - Wind River Systems
=============================================================================
"I put a dollar in a change machine. Nothing changed." - George Carlin
=============================================================================
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel