]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/cpu-sub-types-preference/Makefile
ld64-85.tar.gz
[apple/ld64.git] / unit-tests / test-cases / cpu-sub-types-preference / Makefile
1 ##
2 # Copyright (c) 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 #
27 # Validate cpu subtype preference
28 #
29
30 test: test-${ARCH}
31
32 test-ppc64:
33 ${PASS_IFF} true
34
35 test-i386:
36 ${PASS_IFF} true
37
38 test-x86_64:
39 ${PASS_IFF} true
40
41 test-armv6:
42 gcc foo.c -arch armv4t -c -DAAA=1 -o foo4.o
43 gcc foo.c -arch armv5 -c -DBBB=1 -o foo5.o
44 gcc foo.c -arch armv6 -c -DCCC=1 -o foo6.o
45 gcc foo.c -arch xscale -c -DDDD=1 -o foox.o
46 lipo foo4.o foo5.o foo6.o foox.o -create -output foo.o
47
48 # check -arch armv4t pulls out V4 slice
49 ${LD} -r -arch armv4t foo.o -o fooa.o
50 otool -hv fooa.o | grep V4T | ${FAIL_IF_EMPTY}
51 nm fooa.o | grep _aaa | ${FAIL_IF_EMPTY}
52
53 # check -arch armv5 pulls out V5 slice
54 ${LD} -r -arch armv5 foo.o -o foob.o
55 otool -hv foob.o | grep V5 | ${FAIL_IF_EMPTY}
56 nm foob.o | grep _bbb | ${FAIL_IF_EMPTY}
57
58 # check -arch armv6 pulls out V6 slice
59 ${LD} -r -arch armv6 foo.o -o fooc.o
60 otool -hv fooc.o | grep V6 | ${FAIL_IF_EMPTY}
61 nm fooc.o | grep _ccc | ${FAIL_IF_EMPTY}
62
63 # check -arch xscale pulls out xscale slice
64 ${LD} -r -arch xscale foo.o -o fooxx.o
65 otool -hv fooxx.o | grep XSCALE | ${FAIL_IF_EMPTY}
66 nm fooxx.o | grep _ddd | ${FAIL_IF_EMPTY}
67
68 ${PASS_IFF} true
69
70
71 test-ppc:
72 gcc foo.c -arch ppc750 -c -DAAA=1 -o foog3.o
73 gcc foo.c -arch ppc7400 -c -DBBB=1 -o foog4.o
74 gcc foo.c -arch ppc970 -c -DCCC=1 -o foog5.o
75 lipo foog3.o foog4.o foog5.o -create -output foo.o
76
77 # check -arch ppc750 pulls out g3 slice
78 ${LD} -r -arch ppc750 foo.o -o fooa.o
79 otool -hv fooa.o | grep ppc750 | ${FAIL_IF_EMPTY}
80 nm fooa.o | grep _aaa | ${FAIL_IF_EMPTY}
81
82 # check -arch ppc7400 pulls out g4 slice
83 ${LD} -r -arch ppc7400 foo.o -o foob.o
84 otool -hv foob.o | grep ppc7400 | ${FAIL_IF_EMPTY}
85 nm foob.o | grep _bbb | ${FAIL_IF_EMPTY}
86
87 # check -arch ppc970 pulls out g5 slice
88 ${LD} -r -arch ppc970 foo.o -o fooc.o
89 otool -hv fooc.o | grep ppc970 | ${FAIL_IF_EMPTY}
90 nm fooc.o | grep _ccc | ${FAIL_IF_EMPTY}
91
92 ${PASS_IFF} true
93
94
95 clean:
96 rm -f *.o