public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable
@ 2020-09-25  5:48 Yu Liu
  2020-09-25  8:59 ` Ni, Ray
  0 siblings, 1 reply; 2+ messages in thread
From: Yu Liu @ 2020-09-25  5:48 UTC (permalink / raw)
  To: jordan.l.justen, afish, ray.ni; +Cc: devel, LiuYu

gInXcode is only used by GDB script and if optimization is turned on then compiler
treats this variable as unused so it can't been linked in the final object.

Signed-off-by: LiuYu <liuyu@greatwall.com.cn>
---
 EmulatorPkg/Unix/Host/Host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index b4e5510613..b851264c8e 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -54,7 +54,7 @@ IMAGE_CONTEXT_TO_MOD_HANDLE  *mImageContextModHandleArray = NULL;
 EFI_PEI_PPI_DESCRIPTOR  *gPpiList;
 
 
-int gInXcode = 0;
+int gInXcode  __attribute__((used)) = 0;
 

 /*++
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable
  2020-09-25  5:48 [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable Yu Liu
@ 2020-09-25  8:59 ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2020-09-25  8:59 UTC (permalink / raw)
  To: LiuYu, Justen, Jordan L, afish@apple.com; +Cc: devel@edk2.groups.io

Jordan, Andrew,
I will defer to you to review the patch.

Thanks,
Ray

> -----Original Message-----
> From: LiuYu <liuyu@greatwall.com.cn>
> Sent: Friday, September 25, 2020 1:49 PM
> To: Justen, Jordan L <jordan.l.justen@intel.com>; afish@apple.com; Ni, Ray <ray.ni@intel.com>
> Cc: devel@edk2.groups.io; LiuYu <liuyu@greatwall.com.cn>
> Subject: [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable
> 
> gInXcode is only used by GDB script and if optimization is turned on then compiler
> treats this variable as unused so it can't been linked in the final object.
> 
> Signed-off-by: LiuYu <liuyu@greatwall.com.cn>
> ---
>  EmulatorPkg/Unix/Host/Host.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
> index b4e5510613..b851264c8e 100644
> --- a/EmulatorPkg/Unix/Host/Host.c
> +++ b/EmulatorPkg/Unix/Host/Host.c
> @@ -54,7 +54,7 @@ IMAGE_CONTEXT_TO_MOD_HANDLE  *mImageContextModHandleArray = NULL;
>  EFI_PEI_PPI_DESCRIPTOR  *gPpiList;
> 
> 
> -int gInXcode = 0;
> +int gInXcode  __attribute__((used)) = 0;
> 
> 
>  /*++
> --
> 2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-25  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25  5:48 [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable Yu Liu
2020-09-25  8:59 ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox