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