run.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. # Verify that there are no undefined symbols to `panic` within our implementations
  29. # TODO(#79) fix the undefined references problem for debug-assertions+lto
  30. case $1 in
  31. thumb*)
  32. RUSTFLAGS="-C debug-assertions=no -C link-arg=-nostartfiles" xargo rustc --features c --target $1 --bin intrinsics -- -C lto
  33. xargo rustc --features c --target $1 --bin intrinsics --release -- -C lto
  34. ;;
  35. *)
  36. RUSTFLAGS="-C debug-assertions=no" cargo rustc --features c --target $1 --bin intrinsics -- -C lto
  37. cargo rustc --features c --target $1 --bin intrinsics --release -- -C lto
  38. ;;
  39. esac
  40. # Look out for duplicated symbols when we include the compiler-rt (C) implementation
  41. PREFIX=$(echo $1 | sed -e 's/unknown-//')-
  42. case $1 in
  43. armv7-*)
  44. PREFIX=arm-linux-gnueabihf-
  45. ;;
  46. thumb*)
  47. PREFIX=arm-none-eabi-
  48. ;;
  49. *86*-*)
  50. PREFIX=
  51. ;;
  52. esac
  53. case $TRAVIS_OS_NAME in
  54. osx)
  55. # NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
  56. # Use GNU nm instead
  57. NM=gnm
  58. brew install binutils
  59. ;;
  60. *)
  61. NM=nm
  62. ;;
  63. esac
  64. # NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
  65. if [ $TRAVIS_OS_NAME = osx ]; then
  66. path=target/${1}/debug/librustc_builtins.rlib
  67. else
  68. path=/target/${1}/debug/librustc_builtins.rlib
  69. fi
  70. stdout=$($PREFIX$NM -g --defined-only $path)
  71. set +e
  72. echo "$stdout" | sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
  73. if test $? = 0; then
  74. exit 1
  75. fi