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::241; helo=mail-io0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (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 0EF932118DC59 for ; Thu, 7 Jun 2018 00:05:11 -0700 (PDT) Received: by mail-io0-x241.google.com with SMTP id l19-v6so10619427ioj.5 for ; Thu, 07 Jun 2018 00:05:11 -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=szzCLoFwts3rjmUnjrzZXwJ4VOzKm+ufWyHFoKwduGs=; b=cLBi4MdSWgUohNyzZO89MfnM29Zc8jrBZRQ5EJwuyCsrcpnWSQDh91Y23dnWTnGPdE JYc2u2nUuRUmpUd9OhDkJ2efz+n+SJpS24JTfYQrV/fXV1zZaaxYDIRx3yPd1WerYp13 7D1G0htGoN4YMnZjKTnz6md3hEE7AEoZ5T244= 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=szzCLoFwts3rjmUnjrzZXwJ4VOzKm+ufWyHFoKwduGs=; b=dl4fZP5zusBMAewN9p5NQa6pLYw4u/NFbRX2qWOp5ch1spbpDSe+IrD/Nm0EvoFWaX U/JiIcFUuOo55CYRL6k1AKenKga0PpexBfJ1iO/Xa5rXGeW0bV55cxw8UHYjsnIabj9R HDVo3xtrX5F3lghqhdZGJ5bOG/swi6ph/4KNG+Skj6JK/UAZ9h1YsZqeFGF28vQFM1TW l9fZX72w0w7Ti9/AKvi5fld7eDIQY1ePVGE6E0jtz56ROnF7IKlHSR5zIVjaBx5t4Jd1 eMoLk2mb53iRlyNcAbUor2aC9iLr8lIbSeYN8qw9I63EbIxcysViSCaedrmCiE0BT+hx 49xg== X-Gm-Message-State: APt69E1QeSXt5xvDWCQ3uG2hqa6MCsfFNp94jzBoIfi+SfQr6b+59Ttn C83VDO+wNtJoGdKNLfBDuuOwB9GUBNWn3yOSGYgtYQ== X-Google-Smtp-Source: ADUXVKKx1EjlrSfE/kgoj6moJY/NzTlgiE956R0oBPujsVqgDsAg3g73Rr3W35TWltpAsNAWhK4vUDgg7hv9NDLOIM8= X-Received: by 2002:a6b:32d4:: with SMTP id y203-v6mr540874ioy.107.1528355110917; Thu, 07 Jun 2018 00:05:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Thu, 7 Jun 2018 00:05:10 -0700 (PDT) In-Reply-To: <20180607054720.15940-1-sigmaepsilon92@gmail.com> References: <20180607054720.15940-1-sigmaepsilon92@gmail.com> From: Ard Biesheuvel Date: Thu, 7 Jun 2018 09:05:10 +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: Thu, 07 Jun 2018 07:05:12 -0000 Content-Type: text/plain; charset="UTF-8" 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")))