MdeModulePkg PiSmmCore: Remove unreferenced symbol for SMRAM profile
authorStar Zeng <star.zeng@intel.com>
Tue, 14 Mar 2017 08:51:31 +0000 (16:51 +0800)
committerStar Zeng <star.zeng@intel.com>
Wed, 15 Mar 2017 08:47:10 +0000 (16:47 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=370

Use GLOBAL_REMOVE_IF_UNREFERENCED for some SMRAM profile global variables,
then their symbols could be removed when SMRAM profile is disabled.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c

index dda9f12..410e083 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support routines for SMRAM profile.\r
 \r
-  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -77,11 +77,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mSmramProfileContext =
 };\r
 GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mSmramProfileContextPtr = NULL;\r
 \r
-BOOLEAN mSmramReadyToLock;\r
-BOOLEAN mSmramProfileGettingStatus = FALSE;\r
-BOOLEAN mSmramProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE;\r
-EFI_DEVICE_PATH_PROTOCOL *mSmramProfileDriverPath;\r
-UINTN                    mSmramProfileDriverPathSize;\r
+GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramReadyToLock;\r
+GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramProfileGettingStatus = FALSE;\r
+GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSmramProfileRecordingEnable = MEMORY_PROFILE_RECORDING_DISABLE;\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_PROTOCOL *mSmramProfileDriverPath;\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN                    mSmramProfileDriverPathSize;\r
 \r
 /**\r
   Dump SMRAM infromation.\r
@@ -232,7 +232,7 @@ SmramProfileProtocolRecord (
   IN CHAR8                              *ActionString OPTIONAL\r
   );\r
 \r
-EDKII_SMM_MEMORY_PROFILE_PROTOCOL mSmmProfileProtocol = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EDKII_SMM_MEMORY_PROFILE_PROTOCOL mSmmProfileProtocol = {\r
   SmramProfileProtocolGetData,\r
   SmramProfileProtocolRegisterImage,\r
   SmramProfileProtocolUnregisterImage,\r
@@ -2630,7 +2630,7 @@ typedef struct {
   CHAR8                 *String;\r
 } ACTION_STRING;\r
 \r
-ACTION_STRING mExtActionString[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED ACTION_STRING mExtActionString[] = {\r
   {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_PAGES,                    "Lib:AllocatePages"},\r
   {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_PAGES,            "Lib:AllocateRuntimePages"},\r
   {MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_PAGES,           "Lib:AllocateReservedPages"},\r
@@ -2654,8 +2654,6 @@ ACTION_STRING mExtActionString[] = {
   {MEMORY_PROFILE_ACTION_LIB_REALLOCATE_RESERVED_POOL,          "Lib:ReallocateReservedPool"},\r
 };\r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mUserDefinedActionString[] = {"UserDefined-0x80000000"};\r
-\r
 typedef struct {\r
   EFI_MEMORY_TYPE   MemoryType;\r
   CHAR8             *MemoryTypeStr;\r