3 include ${TESTROOT}/include/common.makefile
6 # Sanity check that ld can link a kext
9 EXPORT_LIST = mykext.exp
12 FILE_TYPE = KEXTBUNDLE
14 ifeq (${FILEARCH},arm)
15 FILE_TYPE = KEXTBUNDLE
18 EXPORT_LIST = mykext-i386.exp
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}
35 rm -f mykext.o mykextinfo.o mykext