musl-clang.in 635 B

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