public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.15.y] KVM: arm64: nvhe: Fix build with profile optimization
@ 2023-01-13  0:22 Stephen Boyd
  2023-01-14  9:48 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Boyd @ 2023-01-13  0:22 UTC (permalink / raw)
  To: stable; +Cc: Denis Nikitin, linux-kernel, patches, Marc Zyngier

From: Denis Nikitin <denik@chromium.org>

commit bde971a83bbff78561458ded236605a365411b87 upstream.

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 <denik@chromium.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221014184532.3153551-1-denik@chromium.org
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

I need this to properly compile 5.15.y stable kernels in the chromeos build
system.

 arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile
index 8d741f71377f..964c2134ea1e 100644
--- a/arch/arm64/kvm/hyp/nvhe/Makefile
+++ b/arch/arm64/kvm/hyp/nvhe/Makefile
@@ -83,6 +83,10 @@ quiet_cmd_hypcopy = HYPCOPY $@
 # Remove ftrace, Shadow Call Stack, and CFI CFLAGS.
 # This is equivalent to the 'notrace', '__noscs', and '__nocfi' annotations.
 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS) $(CC_FLAGS_CFI), $(KBUILD_CFLAGS))
+# Starting from 13.0.0 llvm emits SHT_REL section '.llvm.call-graph-profile'
+# when profile optimization is applied. gen-hyprel does not support SHT_REL and
+# causes a build failure. Remove profile optimization flags.
+KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%, $(KBUILD_CFLAGS))
 
 # KVM nVHE code is run at a different exception code with a different map, so
 # compiler instrumentation that inserts callbacks or checks into the code may
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5.15.y] KVM: arm64: nvhe: Fix build with profile optimization
  2023-01-13  0:22 [PATCH 5.15.y] KVM: arm64: nvhe: Fix build with profile optimization Stephen Boyd
@ 2023-01-14  9:48 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-01-14  9:48 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: stable, Denis Nikitin, linux-kernel, patches, Marc Zyngier

On Thu, Jan 12, 2023 at 04:22:10PM -0800, Stephen Boyd wrote:
> From: Denis Nikitin <denik@chromium.org>
> 
> commit bde971a83bbff78561458ded236605a365411b87 upstream.
> 
> 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 <denik@chromium.org>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Link: https://lore.kernel.org/r/20221014184532.3153551-1-denik@chromium.org
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
> 
> I need this to properly compile 5.15.y stable kernels in the chromeos build
> system.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-14  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-13  0:22 [PATCH 5.15.y] KVM: arm64: nvhe: Fix build with profile optimization Stephen Boyd
2023-01-14  9:48 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox