summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenC.py
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2018-03-17 15:25:32 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-04-10 13:58:14 +0800
commitc33081c912968da46fd6f0c7d2d2e52b7b410626 (patch)
treed4c118a8286deefb2e5e9e87e33294e16f8c51fd /BaseTools/Source/Python/AutoGen/GenC.py
parentf7b31aa540435f43f5c60e7bde456c272b31f7ee (diff)
downloadedk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.tar.gz
edk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.tar.bz2
edk2-c33081c912968da46fd6f0c7d2d2e52b7b410626.zip
BaseTools: Fix the bug for VOID* pcd max size from component section
When the Pcd defined in components section, its value's size is larger than the value's size in [pcd] section, it cause build error, because original code use the size get in [pcd] section as max size. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenC.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 3b17ec1895..58da9e6b17 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1109,9 +1109,14 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
ArraySize = ArraySize / 2;
if ArraySize < (len(Value) + 1):
- EdkLogger.error("build", AUTOGEN_ERROR,
+ if Pcd.MaxSizeUserSet:
+ EdkLogger.error("build", AUTOGEN_ERROR,
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName),
ExtraData="[%s]" % str(Info))
+ else:
+ ArraySize = GetPcdSize(Pcd)
+ if Unicode:
+ ArraySize = ArraySize / 2
Value = NewValue + '0 }'
Array = '[%d]' % ArraySize
#