xref: /openbmc/linux/arch/powerpc/lib/Makefile (revision 25c2e591)
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# restart_table.o contains functions called in the NMI interrupt path
17# which can be in real mode. Disable KASAN.
18KASAN_SANITIZE_restart_table.o := n
19
20ifdef CONFIG_KASAN
21CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING
22CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING
23endif
24
25CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
26CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
27
28obj-y += alloc.o code-patching.o feature-fixups.o pmem.o
29
30obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o
31
32ifndef CONFIG_KASAN
33obj-y	+=	string.o memcmp_$(BITS).o
34obj-$(CONFIG_PPC32)	+= strlen_32.o
35endif
36
37obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o
38
39obj-$(CONFIG_FUNCTION_ERROR_INJECTION)	+= error-inject.o
40
41# See corresponding test in arch/powerpc/Makefile
42# 64-bit linker creates .sfpr on demand for final link (vmlinux),
43# so it is only needed for modules, and only for older linkers which
44# do not support --save-restore-funcs
45ifeq ($(call ld-ifversion, -lt, 22500, y),y)
46extra-$(CONFIG_PPC64)	+= crtsavres.o
47endif
48
49obj-$(CONFIG_PPC_BOOK3S_64) += copyuser_power7.o copypage_power7.o \
50			       memcpy_power7.o restart_table.o
51
52obj64-y	+= copypage_64.o copyuser_64.o mem_64.o hweight_64.o \
53	   memcpy_64.o copy_mc_64.o
54
55ifndef CONFIG_PPC_QUEUED_SPINLOCKS
56obj64-$(CONFIG_SMP)	+= locks.o
57endif
58
59obj64-$(CONFIG_ALTIVEC)	+= vmx-helper.o
60obj64-$(CONFIG_KPROBES_SANITY_TEST)	+= test_emulate_step.o \
61					   test_emulate_step_exec_instr.o
62
63obj-y			+= checksum_$(BITS).o checksum_wrappers.o \
64			   string_$(BITS).o
65
66obj-y			+= sstep.o
67obj-$(CONFIG_PPC_FPU)	+= ldstfp.o
68obj64-y			+= quad.o
69
70obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
71
72obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
73
74obj-$(CONFIG_ALTIVEC)	+= xor_vmx.o xor_vmx_glue.o
75CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
76# Enable <altivec.h>
77CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include)
78
79obj-$(CONFIG_PPC64) += $(obj64-y)
80