xref: /linux/arch/x86/lib/Makefile (revision 40d04110f87940b6a03bf0aa19cd29e84f465f20)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for x86 specific library files.
4#
5
6# Produces uninteresting flaky coverage.
7KCOV_INSTRUMENT_delay.o	:= n
8
9# KCSAN uses udelay for introducing watchpoint delay; avoid recursion.
10KCSAN_SANITIZE_delay.o := n
11
12# Early boot use of cmdline; don't instrument it
13ifdef CONFIG_AMD_MEM_ENCRYPT
14KCOV_INSTRUMENT_cmdline.o := n
15KASAN_SANITIZE_cmdline.o  := n
16KCSAN_SANITIZE_cmdline.o  := n
17
18ifdef CONFIG_FUNCTION_TRACER
19CFLAGS_REMOVE_cmdline.o = -pg
20endif
21
22CFLAGS_cmdline.o := $(call cc-option, -fno-stack-protector)
23endif
24
25inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
26inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
27quiet_cmd_inat_tables = GEN     $@
28      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
29
30$(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
31	$(call cmd,inat_tables)
32
33$(obj)/inat.o: $(obj)/inat-tables.c
34
35clean-files := inat-tables.c
36
37obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
38
39lib-y := delay.o misc.o cmdline.o cpu.o
40lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
41lib-y += memcpy_$(BITS).o
42lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
43lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
44lib-$(CONFIG_FUNCTION_ERROR_INJECTION)	+= error-inject.o
45lib-$(CONFIG_RETPOLINE) += retpoline.o
46
47obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
48obj-y += iomem.o
49
50ifeq ($(CONFIG_X86_32),y)
51        obj-y += atomic64_32.o
52        lib-y += atomic64_cx8_32.o
53        lib-y += checksum_32.o
54        lib-y += strstr_32.o
55        lib-y += string_32.o
56ifneq ($(CONFIG_X86_CMPXCHG64),y)
57        lib-y += cmpxchg8b_emu.o atomic64_386_32.o
58endif
59        lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
60else
61        obj-y += iomap_copy_64.o
62        lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
63        lib-y += clear_page_64.o copy_page_64.o
64        lib-y += memmove_64.o memset_64.o
65        lib-y += copy_user_64.o
66	lib-y += cmpxchg16b_emu.o
67endif
68