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