Linux Audio

Check our new training course

Loading...
v4.17
 1#!/bin/bash
 2# SPDX-License-Identifier: GPL-2.0
 3
 4set -e
 5set -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()).
12echo "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
18echo -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
23echo "OK"
24exit 0
v6.13.7
 1#!/bin/bash
 2# SPDX-License-Identifier: GPL-2.0
 3
 4set -e
 5set -o pipefail
 6
 7# To debug, uncomment the following line
 8# set -x
 9
10# -mprofile-kernel is only supported on 64-bit with ELFv2, so this should not
11# be invoked for other targets. Therefore we can pass in -m64 and -mabi
12# explicitly, to take care of toolchains defaulting to other targets.
13
14# Test whether the compile option -mprofile-kernel exists and generates
15# profiling code (ie. a call to _mcount()).
16echo "int func() { return 0; }" | \
17    $* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \
18    2> /dev/null | grep -q "_mcount"
19
20# Test whether the notrace attribute correctly suppresses calls to _mcount().
21
22echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
23    $* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \
24    2> /dev/null | grep -q "_mcount" && \
25    exit 1
26
 
27exit 0