Makefile (c199a009fe0e84acf2d5b90bb265e72b672b0f9b) Makefile (bdbc0c7a070c0cbe3009cd271c6ec8d87d69cc7a)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for Kernel-based Virtual Machine module, HYP/nVHE part
4#
5
6asflags-y := -D__KVM_NVHE_HYPERVISOR__
7ccflags-y := -D__KVM_NVHE_HYPERVISOR__
8

--- 6 unchanged lines hidden (view full) ---

15
16$(obj)/%.hyp.tmp.o: $(src)/%.c FORCE
17 $(call if_changed_rule,cc_o_c)
18$(obj)/%.hyp.tmp.o: $(src)/%.S FORCE
19 $(call if_changed_rule,as_o_S)
20$(obj)/%.hyp.o: $(obj)/%.hyp.tmp.o FORCE
21 $(call if_changed,hypcopy)
22
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for Kernel-based Virtual Machine module, HYP/nVHE part
4#
5
6asflags-y := -D__KVM_NVHE_HYPERVISOR__
7ccflags-y := -D__KVM_NVHE_HYPERVISOR__
8

--- 6 unchanged lines hidden (view full) ---

15
16$(obj)/%.hyp.tmp.o: $(src)/%.c FORCE
17 $(call if_changed_rule,cc_o_c)
18$(obj)/%.hyp.tmp.o: $(src)/%.S FORCE
19 $(call if_changed_rule,as_o_S)
20$(obj)/%.hyp.o: $(obj)/%.hyp.tmp.o FORCE
21 $(call if_changed,hypcopy)
22
23# Disable reordering functions by GCC (enabled at -O2).
24# This pass puts functions into '.text.*' sections to aid the linker
25# in optimizing ELF layout. See HYPCOPY comment below for more info.
26ccflags-y += $(call cc-option,-fno-reorder-functions)
27
28# The HYPCOPY command uses `objcopy` to prefix all ELF symbol names
29# and relevant ELF section names to avoid clashes with VHE code/data.
30#
31# Hyp code is assumed to be in the '.text' section of the input object
32# files (with the exception of specialized sections such as
33# '.hyp.idmap.text'). This assumption may be broken by a compiler that
34# divides code into sections like '.text.unlikely' so as to optimize
35# ELF layout. HYPCOPY checks that no such sections exist in the input
36# using `objdump`, otherwise they would be linked together with other
37# kernel code and not memory-mapped correctly at runtime.
23quiet_cmd_hypcopy = HYPCOPY $@
38quiet_cmd_hypcopy = HYPCOPY $@
24 cmd_hypcopy = $(OBJCOPY) --prefix-symbols=__kvm_nvhe_ \
25 --rename-section=.text=.hyp.text \
26 $< $@
39 cmd_hypcopy = \
40 if $(OBJDUMP) -h $< | grep -F '.text.'; then \
41 echo "$@: function reordering not supported in nVHE hyp code" >&2; \
42 /bin/false; \
43 fi; \
44 $(OBJCOPY) --prefix-symbols=__kvm_nvhe_ \
45 --rename-section=.text=.hyp.text \
46 $< $@
27
28# Remove ftrace and Shadow Call Stack CFLAGS.
29# This is equivalent to the 'notrace' and '__noscs' annotations.
30KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
31
32# KVM nVHE code is run at a different exception code with a different map, so
33# compiler instrumentation that inserts callbacks or checks into the code may
34# cause crashes. Just disable it.
35GCOV_PROFILE := n
36KASAN_SANITIZE := n
37UBSAN_SANITIZE := n
38KCOV_INSTRUMENT := n
39
40# Skip objtool checking for this directory because nVHE code is compiled with
41# non-standard build rules.
42OBJECT_FILES_NON_STANDARD := y
47
48# Remove ftrace and Shadow Call Stack CFLAGS.
49# This is equivalent to the 'notrace' and '__noscs' annotations.
50KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
51
52# KVM nVHE code is run at a different exception code with a different map, so
53# compiler instrumentation that inserts callbacks or checks into the code may
54# cause crashes. Just disable it.
55GCOV_PROFILE := n
56KASAN_SANITIZE := n
57UBSAN_SANITIZE := n
58KCOV_INSTRUMENT := n
59
60# Skip objtool checking for this directory because nVHE code is compiled with
61# non-standard build rules.
62OBJECT_FILES_NON_STANDARD := y