<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:MingLiU;
        panose-1:2 1 6 9 0 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"\@MingLiU";
        panose-1:2 1 6 9 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-ligatures:none;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Can you provide the specific build error?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So far, we have not had to relax that flag for any RELEASE builds.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Mike<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> devel@edk2.groups.io <devel@edk2.groups.io> <b>
On Behalf Of </b>??<br>
<b>Sent:</b> Wednesday, August 16, 2023 12:46 AM<br>
<b>To:</b> Andrew (EFI) Fish <afish@apple.com><br>
<b>Cc:</b> edk2-devel-groups-io <devel@edk2.groups.io><br>
<b>Subject:</b> Re: [edk2-devel] Can RELEASE target disable -Werror CC_FLAG<span style="font-family:"MS Gothic"">?</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-family:MingLiU">Yes, the RELEASE build compiler flags should be relaxed, all error checks that the DEBUG target should do, it doesn't belong to the RELEASE's job.</span>
<o:p></o:p></p>
<p><o:p> </o:p></p>
<p style="margin-bottom:12.0pt"><span style="font-family:MingLiU">--- <br>
OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc | 2 +- <br>
1 file changed, 1 insertion(+), 1 deletion(-) <br>
<br>
diff --git a/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc b/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc
<br>
index 28d9af4..ac3b5ec 100644 <br>
--- a/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc <br>
+++ b/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc <br>
@@ -54,7 +54,7 @@ <br>
!include MdePkg/MdeLibs.dsc.inc <br>
<br>
[BuildOptions] <br>
-  GCC:RELEASE_*_*_CC_FLAGS       = -DMDEPKG_NDEBUG <br>
+  GCC:RELEASE_*_*_CC_FLAGS       = -flto <br>
!ifdef $(SOURCE_DEBUG_ENABLE) <br>
  GCC:*_*_RISCV64_GENFW_FLAGS    = --keepexceptiontable <br>
!endif <br>
-- <br>
2.39.1<br>
<br>
</span><o:p></o:p></p>
<p><span style="font-family:MingLiU">I have added the LTO flag and dropped MDEPKG_NDEBUG in the .dsc file, it compiled successfully, the build log:
<a href="https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:openEuler:Mainline/edk2/openEuler_Mainline_standard_riscv64_gcc/riscv64">
https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:openEuler:Mainline/edk2/openEuler_Mainline_standard_riscv64_gcc/riscv64</a></span>
<o:p></o:p></p>
<p><span style="font-family:MingLiU">Do you have other way to add LTO flag to compile that don't change the source code, i tried to use environment variable, like exported CFLAGS=-flto to compile, but the compiler doesn't work with it.</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<p><span style="font-family:MingLiU"><o:p> </o:p></span></p>
<p><span style="font-family:MingLiU"><o:p> </o:p></span></p>
<p><span style="font-family:MingLiU"><o:p> </o:p></span></p>
<blockquote style="border:none;border-left:solid #B6B6B6 1.5pt;padding:0in 0in 0in 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt" name="replyContent">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:MingLiU">-----原始郵件-----<br>
<b>發件人:</b>"Andrew (EFI) Fish" <<a href="mailto:afish@apple.com">afish@apple.com</a>><br>
<b>發送時間:</b>2023-08-10 21:50:55 (星期四)<br>
<b>收件人:</b> edk2-devel-groups-io <<a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>>,
<a href="mailto:wangliu@iscas.ac.cn">wangliu@iscas.ac.cn</a><br>
<b>抄送:</b> <br>
<b>主題:</b> Re: [edk2-devel] Can RELEASE target disable -Werror CC_FLAG?<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">I think that you are advocating that since we have code that error checks on DEBUG and not RELEASE builds we should relax the RELEASE build compiler flags?
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<div>
<pre style="background:#F8F9FA;box-sizing:border-box;margin-bottom:1rem;white-space:pre-wrap;caret-color:#212529;padding:1.5rem !important;overflow:auto" id="log-space"><span style="font-size:8.5pt;font-family:Consolas;color:#212529">/home/abuild/rpmbuild/BUILD/edk2-edk2-stable202305/MdeModulePkg/Core/Dxe/Hand/Handle.c:1183:24: error: ‘Prot’ may be used uninitialized [-Werror=maybe-uninitialized]<o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      ASSERT (Prot != NULL);
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      // <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      // EFI_ALREADY_STARTED is not an error for bus driver.
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      // Return the corresponding protocol interface.
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      // <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">      *Interface = Prot->Interface;
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">A given platform can add ASSERT into release builds if it wants. I’ve actually done that for power on before. If your compiler supports LTO you are not required to set MDEPKG_NDEBUG on RELEASE builds, and
 you can used a PCD to configure your debug level, per build type.  <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">Maybe we should just have the error checks in all paths?
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">Thanks, <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">Andrew Fish <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU"><br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">On Aug 10, 2023, at 6:44 AM, 汪流 <<a href="mailto:wangliu@iscas.ac.cn">wangliu@iscas.ac.cn</a>> wrote:
<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-family:MingLiU">I want to build a rpm package for edk2-stable202305 on riscv64, however I get some uninitialized variable error, I have found that the reason is -Werror flag.<br>
My build target was release. I think the flag should used in the debug ,not in release.<br>
My build command:  build -t GCC5 -n $NCPUS -b RELEASE -a RISCV64 -p OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc -D SECURE_BOOT_ENABLE=TRUE -D TPM_ENABLE=TRUE -D TPM_CONFIG_ENABLE=TRUE<o:p></o:p></span></p>
<p><span style="font-family:MingLiU">This is my packet log:    <o:p></o:p></span></p>
<p><span style="font-family:MingLiU"><a href="https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/edk2-test/openEuler_Mainline_standard_riscv64_gcc/riscv64">https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/edk2-test/openEuler_Mainline_standard_riscv64_gcc/riscv64</a>
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:MingLiU"><a href="https://build.tarsier-infra.com/build/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/openEuler_Mainline_standard_riscv64_gcc/riscv64/edk2-test/_log">https://build.tarsier-infra.com/build/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/openEuler_Mainline_standard_riscv64_gcc/riscv64/edk2-test/_log</a><o:p></o:p></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span style="font-family:MingLiU"><o:p> </o:p></span></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"></o:p></span></p>
</div>
</div>
</div>
</body>
</html>


<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>


Groups.io Links:<p>


  
    You receive all messages sent to this group.
  
  


<p>
<a target="_blank" href="https://edk2.groups.io/g/devel/message/107799">View/Reply Online (#107799)</a> |


  

|

  <a target="_blank" href="https://groups.io/mt/100663199/1813853">Mute This Topic</a>


| <a href="https://edk2.groups.io/g/devel/post">New Topic</a>

<br>




<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>