]>
Commit | Line | Data |
---|---|---|
afe874b1 A |
1 | |
2 | TESTROOT = ../.. | |
3 | include ${TESTROOT}/include/common.makefile | |
4 | ||
5 | # | |
6 | # Sanity check that ld can link a kext | |
7 | # | |
8 | ||
9 | EXPORT_LIST = mykext.exp | |
10 | FILE_TYPE = OBJECT | |
11 | ifeq (${ARCH},x86_64) | |
12 | FILE_TYPE = KEXTBUNDLE | |
13 | endif | |
14 | ifeq (${FILEARCH},arm) | |
15 | FILE_TYPE = KEXTBUNDLE | |
16 | endif | |
17 | ifeq (${ARCH},i386) | |
18 | EXPORT_LIST = mykext-i386.exp | |
19 | endif | |
20 | ||
21 | run: all | |
22 | ||
23 | all: | |
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 | ||
34 | clean: | |
35 | rm -f mykext.o mykextinfo.o mykext |