// p: aspacem
//--------------------------------------------------------------
{ Bool change_ownership_v_c_OK;
- Addr co_start = VG_PGROUNDDN( (Addr)&VG_(trampoline_stuff_start) );
- Addr co_endPlus = VG_PGROUNDUP( (Addr)&VG_(trampoline_stuff_end) );
+ Addr co_start = VG_PGROUNDDN(
+ (Addr)VG_(fnptr_to_fnentry)(
+ &VG_(trampoline_stuff_start) ) );
+ Addr co_endPlus = VG_PGROUNDUP(
+ (Addr)VG_(fnptr_to_fnentry)(
+ &VG_(trampoline_stuff_end) ) );
VG_(debugLog)(1,"redir",
"transfer ownership V -> C of 0x%llx .. 0x%llx\n",
(ULong)co_start, (ULong)co_endPlus-1 );
#include "pub_core_trampoline.h"
#include "pub_core_transtab.h"
#include "pub_core_tooliface.h" // VG_(needs).malloc_replacement
+#include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
/*------------------------------------------------------------*/
#elif defined(VGP_ppc64_linux)
- // we'll have to stick some godawful hacks in here, no doubt
+ /* If we're using memcheck, use these intercepts right from
+ the start, otherwise ld.so makes a lot of noise. */
+ if (0==VG_(strcmp)("Memcheck", VG_(details).name)) {
+
+ add_redirect_sym_to_addr(
+ "soname:ld64.so.1", "strlen",
+ (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strlen) )
+ );
+
+ }
#else
# error Unknown platform
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
+ /* and a trailing page of unexecutable code */
+ UD2_PAGE
+
# undef UD2_16
# undef UD2_64
# undef UD2_256
.type .VG_(trampoline_stuff_start),@function
.global .VG_(trampoline_stuff_start)
.VG_(trampoline_stuff_start):
-
+
+.align 2
+.globl VG_(ppc64_linux_REDIR_FOR_strlen)
+.section ".opd","aw"
+.align 3
+VG_(ppc64_linux_REDIR_FOR_strlen):
+.quad .L.VG_(ppc64_linux_REDIR_FOR_strlen),.TOC.@tocbase
+.previous
+.type VG_(ppc64_linux_REDIR_FOR_strlen), @function
+.L.VG_(ppc64_linux_REDIR_FOR_strlen):
+ mr 9,3
+ lbz 0,0(3)
+ li 3,0
+ cmpwi 7,0,0
+ beqlr 7
+ li 3,0
+.L5:
+ addi 0,3,1
+ extsw 3,0
+ lbzx 0,9,3
+ cmpwi 7,0,0
+ bne 7,.L5
+ blr
+ .long 0
+ .byte 0,0,0,0,0,0,0,0
+ .size VG_(ppc64_linux_REDIR_FOR_strlen),.-.L.VG_(ppc64_linux_REDIR_FOR_strlen)
.align 2
.global VG_(trampoline_stuff_end)
.global .VG_(trampoline_stuff_end)
.VG_(trampoline_stuff_end):
+ /* and a trailing page of unexecutable code */
+ UD2_PAGE
+
# undef UD2_16
# undef UD2_64
# undef UD2_256
extern UInt VG_(ppc32_linux_REDIR_FOR_strcmp)( void*, void* );
extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int );
#endif
+
+#if defined(VGP_ppc64_linux)
+extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* );
+#endif
#endif // __PUB_CORE_TRAMPOLINE_H