public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Michael Zimmermann <sigmaepsilon92@gmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases
Date: Mon, 11 Jun 2018 11:46:09 +0200	[thread overview]
Message-ID: <CAKv+Gu_rj09M+ahLUO0nyauWfEUy7EJeW+Uc94tWmY2S4g4AEA@mail.gmail.com> (raw)
In-Reply-To: <CAN9vWDL0JOK+44zcXcdhnKomV7vNbvNaXq_g-j_8-SQ9PsarOw@mail.gmail.com>

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")))


      reply	other threads:[~2018-06-11  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKv+Gu_rj09M+ahLUO0nyauWfEUy7EJeW+Uc94tWmY2S4g4AEA@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox