From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4C6CD941AE6 for ; Wed, 16 Aug 2023 17:41:35 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QSRlIJ9sLII4wto+g3YbpMWCcdISsyDojh1tiMBDZMY=; c=relaxed/simple; d=groups.io; h=From:Message-id:MIME-version:Subject:Date:In-reply-to:Cc:To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-type; s=20140610; t=1692207693; v=1; b=BHIClAL6xxGSHWkdQlRAZZ6IM4lGY9FiYPtdIfyPLFTjw76lTm9WGvOYhE0C7oaxO67DhGy9 MfEqEFLZEaZk/TWPo0A88TDhe8PsFDopzPRstucg99Qf5/wCsmz3iqwmQERzDZAkQo1WK3mtdXY /QY2tHnwXaDIK8joeBGEnUys= X-Received: by 127.0.0.2 with SMTP id yE3FYY7687511xNRqEpmtWe3; Wed, 16 Aug 2023 10:41:33 -0700 X-Received: from ma-mailsvcp-mx-lapp02.apple.com (ma-mailsvcp-mx-lapp02.apple.com [17.32.222.23]) by mx.groups.io with SMTP id smtpd.web10.167128.1692207693166432364 for ; Wed, 16 Aug 2023 10:41:33 -0700 X-Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by ma-mailsvcp-mx-lapp02.apple.com (Oracle Communications Messaging Server 8.1.0.23.20230328 64bit (built Mar 28 2023)) with ESMTPS id <0RZH011Q9VT2JB20@ma-mailsvcp-mx-lapp02.apple.com> for devel@edk2.groups.io; Wed, 16 Aug 2023 10:41:32 -0700 (PDT) X-Proofpoint-GUID: 1rXpJK9eLZAY5bwmjmt-yeBMsx5bFXW- X-Proofpoint-ORIG-GUID: 1rXpJK9eLZAY5bwmjmt-yeBMsx5bFXW- X-Received: from rn-mailsvcp-mmp-lapp04.rno.apple.com (rn-mailsvcp-mmp-lapp04.rno.apple.com [17.179.253.17]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.23.20230328 64bit (built Mar 28 2023)) with ESMTPS id <0RZH00ORZVT5OCM0@rn-mailsvcp-mta-lapp02.rno.apple.com>; Wed, 16 Aug 2023 10:41:29 -0700 (PDT) X-Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp04.rno.apple.com by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.23.20230328 64bit (built Mar 28 2023)) id <0RZH00600VM4J500@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Wed, 16 Aug 2023 10:41:29 -0700 (PDT) X-Va-A: X-Va-T-CD: 70a38c3f5b1d46c4b8dccb3b011be358 X-Va-E-CD: 81f81af75f72de43e63df40d8c881d19 X-Va-R-CD: 24cf420fcec2b9c8475fa14e52ebe880 X-Va-ID: db6e332c-ae16-476a-a138-8edf778e5c29 X-Va-CD: 0 X-V-A: X-V-T-CD: 70a38c3f5b1d46c4b8dccb3b011be358 X-V-E-CD: 81f81af75f72de43e63df40d8c881d19 X-V-R-CD: 24cf420fcec2b9c8475fa14e52ebe880 X-V-ID: da46fde9-fc1b-4417-b6cc-cbcf9d14069a X-V-CD: 0 X-Received: from smtpclient.apple (unknown [17.115.2.193]) by rn-mailsvcp-mmp-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.23.20230328 64bit (built Mar 28 2023)) with ESMTPSA id <0RZH00I1FVT4O700@rn-mailsvcp-mmp-lapp04.rno.apple.com>; Wed, 16 Aug 2023 10:41:29 -0700 (PDT) From: "Andrew Fish via groups.io" Message-id: <4F62ED19-552E-4AAB-B2E4-6AE48C5A1131@apple.com> MIME-version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: =?UTF-8?B?UmU6IFtlZGsyLWRldmVsXSBDYW4gUkVMRUFTRSB0YXJnZXQgZGlzYWJsZSAtV2Vycm9yIENDX0ZMQUfvvJ8=?= Date: Wed, 16 Aug 2023 10:41:18 -0700 In-reply-to: Cc: "wangliu@iscas.ac.cn" To: edk2-devel-groups-io , Mike Kinney References: <6070b08a.ddbe.189df0c0736.Coremail.wangliu@iscas.ac.cn> <3CAEAC07-F07D-4C4B-A5CB-CE2080C52411@apple.com> <4cf11a2b.5a87.189fd4f6d62.Coremail.wangliu@iscas.ac.cn> Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,afish@apple.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IACElhzDHLGhkWn5fh16ISrcx7686176AA= Content-type: multipart/alternative; boundary="Apple-Mail=_49CFB3E8-92DF-4572-A015-0454B34169AC" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=BHIClAL6; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --Apple-Mail=_49CFB3E8-92DF-4572-A015-0454B34169AC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Mike, I seem to remember it was a maybe-uninitialized compiler error. The DEBUG b= uild did not hit it due to the NULL check in the ASSERT. The NULL check onl= y exists if ASSERT() is enabled. So if ASSERT is disabled this code in the = DXE Core will dereference a NULL pointer.=20 > ASSERT (Prot !=3D NULL); > //=20 > // EFI_ALREADY_STARTED is not an error for bus driver. > // Return the corresponding protocol interface. > //=20 > *Interface =3D Prot->Interface; Thanks, Andrew Fish > On Aug 16, 2023, at 10:02 AM, Michael D Kinney wrote: >=20 > Can you provide the specific build error? > =20 > So far, we have not had to relax that flag for any RELEASE builds. > =20 > Thanks, > =20 > Mike > =20 > From: devel@edk2.groups.io > On Behalf Of ?? > Sent: Wednesday, August 16, 2023 12:46 AM > To: Andrew (EFI) Fish > > Cc: edk2-devel-groups-io > > Subject: Re: [edk2-devel] Can RELEASE target disable -Werror CC_FLAG=EF= =BC=9F > =20 > 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. >=20 > =20 >=20 > ---=20 > OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc | 2 +-=20 > 1 file changed, 1 insertion(+), 1 deletion(-)=20 >=20 > diff --git a/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc b/OvmfPkg/RiscVVirt/Risc= VVirtQemu.dsc=20 > index 28d9af4..ac3b5ec 100644=20 > --- a/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc=20 > +++ b/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc=20 > @@ -54,7 +54,7 @@=20 > !include MdePkg/MdeLibs.dsc.inc=20 >=20 > [BuildOptions]=20 > - GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=20 > + GCC:RELEASE_*_*_CC_FLAGS =3D -flto=20 > !ifdef $(SOURCE_DEBUG_ENABLE)=20 > GCC:*_*_RISCV64_GENFW_FLAGS =3D --keepexceptiontable=20 > !endif=20 > --=20 > 2.39.1 >=20 >=20 > I have added the LTO flag and dropped MDEPKG_NDEBUG in the .dsc file, it = compiled successfully, the build log:https://build.tarsier-infra.com/packag= e/live_build_log/home:ouuleilei:branches:openEuler:Mainline/edk2/openEuler_= Mainline_standard_riscv64_gcc/riscv64 >=20 > Do you have other way to add LTO flag to compile that don't change the so= urce code, i tried to use environment variable, like exported CFLAGS=3D-flt= o to compile, but the compiler doesn't work with it. >=20 > =20 > =20 >=20 > =20 >=20 > =20 >=20 > -----=E5=8E=9F=E5=A7=8B=E9=83=B5=E4=BB=B6----- > =E7=99=BC=E4=BB=B6=E4=BA=BA:"Andrew (EFI) Fish" > > =E7=99=BC=E9=80=81=E6=99=82=E9=96=93:2023-08-10 21:50:55 (=E6=98=9F=E6=9C= =9F=E5=9B=9B) > =E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io >, wangliu@iscas.ac.cn > =E6=8A=84=E9=80=81:=20 > =E4=B8=BB=E9=A1=8C: Re: [edk2-devel] Can RELEASE target disable -Werror C= C_FLAG=EF=BC=9F >=20 > 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? > =20 > /home/abuild/rpmbuild/BUILD/edk2-edk2-stable202305/MdeModulePkg/Core/Dxe/= Hand/Handle.c:1183:24: error: =E2=80=98Prot=E2=80=99 may be used uninitiali= zed [-Werror=3Dmaybe-uninitialized] > ASSERT (Prot !=3D NULL); > //=20 > // EFI_ALREADY_STARTED is not an error for bus driver. > // Return the corresponding protocol interface. > //=20 > *Interface =3D Prot->Interface; > =20 > A given platform can add ASSERT into release builds if it wants. I=E2=80= =99ve 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 u= sed a PCD to configure your debug level, per build type. =20 > =20 > Maybe we should just have the error checks in all paths? > =20 > Thanks,=20 > =20 > Andrew Fish=20 >=20 >=20 > On Aug 10, 2023, at 6:44 AM, =E6=B1=AA=E6=B5=81 > wrote: > =20 > 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 -We= rror flag. > My build target was release. I think the flag should used in the debug ,n= ot in release. > My build command: build -t GCC5 -n $NCPUS -b RELEASE -a RISCV64 -p OvmfP= kg/RiscVVirt/RiscVVirtQemu.dsc -D SECURE_BOOT_ENABLE=3DTRUE -D TPM_ENABLE= =3DTRUE -D TPM_CONFIG_ENABLE=3DTRUE > This is my packet log: =20 >=20 > https://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:bra= nches:home:ouuleilei:branches:openEuler:Mainline/edk2-test/openEuler_Mainli= ne_standard_riscv64_gcc/riscv64 >=20 > https://build.tarsier-infra.com/build/home:ouuleilei:branches:home:ouulei= lei:branches:openEuler:Mainline/openEuler_Mainline_standard_riscv64_gcc/ris= cv64/edk2-test/_log > =20 >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107801): https://edk2.groups.io/g/devel/message/107801 Mute This Topic: https://groups.io/mt/100663199/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --Apple-Mail=_49CFB3E8-92DF-4572-A015-0454B34169AC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Mike,

