]> git.saurik.com Git - apple/dyld.git/blobdiff - unit-tests/test-cases/shared-cache-symlink/main.c
dyld-750.5.tar.gz
[apple/dyld.git] / unit-tests / test-cases / shared-cache-symlink / main.c
index ab1c6b65691186d575f150106b9a572029e52c25..fc038c1227e48b7afe8a2823aae98fbbadbfbfc5 100644 (file)
@@ -55,22 +55,11 @@ int main()
                return EXIT_SUCCESS;
        }
 
-       // walk images to get slide
-       uint32_t count = _dyld_image_count();
-       for(uint32_t i=0; i < count; ++i) {
-               if ( _dyld_get_image_header(i) == info.dli_fbase ) {
-                       if ( _dyld_get_image_vmaddr_slide(i) == 0 ) {
-                               // images in shared cache have a slide of zero
-                               PASS("shared-cache-symlink");
-                               return EXIT_SUCCESS;
-                       }
-                       else {
-                               FAIL("shared-cache-symlink: libz.dylib not loaded from shared cache");
-                               return EXIT_SUCCESS;
-                       }
-               }
-        }
+       const struct mach_header* mh = (struct mach_header*)info.dli_fbase;
+       if ( mh->flags & 0x80000000 ) 
+               PASS("shared-cache-symlink");
+       else 
+               FAIL("shared-cache-symlink: libz.dylib not loaded from shared cache");
 
-       FAIL("shared-cache-symlink libz.dylib not found");
        return EXIT_SUCCESS;
 }