]> git.saurik.com Git - apple/dyld.git/blob - testing/kernel-cache-tests/fixups-x86_64/main.cpp
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / kernel-cache-tests / fixups-x86_64 / main.cpp
1
2 int g = 0;
3
4 static int func() {
5 return g;
6 }
7
8 struct S {
9 __typeof(&func) funcPtr;
10 __typeof(&func) funcPtr2;
11 int *p1;
12 __attribute__((aligned((16384)))) __typeof(&func) funcPtr3;
13 int *p2;
14 };
15
16 S s = { &func, &func, &g, &func, &g };
17
18 struct __attribute__((packed)) PackedS {
19 int i;
20 __typeof(&func) funcPtr; // aligned to 4
21 __typeof(&func) funcPtr2; // aligned to 4
22 int j;
23 int *p1; // aligned to 8
24 char k;
25 int *p2; // aligned to 1
26 };
27
28 __attribute__((aligned((16384))))
29 PackedS ps = { 0, &func, &func, 0, &g, 0, &g };
30
31 __asm(".code32; .text; .section __HIB, __text; .globl _foo; _foo: movl _foo, %esp; ret");
32
33 __attribute__((section(("__HIB, __text"))))
34 extern "C" int _start() {
35 return s.funcPtr() + s.funcPtr2() + s.funcPtr3() + ps.funcPtr();
36 }