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