BaseTools: Fix the bug for VOID* Patchable PCD declaration in Library
VOID* Patchable PCD in Library has the different declaration from the one in Driver, this issue that will cause GCC LTO build failure. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19766 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Routines for generating AutoGen.h and AutoGen.c
|
# Routines for generating AutoGen.h and AutoGen.c
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2016, 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
|
||||||
@ -1099,6 +1099,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||||||
Type = ''
|
Type = ''
|
||||||
Array = ''
|
Array = ''
|
||||||
if Pcd.DatumType == 'VOID*':
|
if Pcd.DatumType == 'VOID*':
|
||||||
|
if Pcd.DefaultValue[0]== '{':
|
||||||
Type = '(VOID *)'
|
Type = '(VOID *)'
|
||||||
Array = '[]'
|
Array = '[]'
|
||||||
PcdItemType = Pcd.Type
|
PcdItemType = Pcd.Type
|
||||||
@ -1161,7 +1162,15 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||||||
AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
|
AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
|
||||||
if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
|
if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||||
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
|
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
|
||||||
AutoGenH.Append('extern volatile %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array) )
|
if DatumType == 'VOID*':
|
||||||
|
ArraySize = int(Pcd.MaxDatumSize, 0)
|
||||||
|
if Pcd.DefaultValue[0] == 'L':
|
||||||
|
ArraySize = ArraySize / 2
|
||||||
|
Array = '[%d]' % ArraySize
|
||||||
|
DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
|
||||||
|
AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array))
|
||||||
|
else:
|
||||||
|
AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, PcdVariableName, Array))
|
||||||
AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
|
AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
|
||||||
if Pcd.DatumType == 'VOID*':
|
if Pcd.DatumType == 'VOID*':
|
||||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
|
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
|
||||||
|
Reference in New Issue
Block a user