public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases
@ 2018-06-07  5:47 Michael Zimmermann
  2018-06-07  7:05 ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Zimmermann @ 2018-06-07  5:47 UTC (permalink / raw)
  To: edk2-devel; +Cc: Leif Lindholm, Ard Biesheuvel

This was the warning(shown for __aeabi_memcpy, __aeabi_memcpy4 and __aeabi_memcpy8):
ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:42:6: error: '__aeabi_memcpy8' alias between functions of incompatible types 'void(void
*, const void *, size_t)' {aka 'void(void *, const void *, unsigned int)'} and 'void *(void *, const void *, size_t)' {aka 'void
*(void *, const void *, unsigned int)'} [-Werror=attribute-alias]
void __aeabi_memcpy8(void *dest, const void *src, size_t n);
^~~~~~~~~~~~~~~
ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:19:7: note: aliased declaration here
void *__memcpy(void *dest, const void *src, size_t n)

The problem is the different return type(void vs void*).
This commit adds a wrapper '__aeabi___memcpy' with a void return value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
---
 ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
index a944e00b89e1..507234186fa9 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
@@ -31,14 +31,19 @@ __attribute__((__alias__("__memcpy")))
 void *memcpy(void *dest, const void *src, size_t n);
 
 #ifdef __arm__
+static __attribute__((__used__))
+void __aeabi___memcpy(void *dest, const void *src, size_t n)
+{
+  __memcpy(dest, src, n);
+}
 
-__attribute__((__alias__("__memcpy")))
+__attribute__((__alias__("__aeabi___memcpy")))
 void __aeabi_memcpy(void *dest, const void *src, size_t n);
 
-__attribute__((__alias__("__memcpy")))
+__attribute__((__alias__("__aeabi___memcpy")))
 void __aeabi_memcpy4(void *dest, const void *src, size_t n);
 
-__attribute__((__alias__("__memcpy")))
+__attribute__((__alias__("__aeabi___memcpy")))
 void __aeabi_memcpy8(void *dest, const void *src, size_t n);
 
 #endif
-- 
2.17.1



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

