From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D145721CB8666 for ; Tue, 9 Jan 2018 19:40:06 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 19:45:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,338,1511856000"; d="scan'208";a="18035920" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 09 Jan 2018 19:45:17 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 9 Jan 2018 19:45:17 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 9 Jan 2018 19:45:16 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by shsmsx102.ccr.corp.intel.com ([169.254.2.189]) with mapi id 14.03.0319.002; Wed, 10 Jan 2018 11:45:14 +0800 From: "Gao, Liming" To: Michael Zimmermann CC: "Kinney, Michael D" , "edk2-devel@lists.01.org" , Ard Biesheuvel Thread-Topic: [edk2] [PATCH v3 3/3] MdePkg: add NORETURN attribute to LongJump and InternalLongJump Thread-Index: AQHTf0jzMNUZbVOEwUGKDWcqkidlD6NphLcw//+IrgCAA3514A== Date: Wed, 10 Jan 2018 03:45:14 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1A10E6@SHSMSX104.ccr.corp.intel.com> References: <20171227192850.26774-1-sigmaepsilon92@gmail.com> <20171227192850.26774-2-sigmaepsilon92@gmail.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E1A022D@SHSMSX104.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 3/3] MdePkg: add NORETURN attribute to LongJump and InternalLongJump X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 03:40:07 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Michael: Just push the change on RETURNS_TWICE > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Mi= chael Zimmermann > Sent: Monday, January 8, 2018 2:22 PM > To: Gao, Liming > Cc: Kinney, Michael D ; edk2-devel@lists.01.o= rg; Ard Biesheuvel > Subject: Re: [edk2] [PATCH v3 3/3] MdePkg: add NORETURN attribute to Long= Jump and InternalLongJump >=20 > Liming: > It's not required to fix the bug which generates bad code. The NORETURN > attribute just fixes the compiler warning mentioned in the commit message > so I'm fine with separating this patch from the series. >=20 > And actually this "unreachable code" warning sounds like a more complicat= ed > problem because while the compiler is right and the code after the call t= o > LongJump should never run there is a slight possibility for that to happe= n > anyway - just imagine that because of memory corruption the PC/LR inside > the jump buffer point to after the call of longjump. >=20 > On Mon, Jan 8, 2018 at 6:34 AM, Gao, Liming wrote: >=20 > > Michael: > > After more test, this patch will cause MdeModulePkg DxeCore link fail= ure > > on VS2015x86 tool chain. The warning message is caused by NORETURN > > attribute in LongJump() API. Is this patch really required? Could we > > separate it from the change RETURNS_TWICE? If yes, I suggest to commit > > RETURNS_TWICE patch first, then work out the solution on NORETURN attri= bute > > enabling. > > > > c:\edk2\mdemodulepkg\core\dxe\image\image.c(1863) : error C2220: warnin= g > > treated as error - no 'executable' file generated > > c:\edk2\mdemodulepkg\core\dxe\image\image.c(1863) : warning C4702: > > unreachable code > > c:\edk2\mdemodulepkg\core\dxe\image\image.c(1864) : warning C4702: > > unreachable code > > > > >-----Original Message----- > > >From: M1cha [mailto:sigmaepsilon92@gmail.com] > > >Sent: Thursday, December 28, 2017 3:29 AM > > >To: edk2-devel@lists.01.org > > >Cc: Ard Biesheuvel ; Kinney, Michael D > > >; Gao, Liming > > >Subject: [edk2] [PATCH v3 3/3] MdePkg: add NORETURN attribute to > > >LongJump and InternalLongJump > > > > > >This fixes compiler warnings when using them in functions which > > >should return a value but rely on LongJump to never return instead. > > > > > >Contributed-under: TianoCore Contribution Agreement 1.1 > > >Signed-off-by: Michael Zimmermann > > >--- > > >V3: fix VS compilation errors > > > > > > MdePkg/Include/Library/BaseLib.h | 1 + > > > MdePkg/Library/BaseLib/BaseLibInternals.h | 1 + > > > MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c | 1 + > > > MdePkg/Library/BaseLib/Ia32/LongJump.c | 1 + > > > MdePkg/Library/BaseLib/LongJump.c | 1 + > > > 5 files changed, 5 insertions(+) > > > > > >diff --git a/MdePkg/Include/Library/BaseLib.h > > >b/MdePkg/Include/Library/BaseLib.h > > >index 10976032adaa..c6783f4624e2 100644 > > >--- a/MdePkg/Include/Library/BaseLib.h > > >+++ b/MdePkg/Include/Library/BaseLib.h > > >@@ -4927,6 +4927,7 @@ SetJump ( > > > restored and must be non-zero. > > > > > > **/ > > >+NORETURN > > > VOID > > > EFIAPI > > > LongJump ( > > >diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h > > >b/MdePkg/Library/BaseLib/BaseLibInternals.h > > >index 9dca97a0dcc9..5cc83d2956e5 100644 > > >--- a/MdePkg/Library/BaseLib/BaseLibInternals.h > > >+++ b/MdePkg/Library/BaseLib/BaseLibInternals.h > > >@@ -441,6 +441,7 @@ InternalAssertJumpBuffer ( > > > @param Value The value to return when the SetJump() contex= t is > > >restored. > > > > > > **/ > > >+NORETURN > > > VOID > > > EFIAPI > > > InternalLongJump ( > > >diff --git a/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c > > >b/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c > > >index e309e8b57d7a..f48d7d17c4e4 100644 > > >--- a/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c > > >+++ b/MdePkg/Library/BaseLib/Ebc/SetJumpLongJump.c > > >@@ -54,6 +54,7 @@ SetJump ( > > > @param Value The value to return when the SetJump() contex= t is > > >restored. > > > > > > **/ > > >+NORETURN > > > VOID > > > EFIAPI > > > InternalLongJump ( > > >diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.c > > >b/MdePkg/Library/BaseLib/Ia32/LongJump.c > > >index 73973a9cceae..8fc86f9efb69 100644 > > >--- a/MdePkg/Library/BaseLib/Ia32/LongJump.c > > >+++ b/MdePkg/Library/BaseLib/Ia32/LongJump.c > > >@@ -28,6 +28,7 @@ > > > > > > **/ > > > __declspec (naked) > > >+NORETURN > > > VOID > > > EFIAPI > > > InternalLongJump ( > > >diff --git a/MdePkg/Library/BaseLib/LongJump.c > > >b/MdePkg/Library/BaseLib/LongJump.c > > >index 062be8f2daa1..fef764d6787e 100644 > > >--- a/MdePkg/Library/BaseLib/LongJump.c > > >+++ b/MdePkg/Library/BaseLib/LongJump.c > > >@@ -33,6 +33,7 @@ > > > restored and must be non-zero. > > > > > > **/ > > >+NORETURN > > > VOID > > > EFIAPI > > > LongJump ( > > >-- > > >2.15.1 > > > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel