| 1 | #!/bin/sh |
| 2 | # The linker for x86_64-win7-windows-gnu: llvm-mingw's clang, which links compiler-rt |
| 3 | # itself, with LLVM's libunwind (static) answering for libgcc's unwinder, and rt/shims.c |
| 4 | # standing in for the imports Windows 7 lacks. |
| 5 | set -eu |
| 6 | here=$(cd "$(dirname "$0")" && pwd) |
| 7 | clang=$LLVM_MINGW/bin/x86_64-w64-mingw32-clang |
| 8 | for arg do |
| 9 | shift |
| 10 | case $arg in |
| 11 | -lgcc_eh | -lgcc_s) set -- "$@" -l:libunwind.a ;; |
| 12 | -lgcc) ;; |
| 13 | *) set -- "$@" "$arg" ;; |
| 14 | esac |
| 15 | done |
| 16 | work=$(mktemp -d "${TMPDIR:-/tmp}/windows-link.XXXXXX") |
| 17 | trap 'rm -rf "$work"' EXIT |
| 18 | "$clang" -O2 -Wall -c "$here/rt/shims.c" -o "$work/shims.o" |
| 19 | "$clang" "$work/shims.o" "$@" |