]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/kernel-pageablekc-auxkc-fixups.dtest/bar.c
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / test-cases / kernel-pageablekc-auxkc-fixups.dtest / bar.c
1
2 #include "../kernel-test-runner.h"
3
4 extern int pageableExport();
5 __typeof(&pageableExport) pageableExportPtr = &pageableExport;
6
7 int bar() {
8 return pageableExportPtr() + 2;
9 }
10
11 extern int pageableExportDirect();
12
13 // Test direct pointer fixups to the pageable KC. On x86_64 these would be emitted as just
14 // a branch relocation so we needed to synthesize a stub
15 __attribute__((constructor))
16 int testDirectToPageable(const TestRunnerFunctions* funcs) {
17 LOG("testDirectToPageable(): start");
18 // The pageable returned 42
19 int v = pageableExportDirect();
20 if ( v != 42 ) {
21 FAIL("pageableExportDirect() returned %d vs expected 42", v);
22 }
23 LOG("testDirectToPageable(): end");
24 return 0;
25 }