gcc-check-mprofile-kernel.sh 600 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -e
  3. set -o pipefail
  4. # To debug, uncomment the following line
  5. # set -x
  6. # Test whether the compile option -mprofile-kernel exists and generates
  7. # profiling code (ie. a call to _mcount()).
  8. echo "int func() { return 0; }" | \
  9. $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
  10. grep -q "_mcount"
  11. # Test whether the notrace attribute correctly suppresses calls to _mcount().
  12. echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
  13. $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
  14. grep -q "_mcount" && \
  15. exit 1
  16. echo "OK"
  17. exit 0