public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
@ 2020-07-20 13:49 Jessica Clarke
  2020-07-20 14:04 ` Leif Lindholm
  0 siblings, 1 reply; 10+ messages in thread
From: Jessica Clarke @ 2020-07-20 13:49 UTC (permalink / raw)
  To: devel; +Cc: Jessica Clarke, Leif Lindholm

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004

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 form
the basis of the toolchain for Arm's experimental Morello platform, does
use custom type checking for it, and so gives an error. Thus, simply
delete the unnecessary line.

[1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872e7ecf6bbb08d4984

Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
 MdePkg/Include/Base.h | 1 -
 1 file changed, 1 deletion(-)

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 == 0) ? _ReturnAddress() : (VOID *) 0)
 #elif defined (__GNUC__) || defined (__clang__)
-  void * __builtin_return_address (unsigned int level);
   /**
     Get the return address of the calling function.
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-20 13:49 [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address Jessica Clarke
@ 2020-07-20 14:04 ` Leif Lindholm
  2020-07-20 14:58   ` [edk2-devel] " Liming Gao
  2020-07-21  1:59   ` [edk2-devel] [PATCH] " Zhiguang Liu
  0 siblings, 2 replies; 10+ messages in thread
From: Leif Lindholm @ 2020-07-20 14:04 UTC (permalink / raw)
  To: Jessica Clarke; +Cc: devel, Michael D Kinney, Liming Gao

+Mike, Liming

On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
> 
> 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 form
> the basis of the toolchain for Arm's experimental Morello platform, does
> use custom type checking for it, and so gives an error. Thus, simply
> delete the unnecessary line.
> 
> [1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872e7ecf6bbb08d4984
> 
> Cc: Leif Lindholm <leif@nuviainc.com>
> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> ---
>  MdePkg/Include/Base.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> 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 == 0) ? _ReturnAddress() : (VOID *) 0)
>  #elif defined (__GNUC__) || defined (__clang__)
> -  void * __builtin_return_address (unsigned int level);

Agreed this looks somewhat bonkers.
And I can't see any ill effects from dropping it, so:
Reviewed-by: Leif Lindholm <leif@nuviainc.com>

