]>
git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/large-auxkc-errors/test.py
4 import KernelCollection
6 # The arm64e auxKC has a lower memory limit than other KCs. Verify that we get an error with only 64MB in there.
8 def check(kernel_cache
):
9 # First build a kernel collection
10 kernel_cache
.buildKernelCollection("arm64e", "/large-auxkc-errors/main.kc", "/large-auxkc-errors/main.kernel", "/large-auxkc-errors/extensions", [], [])
11 kernel_cache
.analyze("/large-auxkc-errors/main.kc", ["-layout", "-arch", "arm64e"])
13 # Now build an aux cache using the baseline kernel collection
14 kernel_cache
.buildAuxKernelCollection("arm64e", "/large-auxkc-errors/aux.kc", "/large-auxkc-errors/main.kc", "", "/large-auxkc-errors/extensions", ["com.apple.foo", "com.apple.bar"], ["-json-errors"])
16 assert len(kernel_cache
.dictionary()) == 1
17 assert "kernel collection size exceeds maximum size of 67108864" in kernel_cache
.dictionary()[0]
20 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text -Wl,-e,__start -Wl,-pagezero_size,0x0 -Wl,-pie main.c -o main.kernel
21 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const foo.c -o extensions/foo.kext/foo
22 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64e -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const bar.c -o extensions/bar.kext/bar
23 # [~]> rm -r extensions/*.kext/*.ld