public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yu Liu" <liuyu@greatwall.com.cn>
To: jordan.l.justen@intel.com, afish@apple.com, 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
Date: Fri, 25 Sep 2020 13:48:49 +0800	[thread overview]
Message-ID: <f899ba18d2f4adf6394887a0661e1600a376d714.1601005909.git.liuyu@greatwall.com.cn> (raw)

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


             reply	other threads:[~2020-09-25  5:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25  5:48 Yu Liu [this message]
2020-09-25  8:59 ` [edk2-devel][PATCH] EmulatorPkg/Unix Prevents the compiler form optimizing unused variable Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f899ba18d2f4adf6394887a0661e1600a376d714.1601005909.git.liuyu@greatwall.com.cn \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox