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