swh:1:snp:173f8deb0c56c557784b4fd217e7608ac6197844
Raw File
Tip revision: c470abd4fde40ea6a0846a2beab642a578c0b8cd authored by Linus Torvalds on 19 February 2017, 22:34:00 UTC
Linux 4.10
Tip revision: c470abd
gcc-check-mprofile-kernel.sh
#!/bin/bash

set -e
set -o pipefail

# To debug, uncomment the following line
# set -x

# Test whether the compile option -mprofile-kernel exists and generates
# profiling code (ie. a call to _mcount()).
echo "int func() { return 0; }" | \
    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
    grep -q "_mcount"

# Test whether the notrace attribute correctly suppresses calls to _mcount().

echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
    $* -S -x c -O2 -p -mprofile-kernel - -o - 2> /dev/null | \
    grep -q "_mcount" && \
    exit 1

echo "OK"
exit 0
back to top