Path: blob/master/arch/powerpc/tools/gcc-check-mprofile-kernel.sh
26444 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.023set -e4set -o pipefail56# To debug, uncomment the following line7# set -x89# -mprofile-kernel is only supported on 64-bit with ELFv2, so this should not10# be invoked for other targets. Therefore we can pass in -m64 and -mabi11# explicitly, to take care of toolchains defaulting to other targets.1213# Test whether the compile option -mprofile-kernel exists and generates14# profiling code (ie. a call to _mcount()).15echo "int func() { return 0; }" | \16$* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \172> /dev/null | grep -q "_mcount"1819# Test whether the notrace attribute correctly suppresses calls to _mcount().2021echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \22$* -m64 -mabi=elfv2 -S -x c -O2 -p -mprofile-kernel - -o - \232> /dev/null | grep -q "_mcount" && \24exit 12526exit 0272829