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