1# SPDX-License-Identifier: GPL-2.0-only 2# 3# Makefile for the RISC-V Linux kernel 4# 5 6ifdef CONFIG_FTRACE 7CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) 8CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) 9CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) 10endif 11CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,) 12 13ifdef CONFIG_KEXEC 14AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax) 15endif 16 17# cmodel=medany and notrace when patching early 18ifdef CONFIG_RISCV_ALTERNATIVE_EARLY 19CFLAGS_alternative.o := -mcmodel=medany 20CFLAGS_cpufeature.o := -mcmodel=medany 21ifdef CONFIG_FTRACE 22CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE) 23CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE) 24endif 25ifdef CONFIG_KASAN 26KASAN_SANITIZE_alternative.o := n 27KASAN_SANITIZE_cpufeature.o := n 28endif 29endif 30 31extra-y += vmlinux.lds 32 33obj-y += head.o 34obj-y += soc.o 35obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o 36obj-y += cpu.o 37obj-y += cpufeature.o 38obj-y += entry.o 39obj-y += irq.o 40obj-y += process.o 41obj-y += ptrace.o 42obj-y += reset.o 43obj-y += setup.o 44obj-y += signal.o 45obj-y += syscall_table.o 46obj-y += sys_riscv.o 47obj-y += time.o 48obj-y += traps.o 49obj-y += riscv_ksyms.o 50obj-y += stacktrace.o 51obj-y += cacheinfo.o 52obj-y += patch.o 53obj-y += probes/ 54obj-$(CONFIG_MMU) += vdso.o vdso/ 55 56obj-$(CONFIG_RISCV_M_MODE) += traps_misaligned.o 57obj-$(CONFIG_FPU) += fpu.o 58obj-$(CONFIG_SMP) += smpboot.o 59obj-$(CONFIG_SMP) += smp.o 60obj-$(CONFIG_SMP) += cpu_ops.o 61 62obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o 63obj-$(CONFIG_MODULES) += module.o 64obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o 65 66obj-$(CONFIG_CPU_PM) += suspend_entry.o suspend.o 67 68obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 69obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o 70 71obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o 72 73obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o 74obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o 75obj-$(CONFIG_RISCV_SBI) += sbi.o 76ifeq ($(CONFIG_RISCV_SBI), y) 77obj-$(CONFIG_SMP) += cpu_ops_sbi.o 78endif 79obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug.o 80obj-$(CONFIG_KGDB) += kgdb.o 81obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o 82obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o 83obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 84 85obj-$(CONFIG_JUMP_LABEL) += jump_label.o 86 87obj-$(CONFIG_EFI) += efi.o 88obj-$(CONFIG_COMPAT) += compat_syscall_table.o 89obj-$(CONFIG_COMPAT) += compat_signal.o 90obj-$(CONFIG_COMPAT) += compat_vdso/ 91