run.sh 2.2 KB

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