Path: blob/master/arch/powerpc/tools/gcc-check-mprofile-kernel.sh
51347 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.023set -e45# To debug, uncomment the following line6# set -x78# -mprofile-kernel is only supported on 64-bit with ELFv2, so this should not9# be invoked for other targets. Therefore we can pass in -m64 and -mabi10# explicitly, to take care of toolchains defaulting to other targets.1112# Test whether the compile option -mprofile-kernel exists and generates13# profiling code (ie. a call to _mcount()).14echo "int func() { return 0; }" | \15$* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \162> /dev/null | grep -q "_mcount"1718# Test whether the notrace attribute correctly suppresses calls to _mcount().1920echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \21$* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \222> /dev/null | grep -q "_mcount" && \23exit 12425exit 0262728