From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::243; helo=mail-io0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (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 220922119FF36 for ; Mon, 11 Jun 2018 02:46:10 -0700 (PDT) Received: by mail-io0-x243.google.com with SMTP id l19-v6so23153654ioj.5 for ; Mon, 11 Jun 2018 02:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ec8ac5exgV3YN9Z2xK7R+nRTC1O/VCVRH4/8B2vfVmY=; b=hZ+fTBx3CcnlZgZzN8bpKb0NpRNC5INWhEN52oczgFzU5BbasXElRU4CPd4Ed8ZMqg pJNIQzEO7pg9qGOK24rwXSWAjf/BMxBKxFFKS0VZ6btp5Qx5iNxJEGdmcieCBFkLTkre K2xjRQGMatsa67znGhdU8whqF/ZyLTAs5Szdo= 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=Ec8ac5exgV3YN9Z2xK7R+nRTC1O/VCVRH4/8B2vfVmY=; b=awksmloMJpYOM3Bppi0g2W30lZ1wpy2pSFG45FBGhGabUAYkg0mZYDrRukOJTZjrxF 1xCbL1RJoJxrQ1VD6DQgSdTNO6tYaT0WA5qE5rm5l1Bjh7Vv2YTuIGe0LDekBKLlmDJy egvMHOjbrXReTFgzG0sRO1784ld8Gxi1lFO3nNQnLp/QBOGoy9S8ksnxftDBwj+8Gyc9 zKu2im888V21wGtxRzx/Bwcb+Lrb1vLZ88zbq06IbKBX78vbjw5/KdR5iXan4U/GGLph +aEh3qGOWP0SNjoMXO/o+ZW2GUOAfWm75z5x6hU79qrLkHTVNkY3IMEYcxUEJ9FELB5J 9c0A== X-Gm-Message-State: APt69E3vXVDFDwPdf4bU2LyZhaePfIBh+mRRqY89n98/NDNx/34E5Qw0 8z/qDuHoPvQKDaqQSeQlbkowPAN1fISKGShIokgleQ== X-Google-Smtp-Source: ADUXVKLBi1XHqD+f/noUBLKTPqsgfTpc3paGD5RPzuv+h3aCNXHFjuuE5/d7R5e6F7fVYg2PRWdIDVbSG2iayf5dgcE= X-Received: by 2002:a6b:32d4:: with SMTP id y203-v6mr14344633ioy.107.1528710370179; Mon, 11 Jun 2018 02:46:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bbc7:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 02:46:09 -0700 (PDT) In-Reply-To: References: <20180607054720.15940-1-sigmaepsilon92@gmail.com> From: Ard Biesheuvel Date: Mon, 11 Jun 2018 11:46:09 +0200 Message-ID: To: Michael Zimmermann Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH] ArmPkg/CompilerIntrinsicsLib: fix GCC8 warning for __aeabi_memcpy aliases X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 09:46:11 -0000 Content-Type: text/plain; charset="UTF-8" On 7 June 2018 at 19:02, Michael Zimmermann 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 wrote: >> >> On 7 June 2018 at 07:47, Michael Zimmermann 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 >> > --- >> > 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")))