1#!/bin/sh
2cc="@CC@"
3libc="@PREFIX@"
4libc_inc="@INCDIR@"
5libc_lib="@LIBDIR@"
6thisdir="`cd "$(dirname "$0")"; pwd`"
7
8# prevent clang from running the linker (and erroring) on no input.
9sflags=
10eflags=
11for x ; do
12    case "$x" in
13        -l*) input=1 ;;
14        *) input= ;;
15    esac
16    if test "$input" ; then
17        sflags="-l-user-start"
18        eflags="-l-user-end"
19        break
20    fi
21done
22
23exec $cc \
24    -B"$thisdir" \
25    -fuse-ld=musl-clang \
26    -static-libgcc \
27    -nostdinc \
28    --sysroot "$libc" \
29    -isystem "$libc_inc" \
30    -L-user-start \
31    $sflags \
32    "$@" \
33    $eflags \
34    -L"$libc_lib" \
35    -L-user-end
36