run.sh 2.2 KB

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