]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Make AutoGen.h array declaration match AutoGen.c definition
authorScott Duplichan <scott@notabs.org>
Sun, 26 Jul 2015 08:04:10 +0000 (08:04 +0000)
committerjljusten <jljusten@Edk2>
Sun, 26 Jul 2015 08:04:10 +0000 (08:04 +0000)
When a quoted string is used as initialization data in a DEC file PCD
entry, the PCD data type in that entry must be VOID*. The created
AutoGen.c defines the PCD data as UINT8[] or UINT16[], depending on
the string type. The created AutoGen.h, however, declares the PCD data
as VOID*. For a standard compile/link, this works because AutoGen.c
doesn't include AutoGen.h. But when GCC LTO is used, the link time
code generation detects the mismatch and the build fails. This
change makes the AutoGen.h PCD data declaration match the AutoGen.c
definition.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18058 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/AutoGen/GenC.py

index e73ba79e28137848106e8efafefafa0bf0ee9e50..84bd607ea6c04dc5ade534fc1821db58b756c380 100644 (file)
@@ -1088,6 +1088,8 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
     if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:\r
         key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
         \r
     if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:\r
         key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))\r
         \r
+        if DatumType == 'VOID*' and Array == '[]':\r
+          DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']\r
         AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))\r
         AutoGenH.Append('#define %s  %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))\r
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)\r
         AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))\r
         AutoGenH.Append('#define %s  %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))\r
         AutoGenH.Append('//#define %s  ASSERT(FALSE)  // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)\r