void VG_(redir_initialise) ( void ) { // Assert that there are no SegInfos so far vg_assert( VG_(next_seginfo)(NULL) == NULL ); // Initialise active mapping. activeSet = VG_(OSet_Create)(offsetof(Active, from_addr), NULL, // Use fast comparison symtab_alloc, symtab_free); // The rest of this function just adds initial Specs. # if defined(VGP_x86_linux) /* If we're using memcheck, use this intercept right from the start, otherwise ld.so (glibc-2.3.5) makes a lot of noise. */ if (0==VG_(strcmp)("Memcheck", VG_(details).name)) { add_hardwired_spec( "ld-linux.so.2", "index", (Addr)&VG_(x86_linux_REDIR_FOR_index) ); } # elif defined(VGP_amd64_linux) /* Redirect vsyscalls to local versions */ add_hardwired_active( 0xFFFFFFFFFF600000ULL, (Addr)&VG_(amd64_linux_REDIR_FOR_vgettimeofday) ); add_hardwired_active( 0xFFFFFFFFFF600400ULL, (Addr)&VG_(amd64_linux_REDIR_FOR_vtime) ); # elif defined(VGP_ppc32_linux) /* 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_hardwired_spec( "ld.so.1", "strlen", (Addr)&VG_(ppc32_linux_REDIR_FOR_strlen) ); add_hardwired_spec( "ld.so.1", "strcmp", (Addr)&VG_(ppc32_linux_REDIR_FOR_strcmp) ); add_hardwired_spec( "ld.so.1", "index", (Addr)&VG_(ppc32_linux_REDIR_FOR_strchr) ); } # elif defined(VGP_ppc64_linux) /* 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_hardwired_spec( "ld64.so.1", "strlen", (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strlen) ) ); add_hardwired_spec( "ld64.so.1", "index", (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strchr) ) ); } # elif defined(VGP_ppc32_aix5) /* nothing so far */ # elif defined(VGP_ppc64_aix5) /* nothing so far */ # else # error Unknown platform # endif if (VG_(clo_trace_redir)) show_redir_state("after VG_(redir_initialise)"); }
void VG_(redir_initialise) ( void ) { // Assert that there are no DebugInfos so far vg_assert( VG_(next_DebugInfo)(NULL) == NULL ); // Initialise active mapping. activeSet = VG_(OSetGen_Create)(offsetof(Active, from_addr), NULL, // Use fast comparison dinfo_zalloc, "redir.ri.1", dinfo_free); // The rest of this function just adds initial Specs. # if defined(VGP_x86_linux) /* If we're using memcheck, use this intercept right from the start, otherwise ld.so (glibc-2.3.5) makes a lot of noise. */ if (0==VG_(strcmp)("Memcheck", VG_(details).name)) { add_hardwired_spec( "ld-linux.so.2", "index", (Addr)&VG_(x86_linux_REDIR_FOR_index), NULL ); } # elif defined(VGP_amd64_linux) /* Redirect vsyscalls to local versions */ add_hardwired_active( 0xFFFFFFFFFF600000ULL, (Addr)&VG_(amd64_linux_REDIR_FOR_vgettimeofday) ); add_hardwired_active( 0xFFFFFFFFFF600400ULL, (Addr)&VG_(amd64_linux_REDIR_FOR_vtime) ); /* 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_hardwired_spec( "ld-linux-x86-64.so.2", "strlen", (Addr)&VG_(amd64_linux_REDIR_FOR_strlen), # if defined(GLIBC_2_2) || defined(GLIBC_2_3) || defined(GLIBC_2_4) \ || defined(GLIBC_2_5) || defined(GLIBC_2_6) || defined(GLIBC_2_7) \ || defined(GLIBC_2_8) || defined(GLIBC_2_9) NULL # else /* for glibc-2.10 and later, this is mandatory - can't sanely continue without it */ complain_about_stripped_glibc_ldso # endif ); } # elif defined(VGP_ppc32_linux) /* 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)) { /* this is mandatory - can't sanely continue without it */ add_hardwired_spec( "ld.so.1", "strlen", (Addr)&VG_(ppc32_linux_REDIR_FOR_strlen), complain_about_stripped_glibc_ldso ); add_hardwired_spec( "ld.so.1", "strcmp", (Addr)&VG_(ppc32_linux_REDIR_FOR_strcmp), NULL /* not mandatory - so why bother at all? */ /* glibc-2.6.1 (openSUSE 10.3, ppc32) seems fine without it */ ); add_hardwired_spec( "ld.so.1", "index", (Addr)&VG_(ppc32_linux_REDIR_FOR_strchr), NULL /* not mandatory - so why bother at all? */ /* glibc-2.6.1 (openSUSE 10.3, ppc32) seems fine without it */ ); } # elif defined(VGP_ppc64_linux) /* 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)) { /* this is mandatory - can't sanely continue without it */ add_hardwired_spec( "ld64.so.1", "strlen", (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strlen) ), complain_about_stripped_glibc_ldso ); add_hardwired_spec( "ld64.so.1", "index", (Addr)VG_(fnptr_to_fnentry)( &VG_(ppc64_linux_REDIR_FOR_strchr) ), NULL /* not mandatory - so why bother at all? */ /* glibc-2.5 (FC6, ppc64) seems fine without it */ ); } # elif defined(VGP_ppc32_aix5) /* nothing so far */ # elif defined(VGP_ppc64_aix5) /* nothing so far */ # elif defined(VGO_darwin) /* If we're using memcheck, use these intercepts right from the start, otherwise dyld makes a lot of noise. */ if (0==VG_(strcmp)("Memcheck", VG_(details).name)) { add_hardwired_spec("dyld", "strcmp", (Addr)&VG_(darwin_REDIR_FOR_strcmp), NULL); add_hardwired_spec("dyld", "strlen", (Addr)&VG_(darwin_REDIR_FOR_strlen), NULL); add_hardwired_spec("dyld", "strcat", (Addr)&VG_(darwin_REDIR_FOR_strcat), NULL); add_hardwired_spec("dyld", "strcpy", (Addr)&VG_(darwin_REDIR_FOR_strcpy), NULL); add_hardwired_spec("dyld", "strlcat", (Addr)&VG_(darwin_REDIR_FOR_strlcat), NULL); # if defined(VGP_amd64_darwin) // DDD: #warning fixme rdar://6166275 add_hardwired_spec("dyld", "arc4random", (Addr)&VG_(darwin_REDIR_FOR_arc4random), NULL); # endif } # else # error Unknown platform # endif if (VG_(clo_trace_redir)) show_redir_state("after VG_(redir_initialise)"); }