#!/bin/sh gcc=gcc libc_prefix="/usr/local/musl" ldso_pathname="/lib/ld-musl-i386.so.1" libc_lib=$libc_prefix/lib libc_inc=$libc_prefix/include libc_crt="$libc_lib/crt1.o" libc_start="$libc_lib/crti.o" libc_end="$libc_lib/crtn.o" gcc_inc=$libc_inc libgcc="$("$gcc" -print-file-name=libgcc.a)" libgcc=${libgcc%/libgcc.a} gccver=${libgcc##*/} gcctarget=${libgcc%/*} gcctarget=${gcctarget##*/} [ "x$1" = "x-V" ] && { printf "%s: -V not supported\n" "$0" ; exit 1 ; } collect2="$("$gcc" -print-prog-name=collect2)" [ "$HOME" ] || HOME=/tmp wrap_dir=$HOME/.tmp/gcc_wrapper/$gcctarget-$gccver if [ -x "$wrap_dir/collect2" ] ; then true else mkdir -p "$wrap_dir" || exit 1 echo '#!/bin/sh first=1 for i ; do [ "$first" ] && { first= ; set -- ; } case "$i" in -L/dev/null) nolibs=1 ;; -L*) [ "$nolibs" ] || set -- "$@" "$i" ;; *) set -- "$@" "$i" ;; esac done exec "'"$collect2"'" "$@"' > "$wrap_dir/collect2.$$" \ && chmod 755 "$wrap_dir/collect2.$$" \ && mv "$wrap_dir/collect2.$$" "$wrap_dir/collect2" \ || exit 1 fi for i ; do case "$skip$i" in -I|-L) skip=--- ; continue ;; -[cSE]|-M*) nolink=1 ;; -*) ;; *) havefile=1 ;; esac skip= done if [ "$nolink" ] ; then exec "$gcc" -std=gnu99 -nostdinc -fno-stack-protector \ -isystem "$libc_inc" -isystem "$gcc_inc" "$@" exit 1 fi if [ "$havefile" ] ; then exec "$gcc" -B"$wrap_dir" \ -std=gnu99 -nostdinc -nostdlib -fno-stack-protector \ -isystem "$libc_inc" -isystem "$gcc_inc" \ "$libc_start" "$libc_crt" "$@" "$libc_end" \ -L"$libc_lib" -L"$libgcc" -L/dev/null \ -Wl,--start-group -lc -lgcc -lgcc_eh -Wl,--end-group \ -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib exit 1 fi exec "$gcc" -std=gnu99 -nostdinc -nostdlib -fno-stack-protector \ -isystem "$libc_inc" -isystem "$gcc_inc" \ "$@" \ -L"$libc_lib" -L"$libgcc" -L/dev/null \