]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/pie-dylib/Makefile
dyld-733.6.tar.gz
[apple/dyld.git] / unit-tests / test-cases / pie-dylib / Makefile
1 TESTROOT = ../..
2 include ${TESTROOT}/include/common.makefile
3
4 #
5 # <rdar://problem/6050482> If pie, ignore preferred load address
6 #
7 # run a PIE four times and verify libfoo.dylib load address was different every time
8 #
9
10 FOO_ADDRESS = 0x10000000
11
12 ifeq "x86_64" "$(ARCH)"
13 FOO_ADDRESS = 0x300000000
14 endif
15
16
17 all-check: all check
18
19 check:
20 ./main > main.out
21 ./main >> main.out
22 ./main >> main.out
23 ./main >> main.out
24 if [ `sort main.out -u | wc -l` == 4 ]; \
25 then \
26 echo "PASS pie-dylib"; \
27 else \
28 echo "FAIL pie-dylib"; \
29 fi; \
30
31 all: main
32
33 main : main.c libfoo.dylib
34 ${CC} ${CCFLAGS} -I${TESTROOT}/include -Wl,-pie libfoo.dylib -o main main.c
35
36 libfoo.dylib : foo.c
37 ${CC} ${CCFLAGS} foo.c -dynamiclib -o libfoo.dylib -seg1addr ${FOO_ADDRESS}
38
39 clean:
40 ${RM} ${RMFLAGS} *~ main main.out libfoo.dylib
41