]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/test-cases/kext-undefined-export/Makefile
ld64-409.12.tar.gz
[apple/ld64.git] / unit-tests / test-cases / kext-undefined-export / Makefile
CommitLineData
afe874b1
A
1
2TESTROOT = ../..
3include ${TESTROOT}/include/common.makefile
4
5#
6# Sanity check that ld can link a kext
7#
8
9EXPORT_LIST = mykext.exp
10FILE_TYPE = OBJECT
11ifeq (${ARCH},x86_64)
12 FILE_TYPE = KEXTBUNDLE
13endif
14ifeq (${FILEARCH},arm)
15 FILE_TYPE = KEXTBUNDLE
16endif
17ifeq (${ARCH},i386)
18 EXPORT_LIST = mykext-i386.exp
19endif
20
21run: all
22
23all:
24 ${CC} ${CCFLAGS} -static -mkernel -c mykext.c -o mykext.o
25 ${CC} ${CCFLAGS} -static -mkernel -c mykextinfo.c -o mykextinfo.o
26 ${CC} ${CCFLAGS} -Wl,-kext mykext.o mykextinfo.o -nostdlib -lkmodc++ -lkmod -lcc_kext -exported_symbols_list $(EXPORT_LIST) -o mykext -Wl,-w -Wl,-new_linker
27 otool -hv mykext | grep ${FILE_TYPE} | ${FAIL_IF_EMPTY}
28 nm -nm mykext | grep '(undefined) external _extern_global' | ${FAIL_IF_EMPTY}
29 nm -nm mykext | grep '(undefined) external _foo' | ${FAIL_IF_STDIN}
30 nm -nm mykext | grep '(undefined) external _my_used_external_global' | ${FAIL_IF_EMPTY}
31 otool -rv mykext | grep '_extern_global' | ${FAIL_IF_EMPTY}
32 ${PASS_IFF} true
33
34clean:
35 rm -f mykext.o mykextinfo.o mykext