]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/objc-gc-checks/Makefile
ld64-84.1.2.tar.gz
[apple/ld64.git] / unit-tests / test-cases / objc-gc-checks / Makefile
1 ##
2 # Copyright (c) 2007-2008 Apple Inc. All rights reserved.
3 #
4 # @APPLE_LICENSE_HEADER_START@
5 #
6 # This file contains Original Code and/or Modifications of Original Code
7 # as defined in and that are subject to the Apple Public Source License
8 # Version 2.0 (the 'License'). You may not use this file except in
9 # compliance with the License. Please obtain a copy of the License at
10 # http://www.opensource.apple.com/apsl/ and read it before using this
11 # file.
12 #
13 # The Original Code and all software distributed under the License are
14 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 # Please see the License for the specific language governing rights and
19 # limitations under the License.
20 #
21 # @APPLE_LICENSE_HEADER_END@
22 ##
23 TESTROOT = ../..
24 include ${TESTROOT}/include/common.makefile
25
26 SHELL = bash # use bash shell so we can redirect just stderr
27
28
29
30 #
31 # Validate that the linker catches illegal combinations of .o files
32 # compiled with different GC settings.
33 #
34
35 test:
36 ${CC} ${CCFLAGS} foo.m -c -o foo.o
37 ${FAIL_IF_BAD_OBJ} foo.o
38
39 ${CC} ${CCFLAGS} foo.m -c -o foo-gc.o -fobjc-gc
40 ${FAIL_IF_BAD_OBJ} foo-gc.o
41
42 ${CC} ${CCFLAGS} foo.m -c -o foo-gc-only.o -fobjc-gc-only
43 ${FAIL_IF_BAD_OBJ} foo-gc-only.o
44
45 ${CC} ${CCFLAGS} bar.m -c -o bar.o
46 ${FAIL_IF_BAD_OBJ} bar.o
47
48 ${CC} ${CCFLAGS} bar.m -c -o bar-gc.o -fobjc-gc
49 ${FAIL_IF_BAD_OBJ} bar-gc.o
50
51 ${CC} ${CCFLAGS} bar.m -c -o bar-gc-only.o -fobjc-gc-only
52 ${FAIL_IF_BAD_OBJ} bar-gc-only.o
53
54 # check RR + RR -> RR
55 ${CC} ${CCFLAGS} foo.o bar.o runtime.c -dynamiclib -o libfoobar.dylib
56 ${FAIL_IF_BAD_MACHO} libfoobar.dylib
57
58 # check GC/RR + GC/RR -> GC/RR
59 ${CC} ${CCFLAGS} foo-gc.o bar-gc.o runtime.c -dynamiclib -o libfoobar.dylib
60 ${FAIL_IF_BAD_MACHO} libfoobar.dylib
61 otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x2 | ${FAIL_IF_EMPTY}
62
63 # check GC + GC -> GC
64 ${CC} ${CCFLAGS} foo-gc-only.o bar-gc-only.o runtime.c -dynamiclib -o libfoobar.dylib
65 ${FAIL_IF_BAD_MACHO} libfoobar.dylib
66 otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x6 | ${FAIL_IF_EMPTY}
67
68 # check RR + GC/RR -> RR
69 ${CC} ${CCFLAGS} foo.o bar-gc.o runtime.c -dynamiclib -o libfoobar.dylib
70 ${FAIL_IF_BAD_MACHO} libfoobar.dylib
71 otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x[26] | ${FAIL_IF_STDIN}
72
73 # check GC + GC/RR -> GC
74 ${CC} ${CCFLAGS} foo-gc-only.o bar-gc.o runtime.c -dynamiclib -o libfoobar.dylib
75 ${FAIL_IF_BAD_MACHO} libfoobar.dylib
76 otool -o libfoobar.dylib | grep -A4 _image | grep flags | grep 0x6 | ${FAIL_IF_EMPTY}
77
78 # check RR + GC -> error
79 ${FAIL_IF_SUCCESS} ${CC} ${CCFLAGS} foo.o bar-gc-only.o runtime.c -dynamiclib -o libfoobar.dylib 2> fail.log
80
81 ${PASS_IFF} true
82
83 clean:
84 rm -rf foo*.o bar*.o libfoobar.dylib fail.log