1#!/bin/sh 2cc="@CC@" 3libc_lib="@LIBDIR@" 4ldso="@LDSO@" 5cleared= 6shared= 7userlinkdir= 8userlink= 9 10for x ; do 11 test "$cleared" || set -- ; cleared=1 12 13 case "$x" in 14 -L-user-start) 15 userlinkdir=1 16 ;; 17 -L-user-end) 18 userlinkdir= 19 ;; 20 -L*) 21 test "$userlinkdir" && set -- "$@" "$x" 22 ;; 23 -l-user-start) 24 userlink=1 25 ;; 26 -l-user-end) 27 userlink= 28 ;; 29 crtbegin*.o|crtend*.o) 30 set -- "$@" $($cc -print-file-name=$x) 31 ;; 32 -lgcc|-lgcc_eh) 33 file=lib${x#-l}.a 34 set -- "$@" $($cc -print-file-name=$file) 35 ;; 36 -l*) 37 test "$userlink" && set -- "$@" "$x" 38 ;; 39 -shared) 40 shared=1 41 set -- "$@" -shared 42 ;; 43 -sysroot=*|--sysroot=*) 44 ;; 45 *) 46 set -- "$@" "$x" 47 ;; 48 esac 49done 50 51exec $($cc -print-prog-name=ld) -nostdlib "$@" -lc -dynamic-linker "$ldso" 52