1 # SPDX-License-Identifier: GPL-2.0-only
3 # Makefile for the RISC-V Linux kernel
7 CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
8 CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE)
9 CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE)
11 CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,)
12 CFLAGS_compat_syscall_table.o += $(call cc-option,-Wno-override-init,)
15 AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax)
18 # cmodel=medany and notrace when patching early
19 ifdef CONFIG_RISCV_ALTERNATIVE_EARLY
20 CFLAGS_alternative.o := -mcmodel=medany
21 CFLAGS_cpufeature.o := -mcmodel=medany
23 CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE)
24 CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE)
27 KASAN_SANITIZE_alternative.o := n
28 KASAN_SANITIZE_cpufeature.o := n
32 extra-y += vmlinux.lds
36 obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o
46 obj-y += syscall_table.o
50 obj-y += riscv_ksyms.o
55 obj-$(CONFIG_MMU) += vdso.o vdso/
57 obj-$(CONFIG_RISCV_M_MODE) += traps_misaligned.o
58 obj-$(CONFIG_FPU) += fpu.o
59 obj-$(CONFIG_RISCV_ISA_V) += vector.o
60 obj-$(CONFIG_SMP) += smpboot.o
61 obj-$(CONFIG_SMP) += smp.o
62 obj-$(CONFIG_SMP) += cpu_ops.o
64 obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o
65 obj-$(CONFIG_MODULES) += module.o
66 obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
68 obj-$(CONFIG_CPU_PM) += suspend_entry.o suspend.o
69 obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o
71 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
72 obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
74 obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
75 obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
76 obj-$(CONFIG_RISCV_SBI) += sbi.o
77 ifeq ($(CONFIG_RISCV_SBI), y)
78 obj-$(CONFIG_SMP) += sbi-ipi.o
79 obj-$(CONFIG_SMP) += cpu_ops_sbi.o
81 obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug.o
82 obj-$(CONFIG_KGDB) += kgdb.o
83 obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o
84 obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o
85 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
86 obj-$(CONFIG_CRASH_CORE) += crash_core.o
88 obj-$(CONFIG_JUMP_LABEL) += jump_label.o
90 obj-$(CONFIG_EFI) += efi.o
91 obj-$(CONFIG_COMPAT) += compat_syscall_table.o
92 obj-$(CONFIG_COMPAT) += compat_signal.o
93 obj-$(CONFIG_COMPAT) += compat_vdso/
95 obj-$(CONFIG_64BIT) += pi/