]>
Commit | Line | Data |
---|---|---|
a645023d A |
1 | |
2 | ||
3 | TESTROOT = ../.. | |
4 | include ${TESTROOT}/include/common.makefile | |
5 | ||
6 | # | |
7 | # Check -function_starts | |
8 | # | |
9 | ||
10 | run: all | |
11 | ||
12 | all: | |
13 | # as main executable | |
14 | ${CC} ${CCFLAGS} main.c -o main -Wl,-function_starts | |
15 | ${DYLDINFO} -function_starts main | grep _bar | ${FAIL_IF_EMPTY} | |
16 | # as dylib | |
17 | ${CC} ${CCFLAGS} main.c -dynamiclib -o libmain.dylib -Wl,-function_starts | |
18 | ${DYLDINFO} -function_starts libmain.dylib | grep _bar | ${FAIL_IF_EMPTY} | |
19 | # as dylib with prefered load address | |
20 | ${CC} ${CCFLAGS} main.c -dynamiclib -o libmain2.dylib -seg1addr 0x200000 -Wl,-function_starts | |
21 | ${DYLDINFO} -function_starts libmain2.dylib | grep _bar | ${FAIL_IF_EMPTY} | |
22 | # as dylib with aliases | |
23 | ${CC} ${CCFLAGS} main.c -dynamiclib -o libmain3.dylib -Wl,-function_starts -Wl,-alias,_mid,midalias | |
24 | ${DYLDINFO} -function_starts libmain3.dylib | grep _bar | ${FAIL_IF_EMPTY} | |
afe874b1 A |
25 | # as static main executable |
26 | ${CC} ${CCFLAGS} main.c -static -e _main -o main_static -nostdlib -Wl,-new_linker -Wl,-alias,_myexit,_exit | |
27 | ${DYLDINFO} -function_starts main_static | grep _bar | ${FAIL_IF_STDIN} | |
28 | ${CC} ${CCFLAGS} main.c -static -e _main -o main_static -nostdlib -Wl,-new_linker -Wl,-alias,_myexit,_exit -Wl,-function_starts | |
29 | ${DYLDINFO} -function_starts main_static | grep _bar | ${FAIL_IF_EMPTY} | |
30 | ||
31 | ||
a645023d A |
32 | ${PASS_IFF_GOOD_MACHO} main |
33 | ||
34 | ||
35 | clean: | |
afe874b1 | 36 | rm main libmain.dylib libmain2.dylib libmain3.dylib main_static |