]>
git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/kext-relative-paths/test.py
4 import KernelCollection
6 # Foo has a macOS style bundle layout while bar is an iOS style layout. Make sure we
7 # get the relative path right in each case
9 def check(kernel_cache
):
10 kernel_cache
.buildKernelCollection("arm64", "/kext-relative-paths/main.kc", "/kext-relative-paths/main.kernel", "/kext-relative-paths/extensions", ["com.apple.foo", "com.apple.bar"], [])
11 kernel_cache
.analyze("/kext-relative-paths/main.kc", ["-layout", "-arch", "arm64"])
13 assert len(kernel_cache
.dictionary()["dylibs"]) == 3
15 assert kernel_cache
.dictionary()["dylibs"][0]["name"] == "com.apple.kernel"
17 assert kernel_cache
.dictionary()["dylibs"][1]["name"] == "com.apple.bar"
18 assert kernel_cache
.dictionary()["dylibs"][1]["relativePath"] == "bar"
20 assert kernel_cache
.dictionary()["dylibs"][2]["name"] == "com.apple.foo"
21 assert kernel_cache
.dictionary()["dylibs"][2]["relativePath"] == "Contents/MacOS/foo"
24 # [~]> 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
25 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const foo.c -o extensions/foo.kext/Contents/MacOS/foo
26 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-kext -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-no_data_const bar.c -o extensions/bar.kext/bar
27 # [~]> rm -r extensions/*.kext/*.ld