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