]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib/LibC ARM AARCH64: do not redefine compiler intrinsics
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 8 Aug 2016 11:03:46 +0000 (13:03 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 9 Aug 2016 08:10:12 +0000 (10:10 +0200)
The memset() function is a compiler intrinsic on AARCH64 and ARM, and
so is memmove() on ARM. Usually, redefining them as LibC currently does
is not a problem since only one version will be selected at link time
from the various static libraries that provide implementations. However,
under LTO, this is slightly different, since explicit references (in the
C code) and implicit references (emitted by the compiler backend) may
resolve to different versions (LTO vs non-LTO), causing conflicts.

So simply omit them for ARM/AARCH64 resp. ARM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
StdLib/LibC/String/Copying.c
StdLib/LibC/String/Misc.c

index 96be24b9a9bd1c38b9b1d75efda23059a88a957a..3234eccf08087e044ec004a81dd9cceaee319181 100644 (file)
@@ -39,6 +39,7 @@ memcpy(void * __restrict s1, const void * __restrict s2, size_t n)
 }\r
 #endif  /* !(defined(MDE_CPU_IPF) && defined(__GCC)) */\r
 \r
+#if !(defined(MDE_CPU_ARM) && defined(__GNUC__))\r
 /** The memmove function copies n characters from the object pointed to by s2\r
     into the object pointed to by s1. Copying takes place as if the n\r
     characters from the object pointed to by s2 are first copied into a\r
@@ -57,6 +58,7 @@ memmove(void *s1, const void *s2, size_t n)
 {\r
   return CopyMem( s1, s2, n);\r
 }\r
+#endif\r
 \r
 /** The strcpy function copies the string pointed to by s2 (including the\r
     terminating null character) into the array pointed to by s1. If copying\r
index 99328252ed5023c107fb6d5c5fe2a6d6c038e00d..f024136446e7a85679ba69515b978c5ba7ccb960 100644 (file)
@@ -26,6 +26,7 @@
 \r
 extern char *sys_errlist[];\r
 \r
+#if !((defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64)) && defined(__GNUC__))\r
 /** The memset function copies the value of c (converted to an unsigned char)\r
     into each of the first n characters of the object pointed to by s.\r
 \r
@@ -36,6 +37,7 @@ memset(void *s, int c, size_t n)
 {\r
   return SetMem( s, (UINTN)n, (UINT8)c);\r
 }\r
+#endif\r
 \r
 int\r
 strerror_r(int errnum, char *buf, size_t buflen)\r