I seem t= o remember it was a maybe-unini= tialized compiler error. The DEBUG build did not hit it due to = the NULL check in the ASSERT. The NULL check only exists if ASSERT() is ena= bled. So if ASSERT is disabled this code in the DXE Core will dereference a= NULL pointer. 

      ASSERT (Pr= ot !=3D NULL);
      // 
=
      // EFI_= ALREADY_STARTED is not an error for bus driver.
      // Re= turn the corresponding protocol interface.
      // 
=       *Interface =3D Prot->Interface;

<= /div>
Thanks,

Andrew Fish

On Aug 16, 2023, at 10:02 AM, Michael D Kinney <m= ichael.d.kinney@intel.com> wrote:

Can you provide the specific build error?=
 
So far, we have not had to = relax that flag for any RELEASE builds.
 
Thanks,
 
Mike
 
From: devel@edk2.group= s.io <devel@edk2.groups.io> = ;On Behalf Of <= /b>??
Sent: Wed= nesday, August 16, 2023 12:46 AM
To: Andrew (EFI) Fish <afish@apple.com&= gt;
Cc: edk2-de= vel-groups-io <devel@edk2.groups.io>
Subjec= t: Re: [edk2-devel] C= an RELEASE target disable -Werror CC_FLAG=EF=BC=9F
&= nbsp;

