3 printf '#!/bin/sh\n\nlibc_prefix="%s"\nldso_pathname="%s"\n' "$1" "$2"
7 libc_lib=$libc_prefix/lib
8 libc_inc=$libc_prefix/include
9 libc_crt="$libc_lib/crt1.o"
10 libc_start="$libc_lib/crti.o"
11 libc_end="$libc_lib/crtn.o"
14 libgcc="$("$gcc" -print-file-name=libgcc.a)"
15 libgcc=${libgcc%/libgcc.a}
18 gcctarget=${libgcc%/*}
19 gcctarget=${gcctarget##*/}
23 *) nosp=-fno-stack-protector ;;
26 [ "x$1" = "x-V" ] && { printf "%s: -V not supported\n" "$0" ; exit 1 ; }
30 -I|-L) skip=--- ; continue ;;
31 -[cSE]|-M*) nolink=1 ;;
32 -shared|-nostartfiles|-nostdlib) nocrt=1 ;;
39 [ "$havefile" ] || nolink=1
41 [ "$nolink" ] && nocrt=1
43 [ "$nocrt" ] || set -- "$libc_start" "$libc_crt" "$@" "$libc_end" \
46 tmp_specs=$HOME/.specs.tmp.$$
47 printf '*link_libgcc:\n\n\n' > "$tmp_specs" || exit 1
50 set -- -specs=/proc/self/fd/3 "$@" \
51 -Wl,--as-needed -Wl,--start-group -lc -lgcc -lgcc_eh -Wl,--end-group \
52 -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib
55 set -- -nostdinc -nostdlib $nosp \
56 -isystem "$libc_inc" -isystem "$gcc_inc" "$@" \
57 -L"$libc_lib" -L"$libgcc"