* Re: [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases
  2018-06-07  5:47 [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases Michael Zimmermann
@ 2018-06-07  7:05 ` Ard Biesheuvel
  2018-06-07 17:02   ` Michael Zimmermann
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2018-06-07  7:05 UTC (permalink / raw)
  To: Michael Zimmermann; +Cc: edk2-devel@lists.01.org, Leif Lindholm

On 7 June 2018 at 07:47, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> This was the warning(shown for __aeabi_memcpy, __aeabi_memcpy4 and __aeabi_memcpy8):
> ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:42:6: error: '__aeabi_memcpy8' alias between functions of incompatible types 'void(void
> *, const void *, size_t)' {aka 'void(void *, const void *, unsigned int)'} and 'void *(void *, const void *, size_t)' {aka 'void
> *(void *, const void *, unsigned int)'} [-Werror=attribute-alias]
> void __aeabi_memcpy8(void *dest, const void *src, size_t n);
> ^~~~~~~~~~~~~~~
> ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:19:7: note: aliased declaration here
> void *__memcpy(void *dest, const void *src, size_t n)
>
> The problem is the different return type(void vs void*).
> This commit adds a wrapper '__aeabi___memcpy' with a void return value.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
> ---
>  ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> index a944e00b89e1..507234186fa9 100644
> --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> @@ -31,14 +31,19 @@ __attribute__((__alias__("__memcpy")))
>  void *memcpy(void *dest, const void *src, size_t n);
>
>  #ifdef __arm__
> +static __attribute__((__used__))
> +void __aeabi___memcpy(void *dest, const void *src, size_t n)
> +{
> +  __memcpy(dest, src, n);
> +}
>
> -__attribute__((__alias__("__memcpy")))
> +__attribute__((__alias__("__aeabi___memcpy")))
>  void __aeabi_memcpy(void *dest, const void *src, size_t n);
>
> -__attribute__((__alias__("__memcpy")))
> +__attribute__((__alias__("__aeabi___memcpy")))
>  void __aeabi_memcpy4(void *dest, const void *src, size_t n);
>
> -__attribute__((__alias__("__memcpy")))
> +__attribute__((__alias__("__aeabi___memcpy")))
>  void __aeabi_memcpy8(void *dest, const void *src, size_t n);
>
>  #endif

Thanks Michael.

Would this fix the problem as well?

--- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
@@ -16,20 +16,21 @@
 typedef __SIZE_TYPE__ size_t;

 static __attribute__((__used__))
-void *__memcpy(void *dest, const void *src, size_t n)
+void __memcpy(void *dest, const void *src, size_t n)
 {
   unsigned char *d = dest;
   unsigned char const *s = src;

   while (n--)
     *d++ = *s++;
+}

+void *memcpy(void *dest, const void *src, size_t n)
+{
+  __memcpy(dest, src, n);
   return dest;
 }

-__attribute__((__alias__("__memcpy")))
-void *memcpy(void *dest, const void *src, size_t n);
-
 #ifdef __arm__

 __attribute__((__alias__("__memcpy")))


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

* Re: [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases
  2018-06-07  7:05 ` Ard Biesheuvel
@ 2018-06-07 17:02   ` Michael Zimmermann
  2018-06-11  9:46     ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Zimmermann @ 2018-06-07 17:02 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel@lists.01.org, Leif Lindholm

Hi Ard,

yes that fixes the problem too and looks much better, thx!
On Thu, Jun 7, 2018 at 9:05 AM Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>
> On 7 June 2018 at 07:47, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> > This was the warning(shown for __aeabi_memcpy, __aeabi_memcpy4 and __aeabi_memcpy8):
> > ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:42:6: error: '__aeabi_memcpy8' alias between functions of incompatible types 'void(void
> > *, const void *, size_t)' {aka 'void(void *, const void *, unsigned int)'} and 'void *(void *, const void *, size_t)' {aka 'void
> > *(void *, const void *, unsigned int)'} [-Werror=attribute-alias]
> > void __aeabi_memcpy8(void *dest, const void *src, size_t n);
> > ^~~~~~~~~~~~~~~
> > ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:19:7: note: aliased declaration here
> > void *__memcpy(void *dest, const void *src, size_t n)
> >
> > The problem is the different return type(void vs void*).
> > This commit adds a wrapper '__aeabi___memcpy' with a void return value.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
> > ---
> >  ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> > index a944e00b89e1..507234186fa9 100644
> > --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> > +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> > @@ -31,14 +31,19 @@ __attribute__((__alias__("__memcpy")))
> >  void *memcpy(void *dest, const void *src, size_t n);
> >
> >  #ifdef __arm__
> > +static __attribute__((__used__))
> > +void __aeabi___memcpy(void *dest, const void *src, size_t n)
> > +{
> > +  __memcpy(dest, src, n);
> > +}
> >
> > -__attribute__((__alias__("__memcpy")))
> > +__attribute__((__alias__("__aeabi___memcpy")))
> >  void __aeabi_memcpy(void *dest, const void *src, size_t n);
> >
> > -__attribute__((__alias__("__memcpy")))
> > +__attribute__((__alias__("__aeabi___memcpy")))
> >  void __aeabi_memcpy4(void *dest, const void *src, size_t n);
> >
> > -__attribute__((__alias__("__memcpy")))
> > +__attribute__((__alias__("__aeabi___memcpy")))
> >  void __aeabi_memcpy8(void *dest, const void *src, size_t n);
> >
> >  #endif
>
> Thanks Michael.
>
> Would this fix the problem as well?
>
> --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
> @@ -16,20 +16,21 @@
>  typedef __SIZE_TYPE__ size_t;
>
>  static __attribute__((__used__))
> -void *__memcpy(void *dest, const void *src, size_t n)
> +void __memcpy(void *dest, const void *src, size_t n)
>  {
>    unsigned char *d = dest;
>    unsigned char const *s = src;
>
>    while (n--)
>      *d++ = *s++;
> +}
>
> +void *memcpy(void *dest, const void *src, size_t n)
> +{
> +  __memcpy(dest, src, n);
>    return dest;
>  }
>
> -__attribute__((__alias__("__memcpy")))
> -void *memcpy(void *dest, const void *src, size_t n);
> -
>  #ifdef __arm__
>
>  __attribute__((__alias__("__memcpy")))


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

* Re: [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases
  2018-06-07 17:02   ` Michael Zimmermann
@ 2018-06-11  9:46     ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2018-06-11  9:46 UTC (permalink / raw)
  To: Michael Zimmermann; +Cc: edk2-devel@lists.01.org, Leif Lindholm

On 7 June 2018 at 19:02, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> Hi Ard,
>
> yes that fixes the problem too and looks much better, thx!

Pushed as a683ceca800e9

Thanks!

> On Thu, Jun 7, 2018 at 9:05 AM Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>
>> On 7 June 2018 at 07:47, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
>> > This was the warning(shown for __aeabi_memcpy, __aeabi_memcpy4 and __aeabi_memcpy8):
>> > ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:42:6: error: '__aeabi_memcpy8' alias between functions of incompatible types 'void(void
>> > *, const void *, size_t)' {aka 'void(void *, const void *, unsigned int)'} and 'void *(void *, const void *, size_t)' {aka 'void
>> > *(void *, const void *, unsigned int)'} [-Werror=attribute-alias]
>> > void __aeabi_memcpy8(void *dest, const void *src, size_t n);
>> > ^~~~~~~~~~~~~~~
>> > ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c:19:7: note: aliased declaration here
>> > void *__memcpy(void *dest, const void *src, size_t n)
>> >
>> > The problem is the different return type(void vs void*).
>> > This commit adds a wrapper '__aeabi___memcpy' with a void return value.
>> >
>> > Contributed-under: TianoCore Contribution Agreement 1.1
>> > Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
>> > ---
>> >  ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c | 11 ++++++++---
>> >  1 file changed, 8 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
>> > index a944e00b89e1..507234186fa9 100644
>> > --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
>> > +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
>> > @@ -31,14 +31,19 @@ __attribute__((__alias__("__memcpy")))
>> >  void *memcpy(void *dest, const void *src, size_t n);
>> >
>> >  #ifdef __arm__
>> > +static __attribute__((__used__))
>> > +void __aeabi___memcpy(void *dest, const void *src, size_t n)
>> > +{
>> > +  __memcpy(dest, src, n);
>> > +}
>> >
>> > -__attribute__((__alias__("__memcpy")))
>> > +__attribute__((__alias__("__aeabi___memcpy")))
>> >  void __aeabi_memcpy(void *dest, const void *src, size_t n);
>> >
>> > -__attribute__((__alias__("__memcpy")))
>> > +__attribute__((__alias__("__aeabi___memcpy")))
>> >  void __aeabi_memcpy4(void *dest, const void *src, size_t n);
>> >
>> > -__attribute__((__alias__("__memcpy")))
>> > +__attribute__((__alias__("__aeabi___memcpy")))
>> >  void __aeabi_memcpy8(void *dest, const void *src, size_t n);
>> >
>> >  #endif
>>
>> Thanks Michael.
>>
>> Would this fix the problem as well?
>>
>> --- a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
>> +++ b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
>> @@ -16,20 +16,21 @@
>>  typedef __SIZE_TYPE__ size_t;
>>
>>  static __attribute__((__used__))
>> -void *__memcpy(void *dest, const void *src, size_t n)
>> +void __memcpy(void *dest, const void *src, size_t n)
>>  {
>>    unsigned char *d = dest;
>>    unsigned char const *s = src;
>>
>>    while (n--)
>>      *d++ = *s++;
>> +}
>>
>> +void *memcpy(void *dest, const void *src, size_t n)
>> +{
>> +  __memcpy(dest, src, n);
>>    return dest;
>>  }
>>
>> -__attribute__((__alias__("__memcpy")))
>> -void *memcpy(void *dest, const void *src, size_t n);
>> -
>>  #ifdef __arm__
>>
>>  __attribute__((__alias__("__memcpy")))


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

end of thread, other threads:[~2018-06-11  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-07  5:47 [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases Michael Zimmermann
2018-06-07  7:05 ` Ard Biesheuvel
2018-06-07 17:02   ` Michael Zimmermann
2018-06-11  9:46     ` Ard Biesheuvel

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