Skip to content

Commit bde971a

Browse files
Denis NikitinMarc Zyngier
authored andcommitted
KVM: arm64: nvhe: Fix build with profile optimization
Kernel build with clang and KCFLAGS=-fprofile-sample-use=<profile> fails with: error: arch/arm64/kvm/hyp/nvhe/kvm_nvhe.tmp.o: Unexpected SHT_REL section ".rel.llvm.call-graph-profile" Starting from 13.0.0 llvm can generate SHT_REL section, see https://reviews.llvm.org/rGca3bdb57fa1ac98b711a735de048c12b5fdd8086. gen-hyprel does not support SHT_REL relocation section. Filter out profile use flags to fix the build with profile optimization. Signed-off-by: Denis Nikitin <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 05c2224 commit bde971a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/kvm/hyp/nvhe/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ quiet_cmd_hypcopy = HYPCOPY $@
9292
# Remove ftrace, Shadow Call Stack, and CFI CFLAGS.
9393
# This is equivalent to the 'notrace', '__noscs', and '__nocfi' annotations.
9494
KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_CFI), $(KBUILD_CFLAGS))
95+
# Starting from 13.0.0 llvm emits SHT_REL section '.llvm.call-graph-profile'
96+
# when profile optimization is applied. gen-hyprel does not support SHT_REL and
97+
# causes a build failure. Remove profile optimization flags.
98+
KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%, $(KBUILD_CFLAGS))
9599

96100
# KVM nVHE code is run at a different exception code with a different map, so
97101
# compiler instrumentation that inserts callbacks or checks into the code may

0 commit comments

Comments
 (0)