run.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. set -e
  2. # Test our implementation
  3. case $1 in
  4. thumb*)
  5. xargo build --target $1
  6. xargo build --target $1 --release
  7. ;;
  8. # QEMU crashes even when executing the simplest cross compiled C program:
  9. # `int main() { return 0; }`
  10. powerpc64le-unknown-linux-gnu)
  11. cargo test --target $1 --no-run
  12. cargo test --target $1 --no-run --release
  13. ;;
  14. *)
  15. cargo test --target $1
  16. cargo test --target $1 --release
  17. ;;
  18. esac
  19. # Verify that we haven't drop any intrinsic/symbol
  20. case $1 in
  21. thumb*)
  22. xargo build --features c --target $1 --bin intrinsics
  23. ;;
  24. *)
  25. cargo build --features c --target $1 --bin intrinsics
  26. ;;
  27. esac
  28. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  29. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  30. case $1 in
  31. armv7-*)
  32. PREFIX=arm-linux-gnueabihf-
  33. ;;
  34. thumb*)
  35. PREFIX=arm-none-eabi-
  36. ;;
  37. *86*-*)
  38. PREFIX=
  39. ;;
  40. esac
  41. case $TRAVIS_OS_NAME in
  42. osx)
  43. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  44. # Use GNU nm instead
  45. NM=gnm
  46. brew install binutils
  47. ;;
  48. *)
  49. NM=nm
  50. ;;
  51. esac
  52. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  53. stdout=$($PREFIX$NM -g --defined-only /target/${1}/debug/librustc_builtins.rlib)
  54. set +e
  55. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  56. if test $? = 0; then
  57. exit 1
  58. fi