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

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