Files
llvm-mingw/wrappers/clang-target-wrapper.sh
T
Martin Storsjö 55e8aef024 Provide <triplet>-<tool> wrappers and links to many llvm tools
Provide wrappers named <triplet>-gcc and <triplet>-g++ as well,
to ease cross compilation with e.g. autotools, to allow just
specifying --host=<triplet>.

Provide wrappers for objdump and ld that provide specific output
that autotools look for.

Provide <triplet>-strip as a symlink to /bin/true, since there is
no strip tool available yet (and llvm-objcopy doesn't support
COFF yet).
2018-01-10 10:53:02 +02:00

40 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET="$(basename $0 | sed 's/-[^-]*$//')"
EXE=$(basename $0 | sed 's/.*-\([^-]*\)/\1/')
case $EXE in
clang*)
;;
gcc)
EXE=clang
;;
g++)
EXE=clang++
;;
esac
ARCH=$(echo $TARGET | sed 's/-.*//')
SYSROOT="$(cd "$DIR"/../$TARGET && pwd)"
case $ARCH in
i686)
# Dwarf is the default for i686, but currently there's an issue
# in libunwind with unwinding clang generated dwarf opcodes on 32 bit
# x86, pending resolution at https://reviews.llvm.org/D38680.
ARCH_FLAGS=-fsjlj-exceptions
;;
x86_64)
# Explicitly request dwarf on x86_64; SEH is the default there but
# libcxxabi lacks support for it.
ARCH_FLAGS=-fdwarf-exceptions
;;
armv7)
# Dwarf is the default here.
ARCH_FLAGS=
;;
aarch64)
# Dwarf is the default on aarch64; enable emulated TLS since native
# TLS isn't implemented yet.
ARCH_FLAGS=-femulated-tls
;;
esac
$DIR/$EXE -target $TARGET -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld --sysroot="$SYSROOT" $ARCH_FLAGS -Qunused-arguments "$@"