Revision: 19766
          http://sourceforge.net/p/edk2/code/19766
Author:   yzhu52
Date:     2016-01-29 04:46:47 +0000 (Fri, 29 Jan 2016)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py

Modified: trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py  2016-01-29 04:44:54 UTC 
(rev 19765)
+++ trunk/edk2/BaseTools/Source/Python/AutoGen/GenC.py  2016-01-29 04:46:47 UTC 
(rev 19766)
@@ -1,7 +1,7 @@
 ## @file
 # 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
 # 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
@@ -1099,7 +1099,8 @@
     Type = ''
     Array = ''
     if Pcd.DatumType == 'VOID*':
-        Type = '(VOID *)'
+        if Pcd.DefaultValue[0]== '{':
+            Type = '(VOID *)'
         Array = '[]'
     PcdItemType = Pcd.Type
     PcdExCNameList  = []
@@ -1161,7 +1162,15 @@
                 AutoGenH.Append('#define %s(Value)  LibPcdSet%sS(%s, 
(Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
     if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
         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))
         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))


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to