]> git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/extra-prelink-info/test.py
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / extra-prelink-info / test.py
1 #!/usr/bin/python2.7
2
3 import os
4 import KernelCollection
5
6
7 def check(kernel_cache):
8 kernel_cache.buildKernelCollection("arm64", "/extra-prelink-info/main.kc", "/extra-prelink-info/main.kernel", None, [],
9 ["-prelink-info-extra", "$PWD/extra-prelink-info/prelink-info.plist"])
10
11 # Check the layout
12 kernel_cache.analyze("/extra-prelink-info/main.kc", ["-layout", "-arch", "arm64"])
13
14 assert len(kernel_cache.dictionary()["cache-segments"]) == 6
15 assert kernel_cache.dictionary()["cache-segments"][0]["name"] == "__TEXT"
16 assert kernel_cache.dictionary()["cache-segments"][0]["vmAddr"] == "0x0"
17 assert kernel_cache.dictionary()["cache-segments"][1]["name"] == "__PRELINK_TEXT"
18 assert kernel_cache.dictionary()["cache-segments"][1]["vmAddr"] == "0x4000"
19 assert kernel_cache.dictionary()["cache-segments"][2]["name"] == "__TEXT_EXEC"
20 assert kernel_cache.dictionary()["cache-segments"][2]["vmAddr"] == "0x4000"
21
22 # [~]> xcrun -sdk iphoneos.internal cc -arch arm64 -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-e,__start -Wl,-pie main.c -Wl,-pagezero_size,0x0 -Wl,-rename_section,__TEXT,__text,__TEXT_EXEC,__text -o main.kernel -Wl,-install_name,/usr/lib/swift/split.seg.v2.hack
23