Skip to content

Commit 4fa189b

Browse files
committed
BaseTools: Warn the improper usage of Depex for module types
According to INF specification, if the module is not a library (no LIBRARY_CLASS in the [Defines] section) and the MODULE_TYPE is SEC, SMM_CORE, DXE_CORE, PEI_CORE, UEFI_DRIVER, UEFI_APPLICATION or HOST_APPLICATION a Depex section is not permitted. Thus, this patch adds a check when retrieving dependency expression. If the module has [Depex] section but it's not permitted by INF specification, just throw warning message to warn. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
1 parent 7fdffdf commit 4fa189b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

BaseTools/Source/Python/Workspace/InfBuildData.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,15 @@ def Depex(self):
772772
return RetVal
773773

774774
RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
775+
776+
# If the module is not a library (no LIBRARY_CLASS in the [Defines] section) and the MODULE_TYPE is
777+
# SEC, SMM_CORE, DXE_CORE, PEI_CORE, UEFI_DRIVER, UEFI_APPLICATION or HOST_APPLICATION a Depex section
778+
# is not permitted.
779+
if len(self.LibraryClass) == 0 and len(RecordList) != 0:
780+
if self.ModuleType in [SUP_MODULE_SEC, SUP_MODULE_SMM_CORE, SUP_MODULE_DXE_CORE, SUP_MODULE_PEI_CORE, SUP_MODULE_UEFI_DRIVER, \
781+
SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_HOST_APPLICATION]:
782+
EdkLogger.warn(None, "[Depex] section is not permitted for [%s] module" % self.ModuleType, File=self.MetaFile)
783+
775784
# PEIM and DXE drivers must have a valid [Depex] section
776785
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
777786
if self.ModuleType == SUP_MODULE_DXE_DRIVER or self.ModuleType == SUP_MODULE_PEIM or self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER or \

0 commit comments

Comments
 (0)