blob: c6506c6a7092261280a32c8d9b9cf444c52570ed [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Sam Ravnborg583d0e92008-01-30 13:32:31 +01002#
3# Makefile for x86 specific library files.
4#
5
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -07006# Produces uninteresting flaky coverage.
7KCOV_INSTRUMENT_delay.o := n
8
Marco Elver40d04112019-11-14 19:03:03 +01009# KCSAN uses udelay for introducing watchpoint delay; avoid recursion.
10KCSAN_SANITIZE_delay.o := n
Marco Elverf5d23132020-02-14 22:10:35 +010011ifdef CONFIG_KCSAN
12# In case KCSAN+lockdep+ftrace are enabled, disable ftrace for delay.o to avoid
13# lockdep -> [other libs] -> KCSAN -> udelay -> ftrace -> lockdep recursion.
14CFLAGS_REMOVE_delay.o = $(CC_FLAGS_FTRACE)
15endif
Marco Elver40d04112019-11-14 19:03:03 +010016
Gary Hookb51ce372019-04-29 22:22:58 +000017# Early boot use of cmdline; don't instrument it
18ifdef CONFIG_AMD_MEM_ENCRYPT
19KCOV_INSTRUMENT_cmdline.o := n
20KASAN_SANITIZE_cmdline.o := n
Marco Elver40d04112019-11-14 19:03:03 +010021KCSAN_SANITIZE_cmdline.o := n
Gary Hookb51ce372019-04-29 22:22:58 +000022
23ifdef CONFIG_FUNCTION_TRACER
24CFLAGS_REMOVE_cmdline.o = -pg
25endif
26
Arvind Sankaraef01482020-09-02 22:30:56 -040027CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables
Gary Hookb51ce372019-04-29 22:22:58 +000028endif
29
Masami Hiramatsueb132962009-08-13 16:34:13 -040030inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
31inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
32quiet_cmd_inat_tables = GEN $@
Masahiro Yamada172caf12018-12-31 17:24:08 +090033 cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
Masami Hiramatsueb132962009-08-13 16:34:13 -040034
35$(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
36 $(call cmd,inat_tables)
37
38$(obj)/inat.o: $(obj)/inat-tables.c
39
40clean-files := inat-tables.c
41
Borislav Petkova7b480e2010-01-22 16:01:03 +010042obj-$(CONFIG_SMP) += msr-smp.o cache-smp.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010043
Borislav Petkov99f925c2015-11-23 11:12:21 +010044lib-y := delay.o misc.o cmdline.o cpu.o
Robert Richter1ac2e6c2011-06-07 11:49:55 +020045lib-y += usercopy_$(BITS).o usercopy.o getuser.o putuser.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010046lib-y += memcpy_$(BITS).o
Maciej W. Rozyckifb6a0402021-07-20 05:27:49 +020047lib-y += pc-conf-reg.o
Dan Williamsec6347b2020-10-05 20:40:16 -070048lib-$(CONFIG_ARCH_HAS_COPY_MC) += copy_mc.o copy_mc_64.o
Ricardo Neri32542ee2017-10-27 13:25:36 -070049lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o insn-eval.o
Thomas Garnierd899a7d2016-06-21 17:46:58 -070050lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
Masami Hiramatsu540adea2018-01-13 02:55:03 +090051lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
David Woodhouse76b04382018-01-11 21:46:25 +000052lib-$(CONFIG_RETPOLINE) += retpoline.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010053
Borislav Petkovf5967102016-05-30 12:56:27 +020054obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
Linus Torvalds170d13c2019-01-04 17:52:49 -080055obj-y += iomem.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Thomas Gleixner5fde34f2007-10-11 11:13:35 +020057ifeq ($(CONFIG_X86_32),y)
Ingo Molnar1fde9022009-07-03 17:28:57 +020058 obj-y += atomic64_32.o
Luca Barbieria7e926a2010-02-24 10:54:25 +010059 lib-y += atomic64_cx8_32.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010060 lib-y += checksum_32.o
61 lib-y += strstr_32.o
Jan Beulich4625cd62011-07-19 12:59:51 +010062 lib-y += string_32.o
Eric Dumazet04edbde2009-10-01 07:30:38 +020063ifneq ($(CONFIG_X86_CMPXCHG64),y)
Luca Barbieria7e926a2010-02-24 10:54:25 +010064 lib-y += cmpxchg8b_emu.o atomic64_386_32.o
Eric Dumazet04edbde2009-10-01 07:30:38 +020065endif
Sam Ravnborg583d0e92008-01-30 13:32:31 +010066 lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o
Thomas Gleixner5fde34f2007-10-11 11:13:35 +020067else
Brian Gerst6175ddf2010-02-05 09:37:07 -050068 obj-y += iomap_copy_64.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010069 lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o
Oleg Nesterov212be3b22014-09-21 20:42:32 +020070 lib-y += clear_page_64.o copy_page_64.o
Sam Ravnborg583d0e92008-01-30 13:32:31 +010071 lib-y += memmove_64.o memset_64.o
Borislav Petkovb41e6ec2015-05-13 19:42:24 +020072 lib-y += copy_user_64.o
Christoph Lameterb9ec40af2011-02-28 11:02:24 +010073 lib-y += cmpxchg16b_emu.o
Thomas Gleixner5fde34f2007-10-11 11:13:35 +020074endif