|
From: <sv...@va...> - 2006-10-04 14:26:20
|
Author: sewardj
Date: 2006-10-04 15:26:18 +0100 (Wed, 04 Oct 2006)
New Revision: 6171
Log:
Don't assume someone else is going to supply a usable version of memcpy()=
.
Modified:
branches/AIX5/coregrind/m_replacemalloc/vg_replace_malloc.c
Modified: branches/AIX5/coregrind/m_replacemalloc/vg_replace_malloc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/coregrind/m_replacemalloc/vg_replace_malloc.c 2006-10-0=
4 14:01:21 UTC (rev 6170)
+++ branches/AIX5/coregrind/m_replacemalloc/vg_replace_malloc.c 2006-10-0=
4 14:26:18 UTC (rev 6171)
@@ -98,6 +98,31 @@
=20
extern void _exit(int);
=20
+/* Apparently it is necessary to make ourselves free of any dependency
+ on memcpy() on ppc32-aix5; else programs linked with -brtl fail.
+ memcpy() is used by gcc for a struct assignment in mallinfo()
+ below. Add the following conservative implementation (memmove,
+ really). */
+#if defined(VGO_aix5)
+__attribute__((weak))
+void *memcpy(void *destV, const void *srcV, unsigned long n)
+{
+ unsigned char* src =3D (unsigned char*)srcV;
+ unsigned char* dest =3D (unsigned char*)destV;
+ unsigned long i;
+ if (dest < src) {
+ for (i =3D 0; i < n; i++)
+ dest[i] =3D src[i];
+ }
+ if (dest > src) {
+ for (i =3D n; i > 0; i--)
+ dest[i-1] =3D src[i-1];
+ }
+ return dest;
+}
+#endif
+
+
/*------------------------------------------------------------*/
/*--- Replacing malloc() et al ---*/
/*------------------------------------------------------------*/
|