Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0
0003 
0004 set -e
0005 set -o pipefail
0006 
0007 # To debug, uncomment the following line
0008 # set -x
0009 
0010 # -mprofile-kernel is only supported on 64le, so this should not be invoked
0011 # for other targets. Therefore we can pass in -m64 and -mlittle-endian
0012 # explicitly, to take care of toolchains defaulting to other targets.
0013 
0014 # Test whether the compile option -mprofile-kernel exists and generates
0015 # profiling code (ie. a call to _mcount()).
0016 echo "int func() { return 0; }" | \
0017     $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
0018     2> /dev/null | grep -q "_mcount"
0019 
0020 # Test whether the notrace attribute correctly suppresses calls to _mcount().
0021 
0022 echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
0023     $* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
0024     2> /dev/null | grep -q "_mcount" && \
0025     exit 1
0026 
0027 exit 0