]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/kernel-hello-world.dtest/main.c
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / test-cases / kernel-hello-world.dtest / main.c
1
2 // BOOT_ARGS: amfi=3 cs_enforcement_disable=1
3
4 // BUILD(macos,ios,tvos,bridgeos|x86_64,arm64,arm64e): $CC main.c -o $BUILD_DIR/kernel-hello-world.exe -Wl,-static -mkernel -nostdlib -Wl,-add_split_seg_info -Wl,-e,__start -Wl,-pie -Wl,-pagezero_size,0x0 -Wl,-install_name,/usr/lib/swift/split.seg.v2.hack -fno-stack-protector -fno-builtin -ffreestanding -Wl,-segprot,__HIB,rx,rx -Wl,-image_base,0x8000 -Wl,-segaddr,__HIB,0x4000 -fno-ptrauth-function-pointer-type-discrimination
5 // BUILD(macos,ios,tvos,bridgeos|x86_64,arm64,arm64e): $APP_CACHE_UTIL -create-kernel-collection $BUILD_DIR/kernel-hello-world.kc -kernel $BUILD_DIR/kernel-hello-world.exe -platform kernel
6
7 // BUILD(watchos):
8
9 // RUN_STATIC: $RUN_STATIC ./kernel-hello-world.kc
10
11 #include "../kernel-test-runner.h"
12
13 typedef unsigned long long uint64_t;
14 extern int printf(const char*, ...);
15
16 #define printf(...) funcs->printf(__VA_ARGS__)
17
18 #if __x86_64__
19 __attribute__((section(("__HIB, __text"))))
20 #else
21 __attribute__((section(("__TEXT_EXEC, __text"))))
22 #endif
23 int _start(const TestRunnerFunctions* funcs)
24 {
25 setFuncs(funcs);
26 PASS("Success");
27 return 0;
28 }
29
30