xref: /linux/arch/powerpc/kernel/Makefile (revision 3e7318584dfec11992f3ac45658c4bc1210b3778)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
214cf11afSPaul Mackerras#
314cf11afSPaul Mackerras# Makefile for the linux kernel.
414cf11afSPaul Mackerras#
514cf11afSPaul Mackerras
6badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64
71fbe9cf2SAnton BlanchardCFLAGS_prom_init.o	+= $(NO_MINIMAL_TOC)
8bd142b70SStephen Rothwellendif
9badf436fSRodrigo R. Galvaoifdef CONFIG_PPC32
109b6b563cSPaul MackerrasCFLAGS_prom_init.o      += -fPIC
11b3491269SPaul MackerrasCFLAGS_btext.o		+= -fPIC
12cabb5587SStephen Rothwellendif
139b6b563cSPaul Mackerras
14bba49665SChristophe LeroyCFLAGS_early_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
1538addce8SEmese RevfyCFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
16eac6f8b0SAndrew DonnellanCFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
1738addce8SEmese RevfyCFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
1838addce8SEmese RevfyCFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
1938addce8SEmese Revfy
20893ab004SMasahiro YamadaCFLAGS_prom_init.o += -fno-stack-protector
216266a4daSMichael EllermanCFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING
228dcd71b4SNathan ChancellorCFLAGS_prom_init.o += -ffreestanding
23be640317SMichael EllermanCFLAGS_prom_init.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized)
24c3ff2a51SChristophe Leroy
25606576ceSSteven Rostedtifdef CONFIG_FUNCTION_TRACER
264e491d14SSteven Rostedt# Do not trace early boot code
272a056f58SNicholas PigginCFLAGS_REMOVE_cputable.o = $(CC_FLAGS_FTRACE)
282a056f58SNicholas PigginCFLAGS_REMOVE_prom_init.o = $(CC_FLAGS_FTRACE)
292a056f58SNicholas PigginCFLAGS_REMOVE_btext.o = $(CC_FLAGS_FTRACE)
302a056f58SNicholas PigginCFLAGS_REMOVE_prom.o = $(CC_FLAGS_FTRACE)
314e491d14SSteven Rostedtendif
324e491d14SSteven Rostedt
33f072015cSChristophe LeroyKASAN_SANITIZE_early_32.o := n
34f072015cSChristophe LeroyKASAN_SANITIZE_cputable.o := n
35f072015cSChristophe LeroyKASAN_SANITIZE_prom_init.o := n
36f072015cSChristophe LeroyKASAN_SANITIZE_btext.o := n
3741b7a347SDaniel AxtensKASAN_SANITIZE_paca.o := n
3841b7a347SDaniel AxtensKASAN_SANITIZE_setup_64.o := n
3941b7a347SDaniel AxtensKASAN_SANITIZE_mce.o := n
4041b7a347SDaniel AxtensKASAN_SANITIZE_mce_power.o := n
41743cdb7bSPaul MackerrasKASAN_SANITIZE_udbg.o := n
42743cdb7bSPaul MackerrasKASAN_SANITIZE_udbg_16550.o := n
4341b7a347SDaniel Axtens
4441b7a347SDaniel Axtens# we have to be particularly careful in ppc64 to exclude code that
4541b7a347SDaniel Axtens# runs with translations off, as we cannot access the shadow with
4641b7a347SDaniel Axtens# translations off. However, ppc32 can sanitize this.
4741b7a347SDaniel Axtensifdef CONFIG_PPC64
4841b7a347SDaniel AxtensKASAN_SANITIZE_traps.o := n
4941b7a347SDaniel Axtensendif
50f072015cSChristophe Leroy
51f072015cSChristophe Leroyifdef CONFIG_KASAN
52f072015cSChristophe LeroyCFLAGS_early_32.o += -DDISABLE_BRANCH_PROFILING
53f072015cSChristophe LeroyCFLAGS_cputable.o += -DDISABLE_BRANCH_PROFILING
54f072015cSChristophe LeroyCFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING
55f072015cSChristophe Leroyendif
56f072015cSChristophe Leroy
57f4a0318fSXiu Jianfeng#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
58f4a0318fSXiu Jianfeng# Remove stack protector to avoid triggering unneeded stack canary
59f4a0318fSXiu Jianfeng# checks due to randomize_kstack_offset.
60f4a0318fSXiu JianfengCFLAGS_REMOVE_syscall.o = -fstack-protector -fstack-protector-strong
61f4a0318fSXiu JianfengCFLAGS_syscall.o += -fno-stack-protector
62f4a0318fSXiu Jianfeng#endif
63f4a0318fSXiu Jianfeng
64da9a1c10SChristophe Leroyobj-y				:= cputable.o syscalls.o \
650a7601b6SMichal Suchanek				   irq.o align.o signal_$(BITS).o pmc.o vdso.o \
66b0ce50aaSThomas Gleixner				   process.o systbl.o idle.o \
67698193d8SMichael Ellerman				   signal.o sysfs.o cacheinfo.o time.o \
68698193d8SMichael Ellerman				   prom.o traps.o setup-common.o \
6968005b67SChristoph Hellwig				   udbg.o misc.o io.o misc_$(BITS).o \
70edc8dd99SRavi Bangoria				   of_platform.o prom_parse.o firmware.o \
71dbf77fedSAneesh Kumar K.V				   hw_breakpoint_constraints.o interrupt.o \
721547db7dSXiu Jianfeng				   kdebugfs.o stacktrace.o syscall.o
73da9a1c10SChristophe Leroyobj-y				+= ptrace/
747d7b28b3SChristophe Leroyobj-$(CONFIG_PPC64)		+= setup_64.o irq_64.o\
75344bb20bSChristophe Leroy				   paca.o nvram_64.o note.o
760a7601b6SMichal Suchanekobj-$(CONFIG_COMPAT)		+= sys_ppc32.o signal_32.o
77bce74491SMasahiro Yamadaobj-$(CONFIG_VDSO32)		+= vdso32_wrapper.o
7875eb767eSNicholas Pigginobj-$(CONFIG_PPC_WATCHDOG)	+= watchdog.o
795aae8a53SK.Prasadobj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
80a278e7eaSMichael Neulingobj-$(CONFIG_PPC_DAWR)		+= dawr.o
812d27cfd3SBenjamin Herrenschmidtobj-$(CONFIG_PPC_BOOK3S_64)	+= cpu_setup_ppc970.o cpu_setup_pa6t.o
82179ab1cbSMichael Ellermanobj-$(CONFIG_PPC_BOOK3S_64)	+= cpu_setup_power.o
837c379526SPaolo Bonziniobj-$(CONFIG_PPC_BOOK3S_64)	+= mce.o mce_power.o
8434d97e07SBenjamin Herrenschmidtobj-$(CONFIG_PPC_BOOK3E_64)	+= exceptions-64e.o idle_book3e.o
85179ab1cbSMichael Ellermanobj-$(CONFIG_PPC_BARRIER_NOSPEC) += security.o
86bce74491SMasahiro Yamadaobj-$(CONFIG_PPC64)		+= vdso64_wrapper.o
87e821ea70SBenjamin Herrenschmidtobj-$(CONFIG_ALTIVEC)		+= vecemu.o
88ed0bc98fSNicholas Pigginobj-$(CONFIG_PPC_BOOK3S_IDLE)	+= idle_book3s.o
89188917e1SBenjamin Herrenschmidtprocfs-y			:= proc_powerpc.o
90d3d2176aSDavid Gibsonobj-$(CONFIG_PROC_FS)		+= $(procfs-y)
91bed59275SStephen Rothwellrtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI)	:= rtas_pci.o
92838ee286SNicholas Pigginobj-$(CONFIG_PPC_RTAS)		+= rtas_entry.o rtas.o rtas-rtc.o $(rtaspci-y-y)
933d541c4bSBenjamin Herrenschmidtobj-$(CONFIG_PPC_RTAS_DAEMON)	+= rtasd.o
94f4fcbbe9SPaul Mackerrasobj-$(CONFIG_RTAS_FLASH)	+= rtas_flash.o
95f4fcbbe9SPaul Mackerrasobj-$(CONFIG_RTAS_PROC)		+= rtas-proc.o
965a61ef74SNicholas Pigginobj-$(CONFIG_PPC_DT_CPU_FTRS)	+= dt_cpu_ftrs.o
97d74ee8e9SOliver O'Halloranobj-$(CONFIG_EEH)              += eeh.o eeh_pe.o eeh_cache.o \
98317f06deSGavin Shan				  eeh_driver.o eeh_event.o eeh_sysfs.o
998ad200d7SPaul Mackerrasobj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsync.o
1000cc4746cSMichael Ellermanobj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
101cd1d55f1SHari Bathiniobj-$(CONFIG_FA_DUMP)		+= fadump.o
102cd1d55f1SHari Bathiniobj-$(CONFIG_PRESERVE_FA_DUMP)	+= fadump.o
103badf436fSRodrigo R. Galvaoifdef CONFIG_PPC32
104688de017SChristophe Leroyobj-$(CONFIG_PPC_E500)		+= idle_e500.o
1054490c06bSKumar Galaendif
106d7cceda9SChristophe Leroyobj-$(CONFIG_PPC_BOOK3S_32)	+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
1079b781727SPaul Mackerrasobj-$(CONFIG_TAU)		+= tau_6xx.o
10890103f93SAnton Vorontsovobj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o
109dfc3095cSChristophe Leroyifdef CONFIG_PPC_85xx
110dfc3095cSChristophe Leroyobj-$(CONFIG_HIBERNATION)	+= swsusp_85xx.o
11190103f93SAnton Vorontsovelse
11268201fbbSMichael Ellermanobj-$(CONFIG_HIBERNATION)	+= swsusp_$(BITS).o
11390103f93SAnton Vorontsovendif
1142578bfaeSStephen Rothwellobj64-$(CONFIG_HIBERNATION)	+= swsusp_asm64.o
11568201fbbSMichael Ellermanobj-$(CONFIG_MODULES)		+= module.o module_$(BITS).o
11626f571d7SPaul Mackerrasobj-$(CONFIG_44x)		+= cpu_setup_44x.o
117*3e731858SChristophe Leroyobj-$(CONFIG_PPC_E500)		+= cpu_setup_e500.o
118440bc685SIan Munsieobj-$(CONFIG_PPC_DOORBELL)	+= dbell.o
119ac5f89c7SMichael Ellermanobj-$(CONFIG_JUMP_LABEL)	+= jump_label.o
12040ef8cbcSPaul Mackerras
121533090e5SChristophe Leroyextra-$(CONFIG_PPC64)		:= head_64.o
122533090e5SChristophe Leroyextra-$(CONFIG_PPC_BOOK3S_32)	:= head_book3s_32.o
12315f6527eSJosh Boyerextra-$(CONFIG_40x)		:= head_40x.o
12414cf11afSPaul Mackerrasextra-$(CONFIG_44x)		:= head_44x.o
125dfc3095cSChristophe Leroyextra-$(CONFIG_PPC_85xx)	:= head_85xx.o
126968159c0SChristophe Leroyextra-$(CONFIG_PPC_8xx)		:= head_8xx.o
12714cf11afSPaul Mackerrasextra-y				+= vmlinux.lds
12814cf11afSPaul Mackerras
12968201fbbSMichael Ellermanobj-$(CONFIG_RELOCATABLE)	+= reloc_$(BITS).o
1309c5f7d39SSuzuki Poulose
1315c810cedSChristophe Leroyobj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o early_32.o static_call.o
1324fc665b8SBecky Bruceobj-$(CONFIG_PPC64)		+= dma-iommu.o iommu.o
13317ce452fSJason Wesselobj-$(CONFIG_KGDB)		+= kgdb.o
1349b6b563cSPaul Mackerrasobj-$(CONFIG_BOOTX_TEXT)	+= btext.o
1355ad57078SPaul Mackerrasobj-$(CONFIG_SMP)		+= smp.o
1367568cb4eSPaul Mackerrasobj-$(CONFIG_KPROBES)		+= kprobes.o
13751c9c084SAnju Tobj-$(CONFIG_OPTPROBES)		+= optprobes.o optprobes_head.o
138ead514d5SNaveen N. Raoobj-$(CONFIG_KPROBES_ON_FTRACE)	+= kprobes-ftrace.o
1398b7b80b9SAnanth N Mavinakayanahalliobj-$(CONFIG_UPROBES)		+= uprobes.o
14013b8a272SPaul Mackerrasobj-$(CONFIG_PPC_UDBG_16550)	+= legacy_serial.o udbg_16550.o
141ec3cf2ecSBecky Bruceobj-$(CONFIG_SWIOTLB)		+= dma-swiotlb.o
14211ddce15SChristoph Hellwigobj-$(CONFIG_ARCH_HAS_DMA_SET_MASK) += dma-mask.o
1434c75a6f4SBenjamin Herrenschmidt
144317f06deSGavin Shanpci64-$(CONFIG_PPC64)		+= pci_dn.o pci-hotplug.o isa-bridge.o
14568201fbbSMichael Ellermanobj-$(CONFIG_PCI)		+= pci_$(BITS).o $(pci64-y) \
146fbe65447SGrant Likely				   pci-common.o pci_of_scan.o
147df87ef55SMichael Ellermanobj-$(CONFIG_PCI_MSI)		+= msi.o
148467d2782SThiago Jung Bauermann
149b7472e17SMichael Ellermanobj-$(CONFIG_AUDIT)		+= audit.o
150b7472e17SMichael Ellermanobj64-$(CONFIG_AUDIT)		+= compat_audit.o
151b7472e17SMichael Ellerman
1523cc30d07SMichael Ellermanobj-$(CONFIG_PPC_IO_WORKAROUNDS)	+= io-workarounds.o
1533cc30d07SMichael Ellerman
1547853f9c0SNaveen N. Raoobj-y				+= trace/
155a1110654SScott Wood
156ecd73cc5SBenjamin Herrenschmidtifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
15768a64357SBenjamin Herrenschmidtobj-y				+= iomap.o
1584cb3cee0SBenjamin Herrenschmidtendif
1594cb3cee0SBenjamin Herrenschmidt
16098ae22e1SMichael Neulingobj64-$(CONFIG_PPC_TRANSACTIONAL_MEM)	+= tm.o
16198ae22e1SMichael Neuling
162437a58dbSPaul Mackerrasobj-$(CONFIG_PPC64)		+= $(obj64-y)
1637325927eSPaul Mackerrasobj-$(CONFIG_PPC32)		+= $(obj32-y)
164437a58dbSPaul Mackerras
165fc2a5a61SStephen Rothwellifneq ($(CONFIG_XMON)$(CONFIG_KEXEC_CORE)(CONFIG_PPC_BOOK3S),)
166322b4394SAnton Vorontsovobj-y				+= ppc_save_regs.o
167322b4394SAnton Vorontsovendif
168322b4394SAnton Vorontsov
1692e1ae9c0SLiu Yu-B13201obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
170d17051cbSAlexander Grafobj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
171136bc039SThiago Jung Bauermannifneq ($(CONFIG_PPC_POWERNV)$(CONFIG_PPC_SVM),)
172136bc039SThiago Jung Bauermannobj-y				+= ucall.o
173136bc039SThiago Jung Bauermannendif
1742a342ed5SAlexander Graf
1759155e234SNayna Jainobj-$(CONFIG_PPC_SECURE_BOOT)	+= secure_boot.o ima_arch.o secvar-ops.o
176bd5d9c74SNayna Jainobj-$(CONFIG_PPC_SECVAR_SYSFS)	+= secvar-sysfs.o
1771a8916eeSNayna Jain
178fb0b0a73SAndrew Donnellan# Disable GCOV, KCOV & sanitizers in odd or sensitive code
179a15098c9SMichael EllermanGCOV_PROFILE_prom_init.o := n
180fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_prom_init.o := n
181bf76f73cSDaniel AxtensUBSAN_SANITIZE_prom_init.o := n
182a15098c9SMichael EllermanGCOV_PROFILE_kprobes.o := n
183fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_kprobes.o := n
184bf76f73cSDaniel AxtensUBSAN_SANITIZE_kprobes.o := n
185ead514d5SNaveen N. RaoGCOV_PROFILE_kprobes-ftrace.o := n
186fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_kprobes-ftrace.o := n
187ead514d5SNaveen N. RaoUBSAN_SANITIZE_kprobes-ftrace.o := n
1882f26ed17SDaniel AxtensGCOV_PROFILE_syscall_64.o := n
1892f26ed17SDaniel AxtensKCOV_INSTRUMENT_syscall_64.o := n
1902f26ed17SDaniel AxtensUBSAN_SANITIZE_syscall_64.o := n
191bf76f73cSDaniel AxtensUBSAN_SANITIZE_vdso.o := n
192a15098c9SMichael Ellerman
193fb0b0a73SAndrew Donnellan# Necessary for booting with kcov enabled on book3e machines
194fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_cputable.o := n
195fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_setup_64.o := n
196fb0b0a73SAndrew DonnellanKCOV_INSTRUMENT_paca.o := n
197fb0b0a73SAndrew Donnellan
198a7223f5bSArd BiesheuvelCFLAGS_setup_64.o		+= -fno-stack-protector
199a7223f5bSArd BiesheuvelCFLAGS_paca.o			+= -fno-stack-protector
200a7223f5bSArd Biesheuvel
20125c8a78bSDavid Gibsonextra-$(CONFIG_PPC_FPU)		+= fpu.o
202e821ea70SBenjamin Herrenschmidtextra-$(CONFIG_ALTIVEC)		+= vector.o
203640768eeSStephen Rothwellextra-$(CONFIG_PPC64)		+= entry_64.o
2045ac47f7aSAnton Blanchardextra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)	+= prom_init.o
2050a4690cfSStephen Rothwell
2061fdfa4c6SMasahiro Yamadaextra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)	+= prom_init_check
2075c02cd2fSMichael Ellerman
2081fdfa4c6SMasahiro Yamadaquiet_cmd_prom_init_check = PROMCHK $@
2091fdfa4c6SMasahiro Yamada      cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" $(obj)/prom_init.o; touch $@
2105c02cd2fSMichael Ellerman
2111fdfa4c6SMasahiro Yamada$(obj)/prom_init_check: $(src)/prom_init_check.sh $(obj)/prom_init.o FORCE
2121fdfa4c6SMasahiro Yamada	$(call if_changed,prom_init_check)
2131fdfa4c6SMasahiro Yamadatargets += prom_init_check
2145c02cd2fSMichael Ellerman
215e4ccde02SKumar Galaclean-files := vmlinux.lds
216791f9e36SChristophe Leroy
217791f9e36SChristophe Leroy# Force dependency (incbin is bad)
218fd1feadeSChristophe Leroy$(obj)/vdso32_wrapper.o : $(obj)/vdso/vdso32.so.dbg
219fd1feadeSChristophe Leroy$(obj)/vdso64_wrapper.o : $(obj)/vdso/vdso64.so.dbg
220964c33cdSMasahiro Yamada
221964c33cdSMasahiro Yamada# for cleaning
222fd1feadeSChristophe Leroysubdir- += vdso
223