]>
git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/kexts-missing-split-seg-error/test.py
4 import KernelCollection
6 # Check errors from canBePlacedInKernelCollection()
7 # We use a lack of split seg here as arm64 requires it
9 def check(kernel_cache
):
10 kernel_cache
.buildKernelCollection("arm64", "/kexts-missing-split-seg-error/main.kc", "/kexts-missing-split-seg-error/main.kernel", "/kexts-missing-split-seg-error/extensions", ["com.apple.foo", "com.apple.bar"], ["-json-errors"])
11 assert len(kernel_cache
.dictionary()) == 2
13 assert kernel_cache
.dictionary()[0]["id"] == "com.apple.bar"
14 assert len(kernel_cache
.dictionary()[0]["errors"]) == 1
15 assert kernel_cache
.dictionary()[0]["errors"][0] == "cannot be placed in kernel collection because: Missing split seg v2"
17 assert kernel_cache
.dictionary()[1]["id"] == "com.apple.foo"
18 assert len(kernel_cache
.dictionary()[1]["errors"]) == 1
19 assert kernel_cache
.dictionary()[1]["errors"][0] == "cannot be placed in kernel collection because: Missing split seg v2"
22 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -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
23 # [~]> xcrun -sdk iphoneos cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const -mios-version-min=8.0 foo.c -o extensions/foo.kext/foo
24 # [~]> xcrun -sdk iphoneos cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const -mios-version-min=8.0 bar.c -o extensions/bar.kext/bar
25 # [~]> rm -r extensions/*.kext/*.ld