BaseTools: Fix the different token with the same PCD
authorYunhua Feng <yunhuax.feng@intel.com>
Fri, 20 Jul 2018 07:51:39 +0000 (15:51 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 24 Jul 2018 08:28:56 +0000 (16:28 +0800)
If the different token with the same PCD names are used in the driver,
build can pass. If the different token with the same PCD name are used
in the different library, then the driver build will fail. The reason
is that the driver autogen.c is not generated correctly for the second
case. BaseTools should check the duplicated PCD name is the driver and
its linked libraries.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/GenC.py

index 8a62cd2..8946e41 100644 (file)
@@ -937,7 +937,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
         if Info.IsLibrary:\r
             PcdList = Info.LibraryPcdList\r
         else:\r
-            PcdList = Info.ModulePcdList\r
+            PcdList = Info.ModulePcdList + Info.LibraryPcdList\r
         PcdExCNameTest = 0\r
         for PcdModule in PcdList:\r
             if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName == PcdModule.TokenCName:\r