]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/weak_import-disable/Makefile
ld64-274.1.tar.gz
[apple/ld64.git] / unit-tests / test-cases / weak_import-disable / Makefile
1
2 TESTROOT = ../..
3 include ${TESTROOT}/include/common.makefile
4
5 #
6 # Tests -no_weak_imports
7 #
8
9
10 run: all
11
12 all:
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
27
28 clean:
29 rm -rf libfoo.dylib main1a main1b main1c main1c.errors main2a main2b main2b.errors