From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web12.39700.1595257588474265917 for ; Mon, 20 Jul 2020 08:06:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@jrtc27.com header.s=gmail.jrtc27.user header.b=Z6HurW6R; spf=pass (domain: jrtc27.com, ip: 209.85.128.68, mailfrom: jrtc27@jrtc27.com) Received: by mail-wm1-f68.google.com with SMTP id o8so22592938wmh.4 for ; Mon, 20 Jul 2020 08:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Sfd5MfW8LRxGXVK3Weh99rzbbe60uv3J0/Y9kn5xRnU=; b=Z6HurW6RacDfsE0iL/lhun8RmsX+GwGZmuLoHzOxlVvZ+vw/Qq5IwNaiDvKDsZ0mEv Z8k5keFm8+mpZj5xowIYpePduLnd27RBnOj5I8kwOE3l63v3tH9We67jl90i3Qp5Sndu wgnY1eJU25odwB42iEWCWpLnncNCsSzOmcSu58ANoCyW/1CO4gxaWksA5XJ2EgwQyXpS 4TO72u++NLNSM+1ozlNcY/1fjWlYJfXC+0ldDvVaTSq1Ln8MhY5vtkiypx8OT03mJxK0 nfuvQ/UU74j5jcY2SKiqh8WdrlMQ+tcX+W4PIQ4gD+Ge1I5LDFKDcBB68mVkFW45E1MD W9VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Sfd5MfW8LRxGXVK3Weh99rzbbe60uv3J0/Y9kn5xRnU=; b=DVCc+zoGYUEFVMkPK+mDatPcvf88VB8kd7bkUuuoHlAVkXA7DnSsSa1tb/7B2RogiH zD3BDICUass+LBW4MDu9lcgok+n+UAM07HeNzpEhR8/q9PkR/LYOKzZ/azBsl2uf+uUZ /T6ny3nyNu9qTmeRkSfby681g/e3NZDU52xyqS9omfdodguYSuokDhpRdYsqhwA88OYq IPDKgmrgNml5kOmmfWiIhb5kukwJHkZ73q3XhDORU8psY4kqlueIZ6azYz86Nj9dsC7R HtCQwnh/96xjFGTSPg8s0cei393RVV6jr5vj+80VxSv9TRM7HYy3F85vxaFDwC1bbm2v eJEA== X-Gm-Message-State: AOAM533rwNgTpHPdd3n/wPl3aCA5NNaywBM4QvprFAH8eR+BjXbyrHs6 cz6BDe3FzGO2VXIqfcI6CkNzPw== X-Google-Smtp-Source: ABdhPJzVyTZ3wfj1So9KEPrdUZMbSguoLBrHe4nJlSuOCbeJqKxYByJHEZ5wmETa7pLUjSsYpe817g== X-Received: by 2002:a1c:6384:: with SMTP id x126mr22841986wmb.144.1595257586971; Mon, 20 Jul 2020 08:06:26 -0700 (PDT) Return-Path: Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id m9sm31493248wml.45.2020.07.20.08.06.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2020 08:06:25 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address From: Jessica Clarke In-Reply-To: Date: Mon, 20 Jul 2020 16:06:25 +0100 Cc: "devel@edk2.groups.io" , "leif@nuviainc.com" , "Kinney, Michael D" Message-Id: <1872CF8A-5DEE-4F17-B1C5-3E0E243594C8@jrtc27.com> References: <20200720134946.33723-1-jrtc27@jrtc27.com> <20200720140446.GP12303@vanye> To: "Gao, Liming" X-Mailer: Apple Mail (2.3608.80.23.2.2) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable It will always look like void *__builtin_return_address(unsigned) and work like that, just that under the hood it's being implemented slightly differently, which has the unfortunate side-effect of triggering this bug. We've been compiling the embedded EDK2 in our CheriBSD with that line deleted for years now with no issue. Jess > On 20 Jul 2020, at 15:58, Gao, Liming wrote: >=20 > Clarke: > Do you mean CLANG compiler may have the different prototype for __built= in_return_address()? If so, dose __builtin_return_address (L) always work?= =20 >=20 > Thanks > Liming >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Leif Lin= dholm >> Sent: Monday, July 20, 2020 10:05 PM >> To: Jessica Clarke >> Cc: devel@edk2.groups.io; Kinney, Michael D ; Gao, Liming >> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for _= _builtin_return_address >>=20 >> +Mike, Liming >>=20 >> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote: >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1004 >>>=20 >>> Being a compiler builtin, the type of __builtin_return_address is >>> already known to the compiler so no prototype is needed. Clang also >>> errors out when redeclaring certain builtins like this[1], though >>> currently only for ones with custom type checking. At the moment, >>> __builtin_return_address does not use custom type checking and so does >>> not trigger this error, however, the CHERI fork of LLVM, which will fo= rm >>> the basis of the toolchain for Arm's experimental Morello platform, do= es >>> use custom type checking for it, and so gives an error. Thus, simply >>> delete the unnecessary line. >>>=20 >>> [1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc8= 72e7ecf6bbb08d4984 >>>=20 >>> Cc: Leif Lindholm >>> Signed-off-by: Jessica Clarke >>> --- >>> MdePkg/Include/Base.h | 1 - >>> 1 file changed, 1 deletion(-) >>>=20 >>> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h >>> index 85a091b9d5..8e4271f6ea 100644 >>> --- a/MdePkg/Include/Base.h >>> +++ b/MdePkg/Include/Base.h >>> @@ -1273,7 +1273,6 @@ typedef UINTN RETURN_STATUS; >>> **/ >>> #define RETURN_ADDRESS(L) ((L =3D=3D 0) ? _ReturnAddress() : (VO= ID *) 0) >>> #elif defined (__GNUC__) || defined (__clang__) >>> - void * __builtin_return_address (unsigned int level); >>=20 >> Agreed this looks somewhat bonkers. >> And I can't see any ill effects from dropping it, so: >> Reviewed-by: Leif Lindholm >>=20 >>> /** >>> Get the return address of the calling function. >>>=20 >>> -- >>> 2.20.1 >>>=20 >>=20 >>=20 >=20