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 23CFLAGS_sbi_ecall.o := -mcmodel=medany 24ifdef CONFIG_FTRACE 25CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE) 26CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE) 27CFLAGS_REMOVE_sbi_ecall.o = $(CC_FLAGS_FTRACE) 28endif 29ifdef CONFIG_RELOCATABLE 30CFLAGS_alternative.o += -fno-pie 31CFLAGS_cpufeature.o += -fno-pie 32CFLAGS_sbi_ecall.o += -fno-pie 33endif 34ifdef CONFIG_KASAN 35KASAN_SANITIZE_alternative.o := n 36KASAN_SANITIZE_cpufeature.o := n 37KASAN_SANITIZE_sbi_ecall.o := n 38endif 39ifdef CONFIG_FORTIFY_SOURCE 40CFLAGS_alternative.o += -D__NO_FORTIFY 41CFLAGS_cpufeature.o += -D__NO_FORTIFY 42CFLAGS_sbi_ecall.o += -D__NO_FORTIFY 43endif 44endif 45 46extra-y += vmlinux.lds 47 48obj-y += head.o 49obj-y += soc.o 50obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o 51obj-y += cpu.o 52obj-y += cpufeature.o 53obj-y += entry.o 54obj-y += irq.o 55obj-y += process.o 56obj-y += ptrace.o 57obj-y += reset.o 58obj-y += return_address.o 59obj-y += setup.o 60obj-y += signal.o 61obj-y += syscall_table.o 62obj-y += sys_riscv.o 63obj-y += sys_hwprobe.o 64obj-y += time.o 65obj-y += traps.o 66obj-y += riscv_ksyms.o 67obj-y += stacktrace.o 68obj-y += cacheinfo.o 69obj-y += patch.o 70obj-y += vendor_extensions.o 71obj-y += vendor_extensions/ 72obj-y += probes/ 73obj-y += tests/ 74obj-$(CONFIG_MMU) += vdso.o vdso/ 75 76obj-$(CONFIG_RISCV_MISALIGNED) += traps_misaligned.o 77obj-$(CONFIG_RISCV_MISALIGNED) += unaligned_access_speed.o 78obj-$(CONFIG_RISCV_PROBE_UNALIGNED_ACCESS) += copy-unaligned.o 79 80obj-$(CONFIG_FPU) += fpu.o 81obj-$(CONFIG_FPU) += kernel_mode_fpu.o 82obj-$(CONFIG_RISCV_ISA_V) += vector.o 83obj-$(CONFIG_RISCV_ISA_V) += kernel_mode_vector.o 84obj-$(CONFIG_SMP) += smpboot.o 85obj-$(CONFIG_SMP) += smp.o 86obj-$(CONFIG_SMP) += cpu_ops.o 87 88obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_spinwait.o 89obj-$(CONFIG_MODULES) += module.o 90obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o 91 92obj-$(CONFIG_CPU_PM) += suspend_entry.o suspend.o 93obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate-asm.o 94 95obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o 96obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o 97 98obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o 99obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o 100obj-$(CONFIG_RISCV_SBI) += sbi.o sbi_ecall.o 101ifeq ($(CONFIG_RISCV_SBI), y) 102obj-$(CONFIG_SMP) += sbi-ipi.o 103obj-$(CONFIG_SMP) += cpu_ops_sbi.o 104endif 105obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug.o 106obj-$(CONFIG_PARAVIRT) += paravirt.o 107obj-$(CONFIG_KGDB) += kgdb.o 108obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o 109obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o 110obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 111obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o 112 113obj-$(CONFIG_JUMP_LABEL) += jump_label.o 114 115obj-$(CONFIG_CFI_CLANG) += cfi.o 116 117obj-$(CONFIG_EFI) += efi.o 118obj-$(CONFIG_COMPAT) += compat_syscall_table.o 119obj-$(CONFIG_COMPAT) += compat_signal.o 120obj-$(CONFIG_COMPAT) += compat_vdso/ 121 122obj-$(CONFIG_64BIT) += pi/ 123obj-$(CONFIG_ACPI) += acpi.o 124obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o 125