link (729B)
1 #!/bin/sh -f 2 3 LD=$1 4 LDFLAGS=$2; shift 2 5 6 outfile="$1"; shift 7 bin="$(echo $0 | sed 's,/[^/]*$,,')" 8 9 # Derived from Russ Cox's 9l in plan9port. 10 ofiles="" 11 args="" 12 for i 13 do 14 case "$i" in 15 *.[ao]|*.o_pic) 16 ofiles="$ofiles $i" 17 ;; 18 *) 19 args="$args $i" 20 ;; 21 esac 22 done 23 24 xtmp=/tmp/ld.$$.$USER.out 25 26 echo LD "$($bin/cleanname ${BASE}$outfile)" 27 [ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args 28 $LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1 29 status=$? 30 [ $status -eq 0 ] || echo $LD -o $outfile $ofiles $LDFLAGS $args >&2 31 32 sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . | 33 egrep -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime' 34 rm -f $xtmp 35 36 exit $status 37