#!/bin/sh
-printf '#!/bin/sh\n\nlibc_prefix="%s"\n' "$1"
+printf '#!/bin/sh\n\nlibc_prefix="%s"\nldso_pathname="%s"\n' "$1" "$2"
cat <<"EOF"
libc_lib=$libc_prefix/lib
gcc_inc=$libc_inc
libgcc="`gcc \"$@\" -print-file-name=libgcc.a`"
+libgcc=${libgcc%libgcc.a}
gcc -wrapper sh,-c,'
x= ; y= ; z= ; s= ; for i ; do
exec "$0" "$@"
' -std=gnu99 -nostdinc -nostdlib \
-isystem "$libc_inc" -isystem "$gcc_inc" \
- -Wl,-xxxxxx "$@" -L"$libc_lib" -lc "$libgcc" -Lxxxxxx -Wl,-nostdlib
+ -Wl,-xxxxxx "$@" -L"$libc_lib" -lc -L"$libgcc" -lgcc -Lxxxxxx \
+ -Wl,-dynamic-linker,"$ldso_pathname" -Wl,-nostdlib
EOF