Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit aec0ba7

Browse files
npigginmpe
authored andcommitted
powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels
-mprofile-kernel is an optimised calling convention for mcount that Linux has only implemented with the ELFv2 ABI, so it was disabled for big endian kernels. However it does work with ELFv2 big endian, so let's allow that if the compiler supports it. Acked-by: Naveen N. Rao <[email protected]> Suggested-by: Christophe Leroy <[email protected]> Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 8c5fa3b commit aec0ba7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

arch/powerpc/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,9 @@ config LD_HEAD_STUB_CATCH
547547
If unsure, say "N".
548548

549549
config MPROFILE_KERNEL
550-
depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER
551-
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
550+
depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER
551+
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mlittle-endian) if CPU_LITTLE_ENDIAN
552+
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mbig-endian) if CPU_BIG_ENDIAN
552553

553554
config HOTPLUG_CPU
554555
bool "Support for enabling/disabling CPUs"

arch/powerpc/tools/gcc-check-mprofile-kernel.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ set -o pipefail
77
# To debug, uncomment the following line
88
# set -x
99

10-
# -mprofile-kernel is only supported on 64le, so this should not be invoked
11-
# for other targets. Therefore we can pass in -m64 and -mlittle-endian
12-
# explicitly, to take care of toolchains defaulting to other targets.
10+
# -mprofile-kernel is only supported on 64-bit, so this should not be invoked
11+
# for 32-bit. We pass in -m64 explicitly, and -mbig-endian and -mlittle-endian
12+
# are passed in from Kconfig, which takes care of toolchains defaulting to
13+
# other targets.
1314

1415
# Test whether the compile option -mprofile-kernel exists and generates
1516
# profiling code (ie. a call to _mcount()).
1617
echo "int func() { return 0; }" | \
17-
$* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
18+
$* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \
1819
2> /dev/null | grep -q "_mcount"
1920

2021
# Test whether the notrace attribute correctly suppresses calls to _mcount().
2122

2223
echo -e "#include <linux/compiler.h>\nnotrace int func() { return 0; }" | \
23-
$* -m64 -mlittle-endian -S -x c -O2 -p -mprofile-kernel - -o - \
24+
$* -m64 -S -x c -O2 -p -mprofile-kernel - -o - \
2425
2> /dev/null | grep -q "_mcount" && \
2526
exit 1
2627

0 commit comments

Comments
 (0)