Yes, the RELEASE = build compiler flags should be relaxed, all error checks that the DEBUG tar= get should do, it doesn't belong to the RELEASE's job.

 

--- 
OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc | 2 +- 
1 file changed, 1 insertion(+), 1 deletion(-) 


diff --git a/OvmfPk= g/RiscVVirt/RiscVVirtQemu.dsc b/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc 
index 28d9af4..ac3b5ec 10064= 4 
--- a/OvmfPkg/RiscV= Virt/RiscVVirtQemu.dsc +++ b/OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc 
@@ -54,7 +54,7 @@ 
!include MdePkg/MdeLibs.dsc.inc 

[BuildOptions] 
-  GCC:RELEASE_*_*_CC_FLAGS   &= nbsp;   =3D -DMDEPKG_NDEBUG 
+  GCC:RELEASE_*_*_CC_FLAGS    &n= bsp;  =3D -flto 
!ifdef $(SOURCE_DEBUG_ENABLE)&nb= sp;
  GCC:*_*_RISCV64_GENFW_FLAGS    =3D= --keepexceptiontable !endif 
-- 
2.39.1

I have added the LTO flag and= dropped MDEPKG_NDEBUG in the .dsc file, it compiled successfully, the buil= d log:https= ://build.tarsier-infra.com/package/live_build_log/home:ouuleilei:branches:o= penEuler:Mainline/edk2/openEuler_Mainline_standard_riscv64_gcc/riscv64<= /span>

