]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fix the bug that incorrect size info in the Lib autogen
authorYonghong Zhu <yonghong.zhu@intel.com>
Mon, 9 Jul 2018 12:14:38 +0000 (20:14 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 10 Jul 2018 08:01:09 +0000 (16:01 +0800)
The case is a PCD used in one library only, and in DSC component
section the PCD value is override in one of module inf. Then it cause
the bug the PCD size in the Lib autogen use the PCD value in the DSC
PCD section, but not use the override value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/AutoGen.py

index d100648606f7cbea022007373c4cabbf52e0d737..b27290989e9a1904fb87a6000ada97a79fec2346 100644 (file)
@@ -1293,12 +1293,17 @@ class PlatformAutoGen(AutoGen):
             ShareFixedAtBuildPcdsSameValue = {}\r
             for Module in LibAuto._ReferenceModules:\r
                 for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:\r
             ShareFixedAtBuildPcdsSameValue = {}\r
             for Module in LibAuto._ReferenceModules:\r
                 for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds:\r
+                    DefaultValue = Pcd.DefaultValue\r
+                    # Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib\r
+                    if Pcd in Module.LibraryPcdList:\r
+                        Index = Module.LibraryPcdList.index(Pcd)\r
+                        DefaultValue = Module.LibraryPcdList[Index].DefaultValue\r
                     key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
                     if key not in FixedAtBuildPcds:\r
                         ShareFixedAtBuildPcdsSameValue[key] = True\r
                     key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
                     if key not in FixedAtBuildPcds:\r
                         ShareFixedAtBuildPcdsSameValue[key] = True\r
-                        FixedAtBuildPcds[key] = Pcd.DefaultValue\r
+                        FixedAtBuildPcds[key] = DefaultValue\r
                     else:\r
                     else:\r
-                        if FixedAtBuildPcds[key] != Pcd.DefaultValue:\r
+                        if FixedAtBuildPcds[key] != DefaultValue:\r
                             ShareFixedAtBuildPcdsSameValue[key] = False\r
             for Pcd in LibAuto.FixedAtBuildPcds:\r
                 key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
                             ShareFixedAtBuildPcdsSameValue[key] = False\r
             for Pcd in LibAuto.FixedAtBuildPcds:\r
                 key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r