|
From: <sv...@va...> - 2005-08-18 18:01:06
|
Author: sewardj Date: 2005-08-18 12:54:30 +0100 (Thu, 18 Aug 2005) New Revision: 4445 Log: The strlen that ld.so uses on ppc32 causes a lot of false errors in memcheck, and they are hard to get rid of and hard to suppress. So add a bootstrap strlen function and redirect to it right from the start. This fn only replaces the strlen in ld.so; the "normal" redirect mechanism still replaces the strlen that glibc supplies. This commit finally (!) makes memcheck behave sanely on ppc32. Modified: trunk/coregrind/m_redir.c trunk/coregrind/m_trampoline.S trunk/coregrind/pub_core_trampoline.h Modified: trunk/coregrind/m_redir.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 --- trunk/coregrind/m_redir.c 2005-08-17 21:06:07 UTC (rev 4444) +++ trunk/coregrind/m_redir.c 2005-08-18 11:54:30 UTC (rev 4445) @@ -366,7 +366,10 @@ =20 #elif defined(VGP_ppc32_linux) =20 - //CAB: TODO + add_redirect_sym_to_addr( + "soname:ld.so.1", "strlen", + (Addr)&VG_(ppc32_linux_REDIR_FOR_strlen) + ); =20 =20 #else # error Unknown platform Modified: trunk/coregrind/m_trampoline.S =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 --- trunk/coregrind/m_trampoline.S 2005-08-17 21:06:07 UTC (rev 4444) +++ trunk/coregrind/m_trampoline.S 2005-08-18 11:54:30 UTC (rev 4445) @@ -107,11 +107,29 @@ .global VG_(trampoline_stuff_start) VG_(trampoline_stuff_start): =20 +/* There's no particular reason that this needs to be handwritten + assembly, but since that's what this file contains, here's a + simple strlen implementation (written in C and compiled by gcc.) +*/ +.global VG_(ppc32_linux_REDIR_FOR_strlen) +VG_(ppc32_linux_REDIR_FOR_strlen): + lbz 4,0(3) + li 9,0 + cmpwi 0,4,0 + beq- 0,.L8 +.L9: + lbzu 5,1(3) + addi 9,9,1 + cmpwi 0,5,0 + bne+ 0,.L9 +.L8: + mr 3,9 + blr + .global VG_(trampoline_stuff_end) VG_(trampoline_stuff_end): =20 =20 - /*---------------- unknown ----------------*/ #else # error Unknown platform @@ -120,9 +138,7 @@ #endif #endif =20 -tramp_code_end: =20 - /* Let the linker know we don't need an executable stack */ .section .note.GNU-stack,"",@progbits =09 Modified: trunk/coregrind/pub_core_trampoline.h =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 --- trunk/coregrind/pub_core_trampoline.h 2005-08-17 21:06:07 UTC (rev 44= 44) +++ trunk/coregrind/pub_core_trampoline.h 2005-08-18 11:54:30 UTC (rev 44= 45) @@ -58,6 +58,10 @@ extern void VG_(amd64_linux_REDIR_FOR_vgettimeofday); extern void VG_(amd64_linux_REDIR_FOR_vtime); #endif + +#if defined(VGP_ppc32_linux) +extern UInt VG_(ppc32_linux_REDIR_FOR_strlen)( void* ); +#endif =20 #endif // __PUB_CORE_TRAMPOLINE_H =20 |