Do you have o= ther way to add LTO flag to compile that don't change the source code, i tr= ied to use environment variable, like exported CFLAGS=3D-flto to compile, b= ut the compiler doesn't work with it.

 

 

 

 

-----=E5=8E=9F=E5=A7=8B=E9=83=B5=E4=BB=B6-----
=E7=99=BC= =E4=BB=B6=E4=BA=BA:"Andrew (EFI) Fish" <afish@apple.com>
=E7=99=BC=E9=80=81=E6=99=82=E9=96=93:2023-08-10 21:50:55 (= =E6=98=9F=E6=9C=9F=E5=9B=9B)
=E6=94=B6=E4=BB=B6=E4=BA=BA: edk2-devel-groups-io <
devel@edk2.groups.io>, wangliu@iscas.ac.cn
=E6=8A=84=E9=80= =81: 
=E4=B8=BB= =E9=A1=8C: Re: [edk2-= devel] Can RELEASE target disable -Werror CC_FLAG=EF=BC=9F

I think that you a= re advocating that since we have code that error checks on DEBUG and not RE= LEASE builds we should relax the RELEASE build compiler flags?
 =
/h=
ome/abuild/rpmbuild/BUILD/edk2-edk2-stable202305/MdeModulePkg/Core/Dxe/Hand=
/Handle.c:1183:24: error: =E2=80=98Prot=E2=80=99 may be used uninitialized =
[-Werror=3Dmaybe-uninitialized]
      ASSERT (Prot !=3D NUL= L);
      // 
      // EFI_ALREADY_STARTED is not an error for bus d= river.
      // Return the corresponding protocol interface= .
      // 
      *Interface =3D Prot->Interface;
 
A give= n platform can add ASSERT into release builds if it wants. I=E2=80=99ve act= ually 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.  
 
Maybe we should just have the error= checks in all paths?
 
Thanks, 
 
Andrew Fish 


On Aug 10, 2023, at 6:44 AM, =E6=B1=AA=E6=B5=81 <wang= liu@iscas.ac.cn> wrote:
 
I want to build a rpm package for edk2-stable2= 02305 on riscv64, however I get some uninitialized variable error, I have f= ound that the reason is -Werror flag.
My build target was release. I thi= nk the flag should used in the debug ,not in release.
My build command:&= nbsp; build -t GCC5 -n $NCPUS -b RELEASE -a RISCV64 -p OvmfPkg/RiscVVirt/Ri= scVVirtQemu.dsc -D SECURE_BOOT_ENABLE=3DTRUE -D TPM_ENABLE=3DTRUE -D TPM_CO= NFIG_ENABLE=3DTRUE

This is my packet log:    

https://build.tarsier-infra.com/package/live_build= _log/home:ouuleilei:branches:home:ouuleilei:branches:openEuler:Mainline/edk= 2-test/openEuler_Mainline_standard_riscv64_gcc/riscv64

 


_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#107801) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--Apple-Mail=_49CFB3E8-92DF-4572-A015-0454B34169AC--