1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for ppc-specific library files..
4#
5
6ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
7
8CFLAGS_code-patching.o += -fno-stack-protector
9CFLAGS_feature-fixups.o += -fno-stack-protector
10
11CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
12CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
13
14KASAN_SANITIZE_code-patching.o := n
15KASAN_SANITIZE_feature-fixups.o := n
16
17ifdef CONFIG_KASAN
18CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING
19CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING
20endif
21
22obj-y += alloc.o code-patching.o feature-fixups.o pmem.o test_code-patching.o
23
24ifndef CONFIG_KASAN
25obj-y	+=	string.o memcmp_$(BITS).o
26obj-$(CONFIG_PPC32)	+= strlen_32.o
27endif
28
29obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o
30
31obj-$(CONFIG_FUNCTION_ERROR_INJECTION)	+= error-inject.o
32
33# See corresponding test in arch/powerpc/Makefile
34# 64-bit linker creates .sfpr on demand for final link (vmlinux),
35# so it is only needed for modules, and only for older linkers which
36# do not support --save-restore-funcs
37ifeq ($(call ld-ifversion, -lt, 22500, y),y)
38extra-$(CONFIG_PPC64)	+= crtsavres.o
39endif
40
41obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
42			       memcpy_power7.o restart_table.o
43
44obj64-y	+= copypage_64.o copyuser_64.o mem_64.o hweight_64.o \
45	   memcpy_64.o copy_mc_64.o
46
47ifndef CONFIG_PPC_QUEUED_SPINLOCKS
48obj64-$(CONFIG_SMP)	+= locks.o
49endif
50
51obj64-$(CONFIG_ALTIVEC)	+= vmx-helper.o
52obj64-$(CONFIG_KPROBES_SANITY_TEST)	+= test_emulate_step.o \
53					   test_emulate_step_exec_instr.o
54
55obj-y			+= checksum_$(BITS).o checksum_wrappers.o \
56			   string_$(BITS).o
57
58obj-y			+= sstep.o
59obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
60obj64-y			+= quad.o
61
62obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
63
64obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
65
66obj-$(CONFIG_ALTIVEC)	+= xor_vmx.o xor_vmx_glue.o
67CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
68# Enable <altivec.h>
69CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include)
70
71obj-$(CONFIG_PPC64) += $(obj64-y)
72