]> git.saurik.com Git - apple/objc4.git/blob - test/imports.c
objc4-818.2.tar.gz
[apple/objc4.git] / test / imports.c
1 /*
2 Disallow some imports into and exports from libobjc.A.dylib.
3
4 To debug, re-run libobjc's link command with
5 -Xlinker -dead_strip -Xlinker -why_live -Xlinker SYMBOL_NAME_HERE
6
7 Disallowed imports (nm -u):
8 ___cxa_guard_acquire (C++ function-scope static initializer)
9 ___cxa_guard_release (C++ function-scope static initializer)
10 ___cxa_atexit (C++ static destructor)
11 weak external (any weak externals, including operators new and delete)
12
13 Whitelisted imports:
14 weak external ____chkstk_darwin (from libSystem)
15
16 Disallowed exports (nm -U):
17 __Z* (any C++-mangled export)
18 weak external (any weak externals, including operators new and delete)
19
20 fixme rdar://13354718 should disallow anything from libc++ (i.e. not libc++abi)
21 */
22
23 /*
24 TEST_BUILD
25 echo $C{XCRUN} nm -m -arch $C{ARCH} $C{TESTLIB}
26 $C{XCRUN} nm -u -m -arch $C{ARCH} $C{TESTLIB} | grep -v 'weak external ____chkstk_darwin \(from libSystem\)' | egrep '(weak external| external (___cxa_atexit|___cxa_guard_acquire|___cxa_guard_release))' || true
27 $C{XCRUN} nm -U -m -arch $C{ARCH} $C{TESTLIB} | egrep '(weak external| external __Z)' || true
28 $C{COMPILE_C} $DIR/imports.c -o imports.exe
29 END
30
31 TEST_BUILD_OUTPUT
32 .*libobjc.A.dylib
33 END
34 */
35
36 #include "test.h"
37 int main()
38 {
39 succeed(__FILE__);
40 }