2 # Copyright (c) 2014 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 # Check interaction of -section_rename, -segment_rename, and -move_to_r._segment
33 ${CC} ${CCFLAGS} main.c -c -o main.o -flto
34 ${CC} ${CCFLAGS} foo.c -c -o foo.o -flto
35 ${CC} ${CCFLAGS} other.c -c -o other.o -flto
36 ${LD} -arch ${ARCH} main.o foo.o other.o -preload -o main.preload \
37 -e _foo -trace_symbol_layout \
38 -move_to_ro_segment __ROM1 rom1.symbols \
39 -move_to_rw_segment __RAM1 ram1.symbols
40 nm -m main.preload | grep _mainget | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
41 nm -m main.preload | grep _getpi | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
42 nm -m main.preload | grep _bar | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
43 nm -m main.preload | grep _foo | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
44 nm -m main.preload | grep _def | grep __RAM1 | grep __data | ${FAIL_IF_EMPTY}
45 nm -m main.preload | grep _ghi | grep __RAM1 | grep __data | ${FAIL_IF_EMPTY}
46 nm -m main.preload | grep _com | grep __RAM1 | grep __bss | ${FAIL_IF_EMPTY}
47 nm -m main.preload | grep _abc | grep __RAM1 | grep __data | ${FAIL_IF_EMPTY}
48 nm -m main.preload | grep _com4 | grep __RAM1 | grep __bss | ${FAIL_IF_EMPTY}
49 nm -m main.preload | grep _main | grep __TEXT | grep __text | ${FAIL_IF_EMPTY}
50 nm -m main.preload | grep _version | grep __TEXT | grep __text | ${FAIL_IF_EMPTY}
51 nm -m main.preload | grep _otherget | grep __TEXT | grep __text | ${FAIL_IF_EMPTY}
52 nm -m main.preload | grep _mylocal | grep __TEXT | grep __text | ${FAIL_IF_EMPTY}
53 nm -m main.preload | grep _x | grep __DATA | grep __data | ${FAIL_IF_EMPTY}
54 nm -m main.preload | grep _all | grep __DATA | grep __data | ${FAIL_IF_EMPTY}
55 nm -m main.preload | grep _x | grep __DATA | grep __data | ${FAIL_IF_EMPTY}
56 nm -m main.preload | grep _com5 | grep __DATA | grep __bss | ${FAIL_IF_EMPTY}
60 rm -f main.preload main.o other.o foo.o