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