3 # On ultrix, this will compile string constants into the text segment
4 # where they can be shared. Use to build pine by saying:
8 # As of Pine4.03, this moves about 675k per process into shareable memory
10 # Corey Satten, corey@cac.washington.edu, 9/11/98
13 TMP2
=/tmp
/cc$$.delayed
14 trap "rm -f $TMP1 $TMP2" 0 1 2 13 15
22 1//*) ofile
="$i"; oflag
=;;
23 //*.c
) cfile
="$i"; : ${ofile=`basename $i .c`.o};;
28 1) sfile
=`basename $ofile .o`.s
31 # Postprocess assembly language to move strings to .text segment.
33 # Use sed to collect .ascii statements and their preceding label
34 # and .align and emit those to $TMP2, the rest to $TMP1.
37 # In state0: if .align is seen -> state1; else print, -> state0
38 # In state1: if a label is seen -> state2; else -> punt
39 # In state2: if .ascii is seen -> state3; else -> punt
40 # In state3: if .ascii is seen -> state4; else write TMP2, -> state0
41 # In state4: append to buffer, -> state3
42 # In state punt: print unprinted lines, -> state0
46 /^[ ][ ]*\.align/ b state1
57 /^[ ][ ]*\.ascii/ b state3
62 /^[ ][ ]*\.ascii/ b state4
76 # now add the deferred .ascii statements to .text segment in $TMP1
77 echo ' .text' >> $TMP1
80 rm `basename $ofile .o`.s
81 gcc
${gflag+"-g"} -c -o $ofile $TMP1