1# SPDX-License-Identifier: GPL-2.0 2# 3# Makefile for the linux kernel. 4# 5 6ifdef CONFIG_PPC64 7CFLAGS_prom_init.o += $(NO_MINIMAL_TOC) 8endif 9ifdef CONFIG_PPC32 10CFLAGS_prom_init.o += -fPIC 11CFLAGS_btext.o += -fPIC 12endif 13 14CFLAGS_early_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 15CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 16CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 17CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 18CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 19 20CFLAGS_prom_init.o += -fno-stack-protector 21CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING 22CFLAGS_prom_init.o += -ffreestanding 23 24ifdef CONFIG_FUNCTION_TRACER 25# Do not trace early boot code 26CFLAGS_REMOVE_cputable.o = $(CC_FLAGS_FTRACE) 27CFLAGS_REMOVE_prom_init.o = $(CC_FLAGS_FTRACE) 28CFLAGS_REMOVE_btext.o = $(CC_FLAGS_FTRACE) 29CFLAGS_REMOVE_prom.o = $(CC_FLAGS_FTRACE) 30endif 31 32KASAN_SANITIZE_early_32.o := n 33KASAN_SANITIZE_cputable.o := n 34KASAN_SANITIZE_prom_init.o := n 35KASAN_SANITIZE_btext.o := n 36KASAN_SANITIZE_paca.o := n 37KASAN_SANITIZE_setup_64.o := n 38KASAN_SANITIZE_mce.o := n 39KASAN_SANITIZE_mce_power.o := n 40 41# we have to be particularly careful in ppc64 to exclude code that 42# runs with translations off, as we cannot access the shadow with 43# translations off. However, ppc32 can sanitize this. 44ifdef CONFIG_PPC64 45KASAN_SANITIZE_traps.o := n 46endif 47 48ifdef CONFIG_KASAN 49CFLAGS_early_32.o += -DDISABLE_BRANCH_PROFILING 50CFLAGS_cputable.o += -DDISABLE_BRANCH_PROFILING 51CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING 52endif 53 54obj-y := cputable.o syscalls.o \ 55 irq.o align.o signal_$(BITS).o pmc.o vdso.o \ 56 process.o systbl.o idle.o \ 57 signal.o sysfs.o cacheinfo.o time.o \ 58 prom.o traps.o setup-common.o \ 59 udbg.o misc.o io.o misc_$(BITS).o \ 60 of_platform.o prom_parse.o firmware.o \ 61 hw_breakpoint_constraints.o interrupt.o \ 62 kdebugfs.o stacktrace.o 63obj-y += ptrace/ 64obj-$(CONFIG_PPC64) += setup_64.o \ 65 paca.o nvram_64.o note.o 66obj-$(CONFIG_COMPAT) += sys_ppc32.o signal_32.o 67obj-$(CONFIG_VDSO32) += vdso32_wrapper.o 68obj-$(CONFIG_PPC_WATCHDOG) += watchdog.o 69obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 70obj-$(CONFIG_PPC_DAWR) += dawr.o 71obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o 72obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o 73obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o 74obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o 75obj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o 76obj-$(CONFIG_PPC64) += vdso64_wrapper.o 77obj-$(CONFIG_ALTIVEC) += vecemu.o 78obj-$(CONFIG_PPC_BOOK3S_IDLE) += idle_book3s.o 79procfs-y := proc_powerpc.o 80obj-$(CONFIG_PROC_FS) += $(procfs-y) 81rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o 82obj-$(CONFIG_PPC_RTAS) += rtas_entry.o rtas.o rtas-rtc.o $(rtaspci-y-y) 83obj-$(CONFIG_PPC_RTAS_DAEMON) += rtasd.o 84obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o 85obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 86obj-$(CONFIG_PPC_DT_CPU_FTRS) += dt_cpu_ftrs.o 87obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_cache.o \ 88 eeh_driver.o eeh_event.o eeh_sysfs.o 89obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o 90obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 91obj-$(CONFIG_FA_DUMP) += fadump.o 92obj-$(CONFIG_PRESERVE_FA_DUMP) += fadump.o 93ifdef CONFIG_PPC32 94obj-$(CONFIG_E500) += idle_e500.o 95endif 96obj-$(CONFIG_PPC_BOOK3S_32) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o 97obj-$(CONFIG_TAU) += tau_6xx.o 98obj-$(CONFIG_HIBERNATION) += swsusp.o suspend.o 99ifdef CONFIG_FSL_BOOKE 100obj-$(CONFIG_HIBERNATION) += swsusp_booke.o 101else 102obj-$(CONFIG_HIBERNATION) += swsusp_$(BITS).o 103endif 104obj64-$(CONFIG_HIBERNATION) += swsusp_asm64.o 105obj-$(CONFIG_MODULES) += module.o module_$(BITS).o 106obj-$(CONFIG_44x) += cpu_setup_44x.o 107obj-$(CONFIG_PPC_FSL_BOOK3E) += cpu_setup_fsl_booke.o 108obj-$(CONFIG_PPC_DOORBELL) += dbell.o 109obj-$(CONFIG_JUMP_LABEL) += jump_label.o 110 111extra-$(CONFIG_PPC64) := head_64.o 112extra-$(CONFIG_PPC_BOOK3S_32) := head_book3s_32.o 113extra-$(CONFIG_40x) := head_40x.o 114extra-$(CONFIG_44x) := head_44x.o 115extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o 116extra-$(CONFIG_PPC_8xx) := head_8xx.o 117extra-y += vmlinux.lds 118 119obj-$(CONFIG_RELOCATABLE) += reloc_$(BITS).o 120 121obj-$(CONFIG_PPC32) += entry_32.o setup_32.o early_32.o static_call.o 122obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o 123obj-$(CONFIG_KGDB) += kgdb.o 124obj-$(CONFIG_BOOTX_TEXT) += btext.o 125obj-$(CONFIG_SMP) += smp.o 126obj-$(CONFIG_KPROBES) += kprobes.o 127obj-$(CONFIG_OPTPROBES) += optprobes.o optprobes_head.o 128obj-$(CONFIG_KPROBES_ON_FTRACE) += kprobes-ftrace.o 129obj-$(CONFIG_UPROBES) += uprobes.o 130obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 131obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 132obj-$(CONFIG_ARCH_HAS_DMA_SET_MASK) += dma-mask.o 133 134pci64-$(CONFIG_PPC64) += pci_dn.o pci-hotplug.o isa-bridge.o 135obj-$(CONFIG_PCI) += pci_$(BITS).o $(pci64-y) \ 136 pci-common.o pci_of_scan.o 137obj-$(CONFIG_PCI_MSI) += msi.o 138 139obj-$(CONFIG_AUDIT) += audit.o 140obj64-$(CONFIG_AUDIT) += compat_audit.o 141 142obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o 143 144obj-y += trace/ 145 146ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) 147obj-y += iomap.o 148endif 149 150obj64-$(CONFIG_PPC_TRANSACTIONAL_MEM) += tm.o 151 152obj-$(CONFIG_PPC64) += $(obj64-y) 153obj-$(CONFIG_PPC32) += $(obj32-y) 154 155ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC_CORE)(CONFIG_PPC_BOOK3S),) 156obj-y += ppc_save_regs.o 157endif 158 159obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o 160obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o 161ifneq ($(CONFIG_PPC_POWERNV)$(CONFIG_PPC_SVM),) 162obj-y += ucall.o 163endif 164 165obj-$(CONFIG_PPC_SECURE_BOOT) += secure_boot.o ima_arch.o secvar-ops.o 166obj-$(CONFIG_PPC_SECVAR_SYSFS) += secvar-sysfs.o 167 168# Disable GCOV, KCOV & sanitizers in odd or sensitive code 169GCOV_PROFILE_prom_init.o := n 170KCOV_INSTRUMENT_prom_init.o := n 171UBSAN_SANITIZE_prom_init.o := n 172GCOV_PROFILE_kprobes.o := n 173KCOV_INSTRUMENT_kprobes.o := n 174UBSAN_SANITIZE_kprobes.o := n 175GCOV_PROFILE_kprobes-ftrace.o := n 176KCOV_INSTRUMENT_kprobes-ftrace.o := n 177UBSAN_SANITIZE_kprobes-ftrace.o := n 178GCOV_PROFILE_syscall_64.o := n 179KCOV_INSTRUMENT_syscall_64.o := n 180UBSAN_SANITIZE_syscall_64.o := n 181UBSAN_SANITIZE_vdso.o := n 182 183# Necessary for booting with kcov enabled on book3e machines 184KCOV_INSTRUMENT_cputable.o := n 185KCOV_INSTRUMENT_setup_64.o := n 186KCOV_INSTRUMENT_paca.o := n 187 188CFLAGS_setup_64.o += -fno-stack-protector 189CFLAGS_paca.o += -fno-stack-protector 190 191extra-$(CONFIG_PPC_FPU) += fpu.o 192extra-$(CONFIG_ALTIVEC) += vector.o 193extra-$(CONFIG_PPC64) += entry_64.o 194extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o 195 196extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check 197 198quiet_cmd_prom_init_check = PROMCHK $@ 199 cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" $(obj)/prom_init.o; touch $@ 200 201$(obj)/prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o FORCE 202 $(call if_changed,prom_init_check) 203targets += prom_init_check 204 205clean-files := vmlinux.lds 206 207# Force dependency (incbin is bad) 208$(obj)/vdso32_wrapper.o : $(obj)/vdso/vdso32.so.dbg 209$(obj)/vdso64_wrapper.o : $(obj)/vdso/vdso64.so.dbg 210 211# for cleaning 212subdir- += vdso 213