From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4003:c0f::241; helo=mail-ot0-x241.google.com; envelope-from=sigmaepsilon92@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-ot0-x241.google.com (mail-ot0-x241.google.com [IPv6:2607:f8b0:4003:c0f::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9ED7B20352A8A for ; Sun, 7 Jan 2018 22:17:12 -0800 (PST) Received: by mail-ot0-x241.google.com with SMTP id g59so8437705otg.11 for ; Sun, 07 Jan 2018 22:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eUrh7cLfUZ/qbE57PX96Z6brlvEnrfl/LST6XLSrUvc=; b=kb8dPnSn1h4rt62cAIOhpH4ZptDQqD+9NYIfm/I+OaEOuGM9O43VDa5dtWNUVO/sN9 2Q0m70BUyqiohAbPwVZt1X73Iy44UIgTFd87yow4Nt2owNLOOMrPGRD0drwlJGub9173 rG5cWcCtWu3GrrT2H8XNNxldxdPf/tYHZA1glPrz7zjs6V4DO0WxpRJZK30cUE7hjU9+ TYbSvKSRLo7IibsyzOYowZBKiAA26TNIs3gjPo1RBzJ9jWvn24wt59xBIqSTwnZ2y8hw fy0ostYwKjrIcIY/t/jC1w8tnagccOU93Y/mwv3ebNalKW6zYbH9m1bk1e0DRsPmKRV4 bgxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eUrh7cLfUZ/qbE57PX96Z6brlvEnrfl/LST6XLSrUvc=; b=WOnuSiImRFcoR6KXe8GMlY/LfAgatf48iJqwlrZmNn6Tye0nO7oSuwSwQQ6PbiC4Jc i35jlxEY8PBkIW3v1r2E5D2+oayE0uYb41zuOJyOWUYt/silQvx5IsjDbe6MhNUVkkb7 /F/301CNxzTJveRjP9BhOliGYodKHN7MzOU2eUe9my0hENik10RX33ZBlJkdYsq89LuO S0jAXQbfNQvMO1dpJaf7gcEae7o3BE7uB46Ft0V9A7tIaCkthWC7bkjhFywByRX5YE1u xBtdnI8PjBStMxkk2kH1H20lB+c8xNBnF0B03YyyUQB+d798chg8g4faWu06NwQjZzok e0TQ== X-Gm-Message-State: AKwxytfi82LIcSESGZ2QTpo083ABh+ng3sqlV3zfufA9UjCGKlr12khZ Tkiw9gkPA03o8XJx3XPO/WbuXXdy63VDDXnO/O0= X-Google-Smtp-Source: ACJfBovOp/AywzgLUGN59IRG8BBl0Z02YmjhlZFx9I2l9zGT6Ui0Hk4JKs+Q8AU3eSK3Bm5AieowWcW4o1pBIkq/fQ8= X-Received: by 10.157.6.7 with SMTP id 7mr6824359otn.311.1515392540924; Sun, 07 Jan 2018 22:22:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.8.85 with HTTP; Sun, 7 Jan 2018 22:22:20 -0800 (PST) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1A022D@SHSMSX104.ccr.corp.intel.com> References: <20171227192850.26774-1-sigmaepsilon92@gmail.com> <20171227192850.26774-2-sigmaepsilon92@gmail.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E1A022D@SHSMSX104.ccr.corp.intel.com> From: Michael Zimmermann Date: Mon, 8 Jan 2018 07:22:20 +0100 Message-ID: To: "Gao, Liming" Cc: "edk2-devel@lists.01.org" , Ard Biesheuvel , "Kinney, Michael D" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Mon, 08 Jan 2018 06:17:13 -0000 Content-Type: text/plain; charset="UTF-8" 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. And actually this "unreachable code" warning sounds like a more complicated problem because while the compiler is right and the code after the call to LongJump should never run there is a slight possibility for that to happen anyway - just imagine that because of memory corruption the PC/LR inside the jump buffer point to after the call of longjump. On Mon, Jan 8, 2018 at 6:34 AM, Gao, Liming wrote: > Michael: > After more test, this patch will cause MdeModulePkg DxeCore link failure > 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 attribute > enabling. > > c:\edk2\mdemodulepkg\core\dxe\image\image.c(1863) : error C2220: warning > 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() context 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() context 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 > >