xref: /linux/arch/riscv/kernel/Makefile (revision 3652117f854819a148ff0fbe4492587d3520b5e5)
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,)
12CFLAGS_compat_syscall_table.o += $(call cc-option,-Wno-override-init,)
13
14ifdef CONFIG_KEXEC
15AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax)
16endif
17
18# cmodel=medany and notrace when patching early
19ifdef CONFIG_RISCV_ALTERNATIVE_EARLY
20CFLAGS_alternative.o := -mcmodel=medany
21CFLAGS_cpufeature.o := -mcmodel=medany
22ifdef CONFIG_FTRACE
23CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE)
24CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE)
25endif
26ifdef CONFIG_RELOCATABLE
27CFLAGS_alternative.o += -fno-pie
28CFLAGS_cpufeature.o += -fno-pie
29endif
30ifdef CONFIG_KASAN
31KASAN_SANITIZE_alternative.o := n
32KASAN_SANITIZE_cpufeature.o := n
33endif
34endif
35
36extra-y += vmlinux.lds
37
38obj-y	+= head.o
39obj-y	+= soc.o
40obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o
41obj-y	+= copy-unaligned.o
42obj-y	+= cpu.o
43obj-y	+= cpufeature.o
44obj-y	+= entry.o
45obj-y	+= irq.o
46obj-y	+= process.o
47obj-y	+= ptrace.o
48obj-y	+= reset.o
49obj-y	+= setup.o
50obj-y	+= signal.o
51obj-y	+= syscall_table.o
52obj-y	+= sys_riscv.o
53obj-y	+= time.o
54obj-y	+= traps.o
55obj-y	+= riscv_ksyms.o
56obj-y	+= stacktrace.o
57obj-y	+= cacheinfo.o
58obj-y	+= patch.o
59obj-y	+= probes/
60obj-y	+= tests/
61obj-$(CONFIG_MMU) += vdso.o vdso/
62
63obj-$(CONFIG_RISCV_MISALIGNED)	+= traps_misaligned.o
64obj-$(CONFIG_FPU)		+= fpu.o
65obj-$(CONFIG_RISCV_ISA_V)	+= vector.o
66obj-$(CONFIG_SMP)		+= smpboot.o
67obj-$(CONFIG_SMP)		+= smp.o
68obj-$(CONFIG_SMP)		+= cpu_ops.o
69
70obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o
71obj-$(CONFIG_MODULES)		+= module.o
72obj-$(CONFIG_MODULE_SECTIONS)	+= module-sections.o
73
74obj-$(CONFIG_CPU_PM)		+= suspend_entry.o suspend.o
75obj-$(CONFIG_HIBERNATION)	+= hibernate.o hibernate-asm.o
76
77obj-$(CONFIG_FUNCTION_TRACER)	+= mcount.o ftrace.o
78obj-$(CONFIG_DYNAMIC_FTRACE)	+= mcount-dyn.o
79
80obj-$(CONFIG_PERF_EVENTS)	+= perf_callchain.o
81obj-$(CONFIG_HAVE_PERF_REGS)	+= perf_regs.o
82obj-$(CONFIG_RISCV_SBI)		+= sbi.o
83ifeq ($(CONFIG_RISCV_SBI), y)
84obj-$(CONFIG_SMP)		+= sbi-ipi.o
85obj-$(CONFIG_SMP) += cpu_ops_sbi.o
86endif
87obj-$(CONFIG_HOTPLUG_CPU)	+= cpu-hotplug.o
88obj-$(CONFIG_KGDB)		+= kgdb.o
89obj-$(CONFIG_KEXEC_CORE)	+= kexec_relocate.o crash_save_regs.o machine_kexec.o
90obj-$(CONFIG_KEXEC_FILE)	+= elf_kexec.o machine_kexec_file.o
91obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
92obj-$(CONFIG_CRASH_CORE)	+= crash_core.o
93
94obj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
95
96obj-$(CONFIG_CFI_CLANG)		+= cfi.o
97
98obj-$(CONFIG_EFI)		+= efi.o
99obj-$(CONFIG_COMPAT)		+= compat_syscall_table.o
100obj-$(CONFIG_COMPAT)		+= compat_signal.o
101obj-$(CONFIG_COMPAT)		+= compat_vdso/
102
103obj-$(CONFIG_64BIT)		+= pi/
104obj-$(CONFIG_ACPI)		+= acpi.o
105