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>
This commit is contained in:
@ -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
|
||||
#
|
||||
|
Reference in New Issue
Block a user