2 # Given a list of header files, compute the bss index that results from
3 # including them. (See prevent_bss_reordering.h for more information.)
5 TEMPC
=$
(mktemp
-t bss.XXXXXXX.c
)
6 TEMPO
=$
(mktemp
-t bss.XXXXXXX.o
)
7 trap "rm -f $TEMPC $TEMPO" EXIT
12 echo "Usage: ./tools/calc_bss.sh file1.h file2.h ..." >&2
16 if [ -z "$QEMU_IRIX" ]; then
17 echo "env variable QEMU_IRIX should point to the qemu-mips binary" >&2
21 if [ -z "$CROSS" ]; then
25 # bss indexing starts at 3
27 echo "char bss$I;" >> $TEMPC
30 echo "char bss$I;" >> $TEMPC
33 while [[ $# -gt 0 ]]; do
34 echo "#include \"$1\"" >> $TEMPC
38 echo "char measurement;" >> $TEMPC
40 $QEMU_IRIX -silent -L $IRIX_ROOT $IRIX_ROOT/usr
/bin
/cc
-c -non_shared -G 0 \
41 -g -Xcpluscomm -mips2 -I $
(pwd)/include
/ $TEMPC -o $TEMPO
43 LINE
=$
(${CROSS}objdump
-t $TEMPO |
grep measurement | cut
-d' ' -f1)
45 echo "bss index: $NUM"