2 # Copyright (c) 2007 Apple Inc. All rights reserved.
4 # @APPLE_LICENSE_HEADER_START@
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
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.
21 # @APPLE_LICENSE_HEADER_END@
24 include ${TESTROOT}/include/common.makefile
27 # Validate cpu subtypes processing
30 CC_ARM = $(shell xcrun -find clang) -miphoneos-version-min=5.0 -isysroot ${IOS_SDK}
47 ${CC_ARM} foo.c -arch armv4t -c -o foo-v4.o
48 ${FAIL_IF_BAD_OBJ} foo-v4.o
49 ${CC_ARM} foo.c -arch armv5 -c -o foo-v5.o
50 ${FAIL_IF_BAD_OBJ} foo-v5.o
51 ${CC_ARM} foo.c -arch armv6 -c -o foo-v6.o
52 ${FAIL_IF_BAD_OBJ} foo-v6.o
53 ${CC_ARM} foo.c -arch armv7 -c -o foo-v7.o
54 ${FAIL_IF_BAD_OBJ} foo-v7.o
55 ${CC_ARM} foo.c -arch xscale -c -o foo-xscale.o
56 ${FAIL_IF_BAD_OBJ} foo-xscale.o
57 ${CC_ARM} main.c -arch armv4t -c -o main-v4.o
58 ${FAIL_IF_BAD_OBJ} main-v4.o
59 ${CC_ARM} main.c -arch armv5 -c -o main-v5.o
60 ${FAIL_IF_BAD_OBJ} main-v5.o
61 ${CC_ARM} main.c -arch armv6 -c -o main-v6.o
62 ${FAIL_IF_BAD_OBJ} main-v6.o
63 ${CC_ARM} main.c -arch xscale -c -o main-xscale.o
64 ${FAIL_IF_BAD_OBJ} main-xscale.o
65 ${CC_ARM} main.c -arch armv7 -c -o main-v7.o
66 ${FAIL_IF_BAD_OBJ} main-v7.o
69 # ${LD} -r main-v4.o foo-v4.o -o all.o
70 # ${FAIL_IF_BAD_OBJ} all.o
71 # otool -hv all.o | grep V4T | ${FAIL_IF_EMPTY}
74 #${LD} -r main-v4.o foo-v5.o -o all.o
75 #${FAIL_IF_BAD_OBJ} all.o
76 #otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
79 #${LD} -r main-v4.o foo-v6.o -o all.o
80 #${FAIL_IF_BAD_OBJ} all.o
81 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
83 # check V4+xscale -> xscale
84 #${LD} -r main-v4.o foo-xscale.o -o all.o
85 #${FAIL_IF_BAD_OBJ} all.o
86 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
89 # ${LD} -r main-v5.o foo-v5.o -o all.o
90 # ${FAIL_IF_BAD_OBJ} all.o
91 # otool -hv all.o | grep V5 | ${FAIL_IF_EMPTY}
94 #${LD} -r main-v5.o foo-v6.o -o all.o
95 #${FAIL_IF_BAD_OBJ} all.o
96 #otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
98 # check V5+xscale -> xscale
99 #${LD} -r main-v5.o foo-xscale.o -o all.o
100 #${FAIL_IF_BAD_OBJ} all.o
101 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
104 ${LD} -r main-v6.o foo-v6.o -o all.o
105 ${FAIL_IF_BAD_OBJ} all.o
106 otool -hv all.o | grep V6 | ${FAIL_IF_EMPTY}
109 ${LD} -r main-v7.o foo-v7.o -o all.o
110 ${FAIL_IF_BAD_OBJ} all.o
111 otool -hv all.o | grep V7 | ${FAIL_IF_EMPTY}
113 # check xscale+xscale -> xscale
114 #${LD} -r main-xscale.o foo-xscale.o -o all.o
115 #${FAIL_IF_BAD_OBJ} all.o
116 #otool -hv all.o | grep XSCALE | ${FAIL_IF_EMPTY}
122 gcc foo.c -arch ppc -mmacosx-version-min=10.4 -c -o foo.o
123 ${FAIL_IF_BAD_OBJ} foo.o
124 gcc foo.c -arch ppc750 -c -o foo-G3.o
125 ${FAIL_IF_BAD_OBJ} foo-G3.o
126 gcc foo.c -arch ppc7400 -c -o foo-G4.o
127 ${FAIL_IF_BAD_OBJ} foo-G4.o
128 gcc foo.c -arch ppc970 -c -o foo-G5.o
129 ${FAIL_IF_BAD_OBJ} foo-G5.o
130 gcc main.c -arch ppc -mmacosx-version-min=10.4 -c -o main.o
131 ${FAIL_IF_BAD_OBJ} main.o
132 gcc main.c -arch ppc970 -c -o main-G5.o
133 ${FAIL_IF_BAD_OBJ} main-G5.o
135 # check ALL+ALL -> ALL
136 ${LD} -r main.o foo.o -o main-r.o
137 ${FAIL_IF_BAD_OBJ} main-r.o
138 otool -hv main-r.o | grep ALL | ${FAIL_IF_EMPTY}
141 ${LD} -r main.o foo-G3.o -o main-r.o
142 ${FAIL_IF_BAD_OBJ} main-r.o
143 otool -hv main-r.o | grep ppc750 | ${FAIL_IF_EMPTY}
146 ${LD} -r main.o foo-G4.o -o main-r.o
147 ${FAIL_IF_BAD_OBJ} main-r.o
148 otool -hv main-r.o | grep ppc7400 | ${FAIL_IF_EMPTY}
151 ${LD} -r main.o foo-G5.o -o main-r.o
152 ${FAIL_IF_BAD_OBJ} main-r.o
153 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
156 ${LD} -r main-G5.o foo-G4.o -o main-r.o
157 ${FAIL_IF_BAD_OBJ} main-r.o
158 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
161 ${LD} -r foo-G4.o main-G5.o -o main-r.o
162 ${FAIL_IF_BAD_OBJ} main-r.o
163 otool -hv main-r.o | grep ppc970 | ${FAIL_IF_EMPTY}
165 # check -force_cpusubtype_ALL
166 ${LD} -r main.o foo-G5.o -o main-r.o -force_cpusubtype_ALL
167 ${FAIL_IF_BAD_OBJ} main-r.o
168 otool -hv main-r.o | grep ALL | ${PASS_IFF_STDIN}