>    /**
>      Get the return address of the calling function.
>  
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-20 14:04 ` Leif Lindholm
@ 2020-07-20 14:58   ` Liming Gao
  2020-07-20 15:06     ` Jessica Clarke
  2020-07-21  1:59   ` [edk2-devel] [PATCH] " Zhiguang Liu
  1 sibling, 1 reply; 10+ messages in thread
From: Liming Gao @ 2020-07-20 14:58 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif@nuviainc.com, Jessica Clarke; +Cc: Kinney, Michael D

Clarke:
  Do you mean CLANG compiler may have the different prototype for __builtin_return_address()? If so, dose __builtin_return_address (L) always work? 

Thanks
Liming
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm
> Sent: Monday, July 20, 2020 10:05 PM
> To: Jessica Clarke <jrtc27@jrtc27.com>
> Cc: devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
> 
> +Mike, Liming
> 
> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
> >
> > 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 form
> > the basis of the toolchain for Arm's experimental Morello platform, does
> > use custom type checking for it, and so gives an error. Thus, simply
> > delete the unnecessary line.
> >
> > [1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872e7ecf6bbb08d4984
> >
> > Cc: Leif Lindholm <leif@nuviainc.com>
> > Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> > ---
> >  MdePkg/Include/Base.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > 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 == 0) ? _ReturnAddress() : (VOID *) 0)
> >  #elif defined (__GNUC__) || defined (__clang__)
> > -  void * __builtin_return_address (unsigned int level);
> 
> Agreed this looks somewhat bonkers.
> And I can't see any ill effects from dropping it, so:
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
> 
> >    /**
> >      Get the return address of the calling function.
> >
> > --
> > 2.20.1
> >
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-20 14:58   ` [edk2-devel] " Liming Gao
@ 2020-07-20 15:06     ` Jessica Clarke
  2020-07-21  2:29       ` Liming Gao
       [not found]       ` <1623A39CDBDFA4B6.5706@groups.io>
  0 siblings, 2 replies; 10+ messages in thread
From: Jessica Clarke @ 2020-07-20 15:06 UTC (permalink / raw)
  To: Gao, Liming; +Cc: devel@edk2.groups.io, leif@nuviainc.com, Kinney, Michael D

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 <liming.gao@intel.com> wrote:
> 
> Clarke:
>  Do you mean CLANG compiler may have the different prototype for __builtin_return_address()? If so, dose __builtin_return_address (L) always work? 
> 
> Thanks
> Liming
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif Lindholm
>> Sent: Monday, July 20, 2020 10:05 PM
>> To: Jessica Clarke <jrtc27@jrtc27.com>
>> Cc: devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
>> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
>> 
>> +Mike, Liming
>> 
>> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
>>> 
>>> 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 form
>>> the basis of the toolchain for Arm's experimental Morello platform, does
>>> use custom type checking for it, and so gives an error. Thus, simply
>>> delete the unnecessary line.
>>> 
>>> [1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872e7ecf6bbb08d4984
>>> 
>>> Cc: Leif Lindholm <leif@nuviainc.com>
>>> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
>>> ---
>>> MdePkg/Include/Base.h | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> 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 == 0) ? _ReturnAddress() : (VOID *) 0)
>>> #elif defined (__GNUC__) || defined (__clang__)
>>> -  void * __builtin_return_address (unsigned int level);
>> 
>> Agreed this looks somewhat bonkers.
>> And I can't see any ill effects from dropping it, so:
>> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
>> 
>>>   /**
>>>     Get the return address of the calling function.
>>> 
>>> --
>>> 2.20.1
>>> 
>> 
>> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-20 14:04 ` Leif Lindholm
  2020-07-20 14:58   ` [edk2-devel] " Liming Gao
@ 2020-07-21  1:59   ` Zhiguang Liu
  1 sibling, 0 replies; 10+ messages in thread
From: Zhiguang Liu @ 2020-07-21  1:59 UTC (permalink / raw)
  To: devel@edk2.groups.io, leif@nuviainc.com, Jessica Clarke
  Cc: Kinney, Michael D, Gao, Liming

Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif
> Lindholm
> Sent: Monday, July 20, 2020 10:05 PM
> To: Jessica Clarke <jrtc27@jrtc27.com>
> Cc: devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>;
> Gao, Liming <liming.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for
> __builtin_return_address
> 
> +Mike, Liming
> 
> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
> >
> > 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
> > form the basis of the toolchain for Arm's experimental Morello
> > platform, does use custom type checking for it, and so gives an error.
> > Thus, simply delete the unnecessary line.
> >
> > [1]
> > https://github.com/llvm/llvm-
> project/commit/41af97137572ad6d4dafc872e7
> > ecf6bbb08d4984
> >
> > Cc: Leif Lindholm <leif@nuviainc.com>
> > Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
> > ---
> >  MdePkg/Include/Base.h | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > 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 == 0) ? _ReturnAddress() : (VOID *) 0)
> >  #elif defined (__GNUC__) || defined (__clang__)
> > -  void * __builtin_return_address (unsigned int level);
> 
> Agreed this looks somewhat bonkers.
> And I can't see any ill effects from dropping it, so:
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
> 
> >    /**
> >      Get the return address of the calling function.
> >
> > --
> > 2.20.1
> >
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-20 15:06     ` Jessica Clarke
@ 2020-07-21  2:29       ` Liming Gao
       [not found]       ` <1623A39CDBDFA4B6.5706@groups.io>
  1 sibling, 0 replies; 10+ messages in thread
From: Liming Gao @ 2020-07-21  2:29 UTC (permalink / raw)
  To: Jessica Clarke; +Cc: devel@edk2.groups.io, leif@nuviainc.com, Kinney, Michael D

Jess:
  OK. Seemly, there is no impact with this change. Reviewed-by: Liming Gao <liming.gao@intel.com>

Thanks
Liming
-----Original Message-----
From: Jessica Clarke <jrtc27@jrtc27.com> 
Sent: 2020年7月20日 23:06
To: Gao, Liming <liming.gao@intel.com>
Cc: devel@edk2.groups.io; leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address

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 <liming.gao@intel.com> wrote:
> 
> Clarke:
>  Do you mean CLANG compiler may have the different prototype for __builtin_return_address()? If so, dose __builtin_return_address (L) always work? 
> 
> Thanks
> Liming
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif 
>> Lindholm
>> Sent: Monday, July 20, 2020 10:05 PM
>> To: Jessica Clarke <jrtc27@jrtc27.com>
>> Cc: devel@edk2.groups.io; Kinney, Michael D 
>> <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
>> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for 
>> __builtin_return_address
>> 
>> +Mike, Liming
>> 
>> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
>>> 
>>> 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 form the basis of the toolchain for Arm's experimental Morello 
>>> platform, does use custom type checking for it, and so gives an 
>>> error. Thus, simply delete the unnecessary line.
>>> 
>>> [1] 
>>> https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872
>>> e7ecf6bbb08d4984
>>> 
>>> Cc: Leif Lindholm <leif@nuviainc.com>
>>> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
>>> ---
>>> MdePkg/Include/Base.h | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> 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 == 0) ? _ReturnAddress() : (VOID *) 0)
>>> #elif defined (__GNUC__) || defined (__clang__)
>>> -  void * __builtin_return_address (unsigned int level);
>> 
>> Agreed this looks somewhat bonkers.
>> And I can't see any ill effects from dropping it, so:
>> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
>> 
>>>   /**
>>>     Get the return address of the calling function.
>>> 
>>> --
>>> 2.20.1
>>> 
>> 
>> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address
       [not found]       ` <1623A39CDBDFA4B6.5706@groups.io>
@ 2020-07-23  1:10         ` Liming Gao
  2020-07-27  1:58           ` [PATCH v2] " Jessica Clarke
  0 siblings, 1 reply; 10+ messages in thread
From: Liming Gao @ 2020-07-23  1:10 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Jessica Clarke
  Cc: leif@nuviainc.com, Kinney, Michael D

Jess:
  In the commit message, below line is too long that can't pass patch check. Can you move this line from the commit message to BZ?

[1] https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872e7ecf6bbb08d4984

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
Sent: 2020年7月21日 10:30
To: Jessica Clarke <jrtc27@jrtc27.com>
Cc: devel@edk2.groups.io; leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address

Jess:
  OK. Seemly, there is no impact with this change. Reviewed-by: Liming Gao <liming.gao@intel.com>

Thanks
Liming
-----Original Message-----
From: Jessica Clarke <jrtc27@jrtc27.com>
Sent: 2020年7月20日 23:06
To: Gao, Liming <liming.gao@intel.com>
Cc: devel@edk2.groups.io; leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address

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 <liming.gao@intel.com> wrote:
> 
> Clarke:
>  Do you mean CLANG compiler may have the different prototype for __builtin_return_address()? If so, dose __builtin_return_address (L) always work? 
> 
> Thanks
> Liming
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Leif 
>> Lindholm
>> Sent: Monday, July 20, 2020 10:05 PM
>> To: Jessica Clarke <jrtc27@jrtc27.com>
>> Cc: devel@edk2.groups.io; Kinney, Michael D 
>> <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@intel.com>
>> Subject: Re: [edk2-devel] [PATCH] MdePkg Base.h: Delete prototype for 
>> __builtin_return_address
>> 
>> +Mike, Liming
>> 
>> On Mon, Jul 20, 2020 at 14:49:46 +0100, Jessica Clarke wrote:
>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004
>>> 
>>> 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 form the basis of the toolchain for Arm's experimental Morello 
>>> platform, does use custom type checking for it, and so gives an 
>>> error. Thus, simply delete the unnecessary line.
>>> 
>>> [1]
>>> https://github.com/llvm/llvm-project/commit/41af97137572ad6d4dafc872
>>> e7ecf6bbb08d4984
>>> 
>>> Cc: Leif Lindholm <leif@nuviainc.com>
>>> Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
>>> ---
>>> MdePkg/Include/Base.h | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> 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 == 0) ? _ReturnAddress() : (VOID *) 0)
>>> #elif defined (__GNUC__) || defined (__clang__)
>>> -  void * __builtin_return_address (unsigned int level);
>> 
>> Agreed this looks somewhat bonkers.
>> And I can't see any ill effects from dropping it, so:
>> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
>> 
>>>   /**
>>>     Get the return address of the calling function.
>>> 
>>> --
>>> 2.20.1
>>> 
>> 
>> 
> 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-23  1:10         ` Liming Gao
@ 2020-07-27  1:58           ` Jessica Clarke
  2020-07-27  2:17             ` Liming Gao
       [not found]             ` <16257A6ED97D2A8D.26462@groups.io>
  0 siblings, 2 replies; 10+ messages in thread
From: Jessica Clarke @ 2020-07-27  1:58 UTC (permalink / raw)
  To: devel; +Cc: Jessica Clarke, Gao, Liming, leif@nuviainc.com, Kinney, Michael D

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004

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 form
the basis of the toolchain for Arm's experimental Morello platform, does
use custom type checking for it, and so gives an error. Thus, simply
delete the unnecessary line.

[1] llvm/llvm-project@41af97137572ad6d4dafc872e7ecf6bbb08d4984

Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
Changes in v2:
 * Shortened [1] reference to fit column limit. The bug report has the
   full URL already, and this will still link correctly on GitHub.

 MdePkg/Include/Base.h | 1 -
 1 file changed, 1 deletion(-)

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 == 0) ? _ReturnAddress() : (VOID *) 0)
 #elif defined (__GNUC__) || defined (__clang__)
-  void * __builtin_return_address (unsigned int level);
   /**
     Get the return address of the calling function.
 
--
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address
  2020-07-27  1:58           ` [PATCH v2] " Jessica Clarke
@ 2020-07-27  2:17             ` Liming Gao
       [not found]             ` <16257A6ED97D2A8D.26462@groups.io>
  1 sibling, 0 replies; 10+ messages in thread
From: Liming Gao @ 2020-07-27  2:17 UTC (permalink / raw)
  To: Jessica Clarke, devel@edk2.groups.io; +Cc: leif@nuviainc.com, Kinney, Michael D

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Jessica Clarke <jrtc27@jrtc27.com> 
Sent: 2020年7月27日 9:59
To: devel@edk2.groups.io
Cc: Jessica Clarke <jrtc27@jrtc27.com>; Gao, Liming <liming.gao@intel.com>; leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004

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 form the basis of the toolchain for Arm's experimental Morello platform, does use custom type checking for it, and so gives an error. Thus, simply delete the unnecessary line.

[1] llvm/llvm-project@41af97137572ad6d4dafc872e7ecf6bbb08d4984

Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
Changes in v2:
 * Shortened [1] reference to fit column limit. The bug report has the
   full URL already, and this will still link correctly on GitHub.

 MdePkg/Include/Base.h | 1 -
 1 file changed, 1 deletion(-)

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 == 0) ? _ReturnAddress() : (VOID *) 0)
 #elif defined (__GNUC__) || defined (__clang__)
-  void * __builtin_return_address (unsigned int level);
   /**
     Get the return address of the calling function.
 
--
2.20.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address
       [not found]             ` <16257A6ED97D2A8D.26462@groups.io>
@ 2020-07-28  0:26               ` Liming Gao
  0 siblings, 0 replies; 10+ messages in thread
From: Liming Gao @ 2020-07-28  0:26 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Jessica Clarke
  Cc: leif@nuviainc.com, Kinney, Michael D

PR https://github.com/tianocore/edk2/pull/829 has been created. 

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Liming Gao
Sent: 2020年7月27日 10:18
To: Jessica Clarke <jrtc27@jrtc27.com>; devel@edk2.groups.io
Cc: leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address

Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: Jessica Clarke <jrtc27@jrtc27.com> 
Sent: 2020年7月27日 9:59
To: devel@edk2.groups.io
Cc: Jessica Clarke <jrtc27@jrtc27.com>; Gao, Liming <liming.gao@intel.com>; leif@nuviainc.com; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [PATCH v2] MdePkg Base.h: Delete prototype for __builtin_return_address

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1004

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 form the basis of the toolchain for Arm's experimental Morello platform, does use custom type checking for it, and so gives an error. Thus, simply delete the unnecessary line.

[1] llvm/llvm-project@41af97137572ad6d4dafc872e7ecf6bbb08d4984

Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
---
Changes in v2:
 * Shortened [1] reference to fit column limit. The bug report has the
   full URL already, and this will still link correctly on GitHub.

 MdePkg/Include/Base.h | 1 -
 1 file changed, 1 deletion(-)

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 == 0) ? _ReturnAddress() : (VOID *) 0)
 #elif defined (__GNUC__) || defined (__clang__)
-  void * __builtin_return_address (unsigned int level);
   /**
     Get the return address of the calling function.
 
--
2.20.1





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-07-28  0:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-20 13:49 [PATCH] MdePkg Base.h: Delete prototype for __builtin_return_address Jessica Clarke
2020-07-20 14:04 ` Leif Lindholm
2020-07-20 14:58   ` [edk2-devel] " Liming Gao
2020-07-20 15:06     ` Jessica Clarke
2020-07-21  2:29       ` Liming Gao
     [not found]       ` <1623A39CDBDFA4B6.5706@groups.io>
2020-07-23  1:10         ` Liming Gao
2020-07-27  1:58           ` [PATCH v2] " Jessica Clarke
2020-07-27  2:17             ` Liming Gao
     [not found]             ` <16257A6ED97D2A8D.26462@groups.io>
2020-07-28  0:26               ` [edk2-devel] " Liming Gao
2020-07-21  1:59   ` [edk2-devel] [PATCH] " Zhiguang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox