X-Git-Url: https://git.saurik.com/apple/dyld.git/blobdiff_plain/bac542e65c0030c0d819c7ff1dcfc25892a61844..16b475fcb248267b8b51f759bc62a49ec2afa88d:/unit-tests/test-cases/shared-cache-symlink/main.c?ds=sidebyside diff --git a/unit-tests/test-cases/shared-cache-symlink/main.c b/unit-tests/test-cases/shared-cache-symlink/main.c index ab1c6b6..fc038c1 100644 --- a/unit-tests/test-cases/shared-cache-symlink/main.c +++ b/unit-tests/test-cases/shared-cache-symlink/main.c @@ -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; }