[edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable

Ni, Ray ray.ni at intel.com
Fri Sep 25 08:59:32 UTC 2020


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

Thanks,
Ray

> -----Original Message-----
> From: LiuYu <liuyu at greatwall.com.cn>
> Sent: Friday, September 25, 2020 1:49 PM
> To: Justen, Jordan L <jordan.l.justen at intel.com>; afish at apple.com; Ni, Ray <ray.ni at intel.com>
> Cc: devel at edk2.groups.io; LiuYu <liuyu at 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 at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#65619): https://edk2.groups.io/g/devel/message/65619
Mute This Topic: https://groups.io/mt/77074006/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list