Path: blob/master/arch/powerpc/tools/gcc-check-fpatchable-function-entry.sh
26444 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.023set -e4set -o pipefail56# To debug, uncomment the following line7# set -x89# Output from -fpatchable-function-entry can only vary on ppc64 elfv2, so this10# should not be invoked for other targets. Therefore we can pass in -m64 and11# -mabi explicitly, to take care of toolchains defaulting to other targets.1213# Test whether the compile option -fpatchable-function-entry exists and14# generates appropriate code15echo "int func() { return 0; }" | \16$* -m64 -mabi=elfv2 -S -x c -O2 -fpatchable-function-entry=2 - -o - 2> /dev/null | \17grep -q "__patchable_function_entries"1819# Test whether nops are generated after the local entry point20echo "int x; int func() { return x; }" | \21$* -m64 -mabi=elfv2 -S -x c -O2 -fpatchable-function-entry=2 - -o - 2> /dev/null | \22awk 'BEGIN { RS = ";" } /\.localentry.*nop.*\n[[:space:]]*nop/ { print $0 }' | \23grep -q "func:"2425exit 0262728