]> git.saurik.com Git - apple/dyld.git/blobdiff - testing/kernel-cache-tests/ctf-x86_64/main.cpp
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / ctf-x86_64 / main.cpp
diff --git a/testing/kernel-cache-tests/ctf-x86_64/main.cpp b/testing/kernel-cache-tests/ctf-x86_64/main.cpp
new file mode 100644 (file)
index 0000000..b3811a2
--- /dev/null
@@ -0,0 +1,36 @@
+
+int g = 0;
+
+static int func() {
+       return g;
+}
+
+struct S {
+       __typeof(&func) funcPtr;
+       __typeof(&func) funcPtr2;
+       int *p1;
+       __attribute__((aligned((16384)))) __typeof(&func) funcPtr3;
+       int *p2;
+};
+
+S s = { &func, &func, &g, &func, &g };
+
+struct __attribute__((packed)) PackedS {
+       int i;
+       __typeof(&func) funcPtr;        // aligned to 4
+       __typeof(&func) funcPtr2;       // aligned to 4
+       int j;
+       int *p1;                                        // aligned to 8
+       char k;
+       int *p2;                                        // aligned to 1
+};
+
+__attribute__((aligned((16384))))
+PackedS ps = { 0, &func, &func, 0, &g, 0, &g };
+
+__asm(".code32; .text; .section __HIB, __text; .globl _foo; _foo: movl _foo, %esp; ret");
+
+__attribute__((section(("__HIB, __text"))))
+extern "C" int _start() {
+       return s.funcPtr() + s.funcPtr2() + s.funcPtr3() + ps.funcPtr();
+}
\ No newline at end of file