mirror of https://github.com/acidanthera/audk.git
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:
parent
f7b31aa540
commit
c33081c912
|
@ -2354,6 +2354,7 @@ class PlatformAutoGen(AutoGen):
|
||||||
|
|
||||||
if FromPcd.MaxDatumSize:
|
if FromPcd.MaxDatumSize:
|
||||||
ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
|
ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
|
||||||
|
ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize
|
||||||
if FromPcd.DefaultValue:
|
if FromPcd.DefaultValue:
|
||||||
ToPcd.DefaultValue = FromPcd.DefaultValue
|
ToPcd.DefaultValue = FromPcd.DefaultValue
|
||||||
if FromPcd.TokenValue:
|
if FromPcd.TokenValue:
|
||||||
|
@ -2456,6 +2457,7 @@ class PlatformAutoGen(AutoGen):
|
||||||
for Name, Guid in Pcds:
|
for Name, Guid in Pcds:
|
||||||
Pcd = Pcds[Name, Guid]
|
Pcd = Pcds[Name, Guid]
|
||||||
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
|
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
|
||||||
|
Pcd.MaxSizeUserSet = None
|
||||||
Value = Pcd.DefaultValue
|
Value = Pcd.DefaultValue
|
||||||
if Value in [None, '']:
|
if Value in [None, '']:
|
||||||
Pcd.MaxDatumSize = '1'
|
Pcd.MaxDatumSize = '1'
|
||||||
|
@ -4157,9 +4159,12 @@ class ModuleAutoGen(AutoGen):
|
||||||
Padding = Padding * 2
|
Padding = Padding * 2
|
||||||
ArraySize = ArraySize / 2
|
ArraySize = ArraySize / 2
|
||||||
if ArraySize < (len(PcdValue) + 1):
|
if ArraySize < (len(PcdValue) + 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)
|
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
ArraySize = len(PcdValue) + 1
|
||||||
if ArraySize > len(PcdValue) + 1:
|
if ArraySize > len(PcdValue) + 1:
|
||||||
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
|
NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1)
|
||||||
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
|
PcdValue = NewValue + Padding.strip().rstrip(',') + '}'
|
||||||
|
@ -4167,9 +4172,12 @@ class ModuleAutoGen(AutoGen):
|
||||||
PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))
|
PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(',')))
|
||||||
PcdValue += '}'
|
PcdValue += '}'
|
||||||
else:
|
else:
|
||||||
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)
|
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName)
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
ArraySize = len(PcdValue) + 1
|
||||||
PcdItem = '%s.%s|%s|0x%X' % \
|
PcdItem = '%s.%s|%s|0x%X' % \
|
||||||
(Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1])
|
(Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1])
|
||||||
PcdComments = ''
|
PcdComments = ''
|
||||||
|
|
|
@ -1109,9 +1109,14 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||||
ArraySize = ArraySize / 2;
|
ArraySize = ArraySize / 2;
|
||||||
|
|
||||||
if ArraySize < (len(Value) + 1):
|
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),
|
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName),
|
||||||
ExtraData="[%s]" % str(Info))
|
ExtraData="[%s]" % str(Info))
|
||||||
|
else:
|
||||||
|
ArraySize = GetPcdSize(Pcd)
|
||||||
|
if Unicode:
|
||||||
|
ArraySize = ArraySize / 2
|
||||||
Value = NewValue + '0 }'
|
Value = NewValue + '0 }'
|
||||||
Array = '[%d]' % ArraySize
|
Array = '[%d]' % ArraySize
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Routines for generating Pcd Database
|
# Routines for generating Pcd Database
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -1390,9 +1390,12 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
||||||
if Pcd.MaxDatumSize != '':
|
if Pcd.MaxDatumSize != '':
|
||||||
MaxDatumSize = int(Pcd.MaxDatumSize, 0)
|
MaxDatumSize = int(Pcd.MaxDatumSize, 0)
|
||||||
if MaxDatumSize < Size:
|
if MaxDatumSize < Size:
|
||||||
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, Pcd.TokenCName),
|
"The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||||
ExtraData="[%s]" % str(Platform))
|
ExtraData="[%s]" % str(Platform))
|
||||||
|
else:
|
||||||
|
MaxDatumSize = Size
|
||||||
else:
|
else:
|
||||||
MaxDatumSize = Size
|
MaxDatumSize = Size
|
||||||
StringTabLen = MaxDatumSize
|
StringTabLen = MaxDatumSize
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# This file is used to define each component of the build database
|
# This file is used to define each component of the build database
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -55,6 +55,7 @@ class PcdClassObject(object):
|
||||||
self.DefaultValue = Value
|
self.DefaultValue = Value
|
||||||
self.TokenValue = Token
|
self.TokenValue = Token
|
||||||
self.MaxDatumSize = MaxDatumSize
|
self.MaxDatumSize = MaxDatumSize
|
||||||
|
self.MaxSizeUserSet = None
|
||||||
self.SkuInfoList = SkuInfoList
|
self.SkuInfoList = SkuInfoList
|
||||||
self.Phase = "DXE"
|
self.Phase = "DXE"
|
||||||
self.Pending = False
|
self.Pending = False
|
||||||
|
|
Loading…
Reference in New Issue