]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/symbol-section-move/Makefile
32a24b412e2067cc9f08637105e98f2f8bc3c97b
[apple/ld64.git] / unit-tests / test-cases / symbol-section-move / Makefile
1 ##
2 # Copyright (c) 2014 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 # Check interaction of -section_rename, -segment_rename, and -move_to_r._segment
28 #
29
30 run: all
31
32 all:
33 ${CC} ${CCFLAGS} main.c -c -o main.o
34 ${CC} ${CCFLAGS} other.c -c -o other.o
35 ${LD} -arch ${ARCH} main.o other.o -preload -o main.preload \
36 -e _foo -trace_symbol_layout \
37 -move_to_ro_segment __ROM1 rom1.symbols \
38 -rename_section __TEXT __cstring __ROM2 mycstrings \
39 -rename_segment __TEXT __ROM3 \
40 -move_to_rw_segment __RAM1 ram1.symbols \
41 -rename_section __DATA __data __RAM2 mydata \
42 -rename_segment __DATA __RAM3 \
43 -segment_order __ROM1:__ROM2:__ROM3:__RAM1:__RAM2:__RAM3
44 nm -m main.preload | grep _foo | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
45 nm -m main.preload | grep _s1 | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
46 nm -m main.preload | grep _mylocal | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
47 size -l main.preload | grep __cstring | ${FAIL_IF_STDIN}
48 size -l main.preload | grep mycstrings | ${FAIL_IF_EMPTY}
49 size -l main.preload | grep __TEXT | ${FAIL_IF_STDIN}
50 nm -m main.preload | grep _mm | grep __ROM3 | grep __text | ${FAIL_IF_EMPTY}
51 nm -m main.preload | grep _main | grep __ROM3 | grep __text | ${FAIL_IF_EMPTY}
52 nm -m main.preload | grep _abc | grep __RAM1 | ${FAIL_IF_EMPTY}
53 nm -m main.preload | grep _com | grep __RAM1 | ${FAIL_IF_EMPTY}
54 size -l main.preload | grep __DATA | ${FAIL_IF_STDIN}
55 nm -m main.preload | grep _def | grep __RAM2 | grep mydata | ${FAIL_IF_EMPTY}
56 nm -m main.preload | grep _ghi | grep __RAM2 | grep mydata | ${FAIL_IF_EMPTY}
57 ${PASS_IFF} true
58
59 clean:
60 rm -f main.preload main.o other.o