ld.musl-clang.in 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. cc="@CC@"
  3. libc_lib="@LIBDIR@"
  4. ldso="@LDSO@"
  5. cleared=
  6. shared=
  7. userlinkdir=
  8. userlink=
  9. for x ; do
  10. test "$cleared" || set -- ; cleared=1
  11. case "$x" in
  12. -L-user-start)
  13. userlinkdir=1
  14. ;;
  15. -L-user-end)
  16. userlinkdir=
  17. ;;
  18. -L*)
  19. test "$userlinkdir" && set -- "$@" "$x"
  20. ;;
  21. -l-user-start)
  22. userlink=1
  23. ;;
  24. -l-user-end)
  25. userlink=
  26. ;;
  27. crtbegin*.o|crtend*.o)
  28. set -- "$@" $($cc -print-file-name=$x)
  29. ;;
  30. -lgcc|-lgcc_eh)
  31. file=lib${x#-l}.a
  32. set -- "$@" $($cc -print-file-name=$file)
  33. ;;
  34. -l*)
  35. test "$userlink" && set -- "$@" "$x"
  36. ;;
  37. -shared)
  38. shared=1
  39. set -- "$@" -shared
  40. ;;
  41. -sysroot=*|--sysroot=*)
  42. ;;
  43. *)
  44. set -- "$@" "$x"
  45. ;;
  46. esac
  47. done
  48. exec $($cc -print-prog-name=ld) -nostdlib "$@" -lc -dynamic-linker "$ldso"