2011-02-12 05:22:29 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-06-24 02:13:47 +00:00
|
|
|
printf '#!/bin/sh\n\nlibc_prefix="%s"\narch="%s"\n' "$1" "$2"
|
2011-02-12 05:22:29 +00:00
|
|
|
|
|
|
|
cat <<"EOF"
|
|
|
|
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`"
|
2011-03-01 17:04:36 +00:00
|
|
|
libgcc=${libgcc%libgcc.a}
|
2011-02-12 05:22:29 +00:00
|
|
|
|
|
|
|
gcc -wrapper sh,-c,'
|
|
|
|
x= ; y= ; z= ; s= ; for i ; do
|
|
|
|
[ "$z" ] || set -- ; z=1
|
|
|
|
case "$i" in
|
|
|
|
-shared) s=1 ; set -- "$@" -shared ;;
|
|
|
|
-Lxxxxxx) x=1 ;;
|
|
|
|
-xxxxxx) x= ; [ "$s" ] || set -- "$@" "'"$libc_start"'" "'"$libc_crt"'" ;;
|
|
|
|
-l*) [ "$y" ] || set -- "$@" '"$libc_end"' ; set -- "$@" "$i" ; y=1 ;;
|
|
|
|
*) [ "$x" ] || set -- "$@" "$i" ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
exec "$0" "$@"
|
|
|
|
' -std=gnu99 -nostdinc -nostdlib \
|
|
|
|
-isystem "$libc_inc" -isystem "$gcc_inc" \
|
2011-06-24 02:13:47 +00:00
|
|
|
-Wl,-xxxxxx "$@" -L"$libc_lib" -lc -L"$libgcc" -lgcc -Lxxxxxx \
|
|
|
|
-Wl,-dynamic-linker /lib/ld-musl-"$arch".so.1 -Wl,-nostdlib
|
2011-02-12 05:22:29 +00:00
|
|
|
EOF
|