@@ -149,6 +149,7 @@ static int try_to_init(void) {
149
149
dyld_cache .header = (const dyld_cache_header * ) cache_address ;
150
150
const dyld_cache_mapping_info * mappings = (const dyld_cache_mapping_info * )(calculate_relative (dyld_cache .header , dyld_cache .header -> mappingOffset ));
151
151
dyld_cache .slide = cache_address - mappings [0 ].address ;
152
+ VG_ (debugLog )(2 , "dyld_cache" , "dyld cache slide: %#lx\n" , dyld_cache .slide );
152
153
153
154
if (!try_to_init_header (cache_address )) {
154
155
return 0 ;
@@ -208,23 +209,22 @@ Addr VG_(dyld_cache_get_slide)(void) {
208
209
return dyld_cache .slide ;
209
210
}
210
211
211
- void VG_ (dyld_cache_init )(void ) {
212
+ void VG_ (dyld_cache_init )(Bool is_dynamic ) {
212
213
if (!try_to_init ()) {
213
214
VG_ (dmsg )(
214
215
"WARNING: could not read from dyld shared cache (DSC)\n"
215
216
"Some reports (especially memory leaks) might be missing or incorrect (false-positives)\n"
216
217
);
217
218
return ;
218
219
}
219
- #if defined(VGP_arm64_darwin )
220
- // We currently detect if dyld is loading/using a library by checking if stat64 fails.
221
- // However, dyld doesn't seem to call stat64 for all of them anymore.
222
- // Because dynamic binaries on arm64 are mandatory, they will necessarily include those,
223
- // so we request them to be loaded right away to ensure we have their symbols.
224
- VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_kernel.dylib" );
225
- VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_pthread.dylib" );
226
- VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_platform.dylib" );
227
- #endif
220
+ if (is_dynamic ) {
221
+ // We currently detect if dyld is loading/using a library by checking if stat64 fails.
222
+ // However, dyld doesn't seem to call stat64 for all of them anymore.
223
+ // All arm64 binaries are executables but some x86 ones might not be so let's avoid them just to be safe.
224
+ VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_kernel.dylib" );
225
+ VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_pthread.dylib" );
226
+ VG_ (dyld_cache_load_library )("/usr/lib/system/libsystem_platform.dylib" );
227
+ }
228
228
}
229
229
230
230
int VG_ (dyld_cache_might_be_in )(const HChar * path ) {
0 commit comments