xref: /aosp_15_r20/prebuilts/build-tools/sysroots/i686-unknown-linux-musl/bin/musl-clang (revision cda5da8d549138a6648c5ee6d7a49cf8f4a657be)
1#!/bin/sh
2cc="clang"
3libc="$(dirname "$0")/.."
4libc_inc="${libc}/include"
5libc_lib="${libc}/lib"
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