Laszlo:
  Someone evaluates GCC LTO feature and detects this issue. Now, we have no 
clear plan to add LTO support. 

Thanks
Liming
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Thursday, January 28, 2016 1:34 AM
To: Zhu, Yonghong
Cc: edk2-de...@ml01.01.org; Scott Duplichan
Subject: Re: [edk2] [Patch] BaseTools: Fix the bug for VOID* Patchable PCD 
declaration in Library

On 01/27/16 10:18, Yonghong Zhu wrote:
> VOID* Patchable PCD in Library has the different declaration from the 
> one in Driver, this issue that will cause GCC LTO build failure.

Wow, you managed to build edk2 modules with -flto? How? Is that going to be 
added to BaseTools?

Thanks!
Laszlo

> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
> ---
>  BaseTools/Source/Python/AutoGen/GenC.py | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
> b/BaseTools/Source/Python/AutoGen/GenC.py
> index 93be718..3f0dfd9 100644
> --- a/BaseTools/Source/Python/AutoGen/GenC.py
> +++ b/BaseTools/Source/Python/AutoGen/GenC.py
> @@ -1,9 +1,9 @@
>  ## @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  # http://opensource.org/licenses/bsd-license.php
>  #
> @@ -1097,11 +1097,12 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, 
> Pcd):
>      GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + Pcd.TokenCName
>  
>      Type = ''
>      Array = ''
>      if Pcd.DatumType == 'VOID*':
> -        Type = '(VOID *)'
> +        if Pcd.DefaultValue[0]== '{':
> +            Type = '(VOID *)'
>          Array = '[]'
>      PcdItemType = Pcd.Type
>      PcdExCNameList  = []
>      if PcdItemType in gDynamicExPcd:
>          PcdExTokenName = '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + 
> Pcd.TokenCName @@ -1159,11 +1160,19 @@ def CreateLibraryPcdCode(Info, 
> AutoGenC, AutoGenH, Pcd):
>              else:
>                  AutoGenH.Append('#define %s(Value)  LibPcdSet%s(%s, 
> (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName))
>                  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))
>              AutoGenH.Append('#define %s(SizeOfBuffer, Buffer)  
> LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, 
> &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), 
> (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, 
> Pcd.TokenCName))
>          else:
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to