xref: /linux/arch/riscv/kernel/Makefile (revision c1668520c9aa4019738f27097b187a5460646cbc)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2fbe934d6SPalmer Dabbelt#
3fbe934d6SPalmer Dabbelt# Makefile for the RISC-V Linux kernel
4fbe934d6SPalmer Dabbelt#
5fbe934d6SPalmer Dabbelt
610626c32SAlan Kaoifdef CONFIG_FTRACE
767d94577SGuo RenCFLAGS_REMOVE_ftrace.o	= $(CC_FLAGS_FTRACE)
867d94577SGuo RenCFLAGS_REMOVE_patch.o	= $(CC_FLAGS_FTRACE)
95ad84adfSGuo RenCFLAGS_REMOVE_sbi.o	= $(CC_FLAGS_FTRACE)
1068034138SZong LiCFLAGS_REMOVE_return_address.o	= $(CC_FLAGS_FTRACE)
1110626c32SAlan Kaoendif
12a6a58ecfSNanyong SunCFLAGS_syscall_table.o	+= $(call cc-option,-Wno-override-init,)
13f9c4bbddSGuo RenCFLAGS_compat_syscall_table.o += $(call cc-option,-Wno-override-init,)
1410626c32SAlan Kao
15d53a154cSBaoquan Heifdef CONFIG_KEXEC_CORE
16030d6dbfSChangbin DuAFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax)
17fba8a867SNick Kossifidisendif
18fba8a867SNick Kossifidis
19a35707c3SHeiko Stuebner# cmodel=medany and notrace when patching early
20a35707c3SHeiko Stuebnerifdef CONFIG_RISCV_ALTERNATIVE_EARLY
21a35707c3SHeiko StuebnerCFLAGS_alternative.o := -mcmodel=medany
22a35707c3SHeiko StuebnerCFLAGS_cpufeature.o := -mcmodel=medany
231ff95eb2SAlexandre GhitiCFLAGS_sbi_ecall.o := -mcmodel=medany
24a35707c3SHeiko Stuebnerifdef CONFIG_FTRACE
25a35707c3SHeiko StuebnerCFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE)
26a35707c3SHeiko StuebnerCFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE)
271ff95eb2SAlexandre GhitiCFLAGS_REMOVE_sbi_ecall.o = $(CC_FLAGS_FTRACE)
28a35707c3SHeiko Stuebnerendif
298dc2a7e8SAlexandre Ghitiifdef CONFIG_RELOCATABLE
308dc2a7e8SAlexandre GhitiCFLAGS_alternative.o += -fno-pie
318dc2a7e8SAlexandre GhitiCFLAGS_cpufeature.o += -fno-pie
321ff95eb2SAlexandre GhitiCFLAGS_sbi_ecall.o += -fno-pie
338dc2a7e8SAlexandre Ghitiendif
34a35707c3SHeiko Stuebnerifdef CONFIG_KASAN
35a35707c3SHeiko StuebnerKASAN_SANITIZE_alternative.o := n
36a35707c3SHeiko StuebnerKASAN_SANITIZE_cpufeature.o := n
371ff95eb2SAlexandre GhitiKASAN_SANITIZE_sbi_ecall.o := n
38a35707c3SHeiko Stuebnerendif
39afedc312SAlexandre Ghitiifdef CONFIG_FORTIFY_SOURCE
40afedc312SAlexandre GhitiCFLAGS_alternative.o += -D__NO_FORTIFY
41afedc312SAlexandre GhitiCFLAGS_cpufeature.o += -D__NO_FORTIFY
42afedc312SAlexandre GhitiCFLAGS_sbi_ecall.o += -D__NO_FORTIFY
43afedc312SAlexandre Ghitiendif
44a35707c3SHeiko Stuebnerendif
45a35707c3SHeiko Stuebner
46fbe934d6SPalmer Dabbeltextra-y += vmlinux.lds
47fbe934d6SPalmer Dabbelt
4832164845SMasahiro Yamadaobj-y	+= head.o
49335b1390SDamien Le Moalobj-y	+= soc.o
50e64f737aSHeiko Stuebnerobj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o
51fbe934d6SPalmer Dabbeltobj-y	+= cpu.o
52fbe934d6SPalmer Dabbeltobj-y	+= cpufeature.o
53fbe934d6SPalmer Dabbeltobj-y	+= entry.o
54fbe934d6SPalmer Dabbeltobj-y	+= irq.o
55fbe934d6SPalmer Dabbeltobj-y	+= process.o
56fbe934d6SPalmer Dabbeltobj-y	+= ptrace.o
57fbe934d6SPalmer Dabbeltobj-y	+= reset.o
5868034138SZong Liobj-y	+= return_address.o
59fbe934d6SPalmer Dabbeltobj-y	+= setup.o
60fbe934d6SPalmer Dabbeltobj-y	+= signal.o
61fbe934d6SPalmer Dabbeltobj-y	+= syscall_table.o
62fbe934d6SPalmer Dabbeltobj-y	+= sys_riscv.o
6353b2b228SAndrew Jonesobj-y	+= sys_hwprobe.o
64fbe934d6SPalmer Dabbeltobj-y	+= time.o
65fbe934d6SPalmer Dabbeltobj-y	+= traps.o
66fbe934d6SPalmer Dabbeltobj-y	+= riscv_ksyms.o
67fbe934d6SPalmer Dabbeltobj-y	+= stacktrace.o
68fbe934d6SPalmer Dabbeltobj-y	+= cacheinfo.o
69043cb41aSZong Liobj-y	+= patch.o
7023c996fcSCharlie Jenkinsobj-y	+= vendor_extensions.o
7123c996fcSCharlie Jenkinsobj-y	+= vendor_extensions/
72c22b0bcbSGuo Renobj-y	+= probes/
73af71bc19SCharlie Jenkinsobj-y	+= tests/
746bd33e1eSChristoph Hellwigobj-$(CONFIG_MMU) += vdso.o vdso/
75fbe934d6SPalmer Dabbelt
767c832321SClément Légerobj-$(CONFIG_RISCV_MISALIGNED)	+= traps_misaligned.o
77f413aae9SCharlie Jenkinsobj-$(CONFIG_RISCV_MISALIGNED)	+= unaligned_access_speed.o
78f413aae9SCharlie Jenkinsobj-$(CONFIG_RISCV_PROBE_UNALIGNED_ACCESS)		+= copy-unaligned.o
79*e7c9d66eSJesse Taubeobj-$(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)	+= vec-copy-unaligned.o
80f413aae9SCharlie Jenkins
819671f706SAlan Kaoobj-$(CONFIG_FPU)		+= fpu.o
8277acc6b5SSamuel Hollandobj-$(CONFIG_FPU)		+= kernel_mode_fpu.o
837017858eSGreentime Huobj-$(CONFIG_RISCV_ISA_V)	+= vector.o
84ecd2ada8SGreentime Huobj-$(CONFIG_RISCV_ISA_V)	+= kernel_mode_vector.o
85fbe934d6SPalmer Dabbeltobj-$(CONFIG_SMP)		+= smpboot.o
86fbe934d6SPalmer Dabbeltobj-$(CONFIG_SMP)		+= smp.o
872875fe05SAtish Patraobj-$(CONFIG_SMP)		+= cpu_ops.o
882ffc48fcSAtish Patra
892ffc48fcSAtish Patraobj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o
90fbe934d6SPalmer Dabbeltobj-$(CONFIG_MODULES)		+= module.o
91ab1ef68eSZong Liobj-$(CONFIG_MODULE_SECTIONS)	+= module-sections.o
92c15ac4fdSAlan Kao
9363b13e64SAnup Patelobj-$(CONFIG_CPU_PM)		+= suspend_entry.o suspend.o
94c0317210SSia Jee Hengobj-$(CONFIG_HIBERNATION)	+= hibernate.o hibernate-asm.o
9563b13e64SAnup Patel
96c15ac4fdSAlan Kaoobj-$(CONFIG_FUNCTION_TRACER)	+= mcount.o ftrace.o
97c15ac4fdSAlan Kaoobj-$(CONFIG_DYNAMIC_FTRACE)	+= mcount-dyn.o
98fbe934d6SPalmer Dabbelt
99dbeb90b0SMao Hanobj-$(CONFIG_PERF_EVENTS)	+= perf_callchain.o
10098a93b0bSMao Hanobj-$(CONFIG_HAVE_PERF_REGS)	+= perf_regs.o
1011ff95eb2SAlexandre Ghitiobj-$(CONFIG_RISCV_SBI)		+= sbi.o sbi_ecall.o
102cfafe260SAtish Patraifeq ($(CONFIG_RISCV_SBI), y)
103832f15f4SAnup Patelobj-$(CONFIG_SMP)		+= sbi-ipi.o
104cfafe260SAtish Patraobj-$(CONFIG_SMP) += cpu_ops_sbi.o
105cfafe260SAtish Patraendif
106f1e58583SAtish Patraobj-$(CONFIG_HOTPLUG_CPU)	+= cpu-hotplug.o
107323925edSAndrew Jonesobj-$(CONFIG_PARAVIRT)		+= paravirt.o
108fe89bd2bSVincent Chenobj-$(CONFIG_KGDB)		+= kgdb.o
1093a66a087SLi Zhengyuobj-$(CONFIG_KEXEC_CORE)	+= kexec_relocate.o crash_save_regs.o machine_kexec.o
1106261586eSLiao Changobj-$(CONFIG_KEXEC_FILE)	+= elf_kexec.o machine_kexec_file.o
11156409750SNick Kossifidisobj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
112443cbaf9SBaoquan Heobj-$(CONFIG_VMCORE_INFO)	+= vmcore_info.o
113178e9fc4SAlan Kao
114ebc00ddeSEmil Renner Berthingobj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
115ebc00ddeSEmil Renner Berthing
116af0ead42SSami Tolvanenobj-$(CONFIG_CFI_CLANG)		+= cfi.o
117af0ead42SSami Tolvanen
118b91540d5SAtish Patraobj-$(CONFIG_EFI)		+= efi.o
11959c10c52SGuo Renobj-$(CONFIG_COMPAT)		+= compat_syscall_table.o
1207383ee05SGuo Renobj-$(CONFIG_COMPAT)		+= compat_signal.o
1210715372aSGuo Renobj-$(CONFIG_COMPAT)		+= compat_vdso/
12226e7aacbSAlexandre Ghiti
12326e7aacbSAlexandre Ghitiobj-$(CONFIG_64BIT)		+= pi/
124a91a9ffbSSunil V Lobj-$(CONFIG_ACPI)		+= acpi.o
125eabd9db6SHaibo Xuobj-$(CONFIG_ACPI_NUMA)	+= acpi_numa.o
126