]>
git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/weak-external-reloc-flat/main.c
3 #include <stdio.h> // fprintf(), NULL
4 #include <stdlib.h> // exit(), EXIT_SUCCESS
6 #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL()
8 // pfoo is in libfoo.dylib
9 // libfoo.dylib also has weak foo[]
10 // pfoo should be rebound to point into the foo[] in main
11 int foo
[] = { 5, 6, 7, 8 };
14 // libfoo.dylib has a weak bar[]
15 // libbar.dylib has a strong bar[]
16 // at build time linker only sees weak bar in libfoo.dylib
17 // at runtime, dyld uses strong bar in libbar.dylib
22 // libfoo.dylib has a weak frob[]
23 // libbar.dylib has a weak frob[] and a funtion that refrences frob[]
24 // the function should use libfoo's frob[] even if libfoo is flat
30 FAIL("weak-external-reloc-flat, pfoo=%d", *pfoo
);
31 else if ( *pbar
!= 21 )
32 FAIL("weak-external-reloc-flat, pbar=%d", *pbar
);
33 else if ( getfrob() != 22 )
34 FAIL("weak-external-reloc-flat, frob()=%d", getfrob());
36 PASS("weak-external-reloc-flat");