TESTROOT = ../..
include ${TESTROOT}/include/common.makefile
run: all
all:
${CC} ${CCFLAGS} main.c -c -o main.o
${CC} ${CCFLAGS} other.c -c -o other.o
${LD} -arch ${ARCH} main.o other.o -preload -o main.preload \
-e _foo -trace_symbol_layout \
-move_to_ro_segment __ROM1 rom1.symbols \
-rename_section __TEXT __cstring __ROM2 mycstrings \
-rename_segment __TEXT __ROM3 \
-move_to_rw_segment __RAM1 ram1.symbols \
-rename_section __DATA __data __RAM2 mydata \
-rename_segment __DATA __RAM3 \
-segment_order __ROM1:__ROM2:__ROM3:__RAM1:__RAM2:__RAM3
nm -m main.preload | grep _foo | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _s1 | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _mylocal | grep __ROM1 | grep __text | ${FAIL_IF_EMPTY}
size -l main.preload | grep __cstring | ${FAIL_IF_STDIN}
size -l main.preload | grep mycstrings | ${FAIL_IF_EMPTY}
size -l main.preload | grep __TEXT | ${FAIL_IF_STDIN}
nm -m main.preload | grep _mm | grep __ROM3 | grep __text | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _main | grep __ROM3 | grep __text | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _abc | grep __RAM1 | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _com | grep __RAM1 | ${FAIL_IF_EMPTY}
size -l main.preload | grep __DATA | ${FAIL_IF_STDIN}
nm -m main.preload | grep _def | grep __RAM2 | grep mydata | ${FAIL_IF_EMPTY}
nm -m main.preload | grep _ghi | grep __RAM2 | grep mydata | ${FAIL_IF_EMPTY}
${PASS_IFF} true
clean:
rm -f main.preload main.o other.o