Reviewed-by: Bob Feng <[email protected]>

-----Original Message-----
From: Fan, ZhijuX 
Sent: Wednesday, April 17, 2019 10:02 AM
To: [email protected]
Cc: Gao, Liming <[email protected]>; Feng, Bob C <[email protected]>
Subject: [PATCH] BaseTools:Makefiles cause data errors on some platforms

As the Dict is unordered, an error occurs when using the Dict while creating a 
new item.So for now, use OrdereDict instead of Dict.

Cc: Bob Feng <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Zhiju.Fan <[email protected]>
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 7562dc68b3..426e6ca51a 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -429,7 +429,7 @@ cleanlib:
         self.CommonFileDependency = []
         self.FileListMacros = {}
         self.ListFileMacros = {}
-        self.ObjTargetDict = {}
+        self.ObjTargetDict = OrderedDict()
         self.FileCache = {}
         self.LibraryBuildCommandList = []
         self.LibraryFileList = []
@@ -954,11 +954,9 @@ cleanlib:
                     self.ListFileMacros[T.IncListFileMacro] = []
                 if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT 
and Type == TAB_C_CODE_FILE:
                     NewFile = self.PlaceMacro(str(T), self.Macros)
-                    if self.ObjTargetDict.get(T.Target.SubDir):
-                        self.ObjTargetDict[T.Target.SubDir].add(NewFile)
-                    else:
+                    if not self.ObjTargetDict.get(T.Target.SubDir):
                         self.ObjTargetDict[T.Target.SubDir] = set()
-                        self.ObjTargetDict[T.Target.SubDir].add(NewFile)
+                    self.ObjTargetDict[T.Target.SubDir].add(NewFile)
 
                 Deps = []
                 CCodeDeps = []
--
2.14.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39244): https://edk2.groups.io/g/devel/message/39244
Mute This Topic: https://groups.io/mt/31207805/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to