tianocore / edk2

EDK II
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II
Other
4.38k stars 2.4k forks source link

BaseTools: Detect library class mismatch #5837

Open Javagedes opened 1 week ago

Javagedes commented 1 week ago

Description

Performs a check that will verify that the library instance implements the library specified in the dsc by ensuring a LIBRARY_CLASS definition exists in the INF [Defines] section and the value matches the library it says it is implementing.

That is to say, for the following example: TestLib|Path/To/BaseTestLib.inf, that BaseTestLib.inf has LIBRARY_CLASS = TestLib defined in the [Defines] section.

How This Was Tested

<Describe the test(s) that were run to verify the changes.>

Integration Instructions

While no Integration is required, a new build warning will be seen in the build log. The warning is in the following format: $(DSC_PATH): warning: $(INF) does not support LIBRARY_CLASS $(LIBRARY_CLASS) where $(DSC_PATH) is the DSC being built, $(INF) is the INF described in the DSC, and $(LIBRARY_CLASS) is the name of the library class that the INF is attempting to represent. (i.e., $(LIBRARY_CLASS)|$(INF) or TestLib|Path\to\BaseTestLib.inf).

To resolve these errors, verify the library class is real (The Library class should have a header file associated with it in the DEC of the defining package). If it is real, then ensure the library instance truly implements the library class and add it to the DEFINE section of the library INF. If not, update the DSC to use the correct library class.

If this warning appears, it will appear at the beginning of the build command: Processing meta-data . Architecture(s) = IA32 X64 Build target = DEBUG Toolchain = VS2019 Active Platform = c:\src\Path\Platform.dsc build... c:\src\Path\Platform.dsc(...): warning: c:\src\Path\BaseTestLib.inf does not support LIBRARY_CLASS TestLib