]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/local-symbol-partial-stripping/Makefile
8fc14f720341219e9a1068779efab725a8ee25d7
[apple/ld64.git] / unit-tests / test-cases / local-symbol-partial-stripping / Makefile
1 ##
2 # Copyright (c) 2007 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 # This test case checks -non_global_symbols_no_strip_list and -non_global_symbols_strip_list
28 # with and without wildcards
29 #
30
31
32 run: all
33
34 all:
35 ${CC} ${CCFLAGS} main.c foo.c -o main
36 ${FAIL_IF_BAD_MACHO} main
37 nm -j main > main.nm
38 # build stripping a.list
39 ${CC} ${CCFLAGS} main.c foo.c -Wl,-non_global_symbols_strip_list,a.list -o main-a
40 ${FAIL_IF_BAD_MACHO} main-a
41 nm -j main-a > main-a.nm
42 diff main.nm main-a.nm | egrep '<|>' > a.diff
43 diff a.diff a.expect | ${FAIL_IF_STDIN}
44 # build but strip at .o file level a.list
45 ${CC} ${CCFLAGS} main.c -c -o main.o
46 ${CC} ${CCFLAGS} foo.c -c -o foo.o
47 ${LD} -r -arch ${ARCH} main.o foo.o -o all-a.o -non_global_symbols_strip_list a.list
48 ${CC} ${CCFLAGS} all-a.o -Wl,-non_global_symbols_strip_list,a.list -o main-a
49 ${FAIL_IF_BAD_MACHO} main-a
50 nm -j main-a > main-a.nm
51 diff main.nm main-a.nm | egrep '<|>' > a.diff
52 diff a.diff a.expect | ${FAIL_IF_STDIN}
53 # build stripping b.list
54 ${CC} ${CCFLAGS} main.c foo.c -Wl,-non_global_symbols_strip_list,b.list -o main-b
55 ${FAIL_IF_BAD_MACHO} main-b
56 nm -j main-b > main-b.nm
57 diff main.nm main-b.nm | egrep '<|>' > b.diff
58 diff b.diff b.expect | ${FAIL_IF_STDIN}
59 # build but strip at .o file level b.list
60 ${CC} ${CCFLAGS} main.c -c -o main.o
61 ${CC} ${CCFLAGS} foo.c -c -o foo.o
62 ${LD} -r -arch ${ARCH} main.o foo.o -o all-b.o -non_global_symbols_strip_list b.list
63 ${CC} ${CCFLAGS} all-b.o -Wl,-non_global_symbols_strip_list,b.list -o main-b
64 ${FAIL_IF_BAD_MACHO} main-b
65 nm -j main-b > main-b.nm
66 diff main.nm main-b.nm | egrep '<|>' > b.diff
67 diff b.diff b.expect | ${FAIL_IF_STDIN}
68 # build stripping c.list
69 ${CC} ${CCFLAGS} main.c foo.c -Wl,-non_global_symbols_no_strip_list,c.list -o main-c
70 nm -m main-c | grep non-external | grep -v my | ${FAIL_IF_STDIN}
71 ${PASS_IFF_GOOD_MACHO} main-c
72
73
74 clean:
75 rm -rf main main.nm main-a main-a.nm a.diff main-b main-b.nm b.diff main-c all-a.o all-b.o foo.o main.o