]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/weak_import-force/main.c
3b9cdff537a2762764af637ae6506d8f67c8d76c
[apple/ld64.git] / unit-tests / test-cases / weak_import-force / main.c
1
2 extern void foo1();
3 extern void foo2();
4 extern void bar1();
5 extern void bar2();
6
7 extern int foo_data1;
8 extern int foo_data2;
9 extern int bar_data1;
10 extern int bar_data2;
11
12
13
14 // make external relocation to foo_data1 and bar_data1
15 int* pfoo = &foo_data1;
16 int* pbar = &bar_data1;
17
18
19 int main (void)
20 {
21 // make non-lazy reference to foo1 and bar1
22 if ( &foo1 == &bar1 ) {
23 // make lazy reference to foo2 and bar2
24 foo2();
25 bar2();
26 }
27
28 // make non-lazy reference to foo_data2 and bar_data2
29 return *pfoo + *pbar + foo_data2 + bar_data2;
30 }
31