3 include ${TESTROOT}/include/common.makefile
6 # Tests -no_weak_imports
13 # check weak_import works and triggers error with -no_weak_imports
14 ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib
15 ${FAIL_IF_BAD_MACHO} libfoo.dylib
16 ${CC} ${CCFLAGS} main.c libfoo.dylib -o main1a
17 nm -m main1a | grep _foo | grep weak | ${FAIL_IF_STDIN}
18 ${CC} ${CCFLAGS} main.c libfoo.dylib -o main1b -DMAKE_FOO_WEAK_IMPORT=1
19 nm -m main1b | grep _foo | grep weak | ${FAIL_IF_EMPTY}
20 ${CC} ${CCFLAGS} main.c libfoo.dylib -o main1c -DMAKE_FOO_WEAK_IMPORT=1 -Wl,-no_weak_imports 2>main1c.errors || true
21 grep 'ld:' main1c.errors | grep _foo | ${FAIL_IF_EMPTY}
22 # check $ld$sxx works with -no_weak_imports
23 ${CC} ${CCFLAGS} main2.c libfoo.dylib -o main2a -Wl,-no_weak_imports
24 ${CC} ${CCFLAGS} main2.c libfoo.dylib -o main2b -Wl,-no_weak_imports -mmacosx-version-min=10.7 2>main2b.errors || true
25 grep _bar main2b.errors | ${FAIL_IF_EMPTY}
26 ${PASS_IFF_GOOD_MACHO} main1a
29 rm -rf libfoo.dylib main1a main1b main1c main1c.errors main2a main2b main2b.errors