Reviewed-by: Star Zeng <[email protected]>

-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Tian Feng
Sent: Monday, July 27, 2015 2:28 PM
To: Zeng, Star
Cc: [email protected]; Tian, Feng
Subject: [edk2] [patch] MdeModulePkg/UfsPassThru: Fix wrong 
GLOBAL_REMOVE_IF_UNREFERENCED usage

GLOBAL_REMOVE_IF_UNREFERENCED means __declspec(selectany) for MS tool chain 
IA32/X64 build.

According to MSDN, "selectany" would tell the compiler that the declared global 
data item (variable or object) is a pick-any COMDAT (a packaged function). At 
link time, if multiple definitions of a COMDAT are seen, the linker picks one 
and discards the rest.

So we have to remove GLOBAL_REMOVE_IF_UNREFERENCED key word from two global 
variable's extern definitions of .h file as we have used this keyword in .c 
file, otherwise the MS tool chain would pick the definitions in .h file and 
treat it as uninitialized data to generate full-0 content for these two global 
variables.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <[email protected]>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index 3d8e351..ce8066f 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -719,8 +719,8 @@ UfsExecNopCmds (
   IN  UFS_PASS_THRU_PRIVATE_DATA       *Private
   );
 
-extern GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gUfsPassThruComponentName; -extern GLOBAL_REMOVE_IF_UNREFERENCED 
EFI_COMPONENT_NAME2_PROTOCOL gUfsPassThruComponentName2;
-extern EFI_DRIVER_BINDING_PROTOCOL   gUfsPassThruDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL  gUfsPassThruComponentName; extern 
+EFI_COMPONENT_NAME2_PROTOCOL gUfsPassThruComponentName2; extern 
+EFI_DRIVER_BINDING_PROTOCOL  gUfsPassThruDriverBinding;
 
 #endif
--
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to