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