blob: 56f4ee97f32849823304b0b3b6509b33a4cca6e7 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#
3# Makefile for the linux kernel.
4#
5
Joe Perchesb9ee9792013-07-31 13:53:42 -07006obj-y = fork.o exec_domain.o panic.o \
Thomas Gleixner5cee9642014-06-22 12:06:40 +02007 cpu.o exit.o softirq.o resource.o \
Xiaoming Ni88db0aa2020-08-14 17:31:07 -07008 sysctl.o capability.o ptrace.o user.o \
Luis R. Rodriguez0ce2c202017-09-08 16:17:12 -07009 signal.o sys.o umh.o workqueue.o pid.o task_work.o \
Thomas Gleixner5cee9642014-06-22 12:06:40 +020010 extable.o params.o \
11 kthread.o sys_ni.o nsproxy.o \
Robin Holt15d94b82013-07-08 16:01:32 -070012 notifier.o ksysfs.o cred.o reboot.o \
Al Virob4e9c952020-06-01 19:42:40 -040013 async.o range.o smpboot.o ucount.o regset.o
Iulia Manda28138932015-04-15 16:16:41 -070014
Alexei Starovoitovd71fa5c2020-08-18 21:27:58 -070015obj-$(CONFIG_USERMODE_DRIVER) += usermode_driver.o
Luis R. Rodriguez0ce2c202017-09-08 16:17:12 -070016obj-$(CONFIG_MODULES) += kmod.o
Iulia Manda28138932015-04-15 16:16:41 -070017obj-$(CONFIG_MULTIUSER) += groups.o
Peter Zijlstra029632f2011-10-25 10:00:11 +020018
Steven Rostedt606576c2008-10-06 19:06:12 -040019ifdef CONFIG_FUNCTION_TRACER
Li Bine11b9562016-01-30 11:54:03 +080020# Do not trace internal ftrace files
Heiko Carstensc0a80c02015-01-09 13:06:33 +010021CFLAGS_REMOVE_irq_work.o = $(CC_FLAGS_FTRACE)
Steven Rostedt1d09daa2008-05-12 21:20:55 +020022endif
23
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070024# Prevents flicker of uninteresting __do_softirq()/__local_bh_disable_ip()
25# in coverage traces.
26KCOV_INSTRUMENT_softirq.o := n
Marco Elver0ebba712019-11-14 19:02:58 +010027# Avoid KCSAN instrumentation in softirq ("No shared variables, all the data
28# are CPU local" => assume no data races), to reduce overhead in interrupts.
29KCSAN_SANITIZE_softirq.o = n
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070030# These are called from save_stack_trace() on slub debug path,
31# and produce insane amounts of uninteresting coverage.
32KCOV_INSTRUMENT_module.o := n
33KCOV_INSTRUMENT_extable.o := n
Dmitry Vyukov43e76af2020-01-30 22:17:35 -080034KCOV_INSTRUMENT_stacktrace.o := n
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070035# Don't self-instrument.
36KCOV_INSTRUMENT_kcov.o := n
Dmitry Vyukovc1cb05e2020-12-15 20:46:46 -080037# If sanitizers detect any issues in kcov, it may lead to recursion
38# via printk, etc.
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070039KASAN_SANITIZE_kcov.o := n
Marco Elver0ebba712019-11-14 19:02:58 +010040KCSAN_SANITIZE_kcov.o := n
Dmitry Vyukovc1cb05e2020-12-15 20:46:46 -080041UBSAN_SANITIZE_kcov.o := n
Marco Elver31a1b9872020-08-11 18:36:56 -070042CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070043
Sami Tolvanencf68fff2021-04-08 11:28:26 -070044# Don't instrument error handlers
45CFLAGS_REMOVE_cfi.o := $(CC_FLAGS_CFI)
46
Peter Zijlstra391e43d2011-11-15 17:14:39 +010047obj-y += sched/
Peter Zijlstra01768b42013-10-31 18:11:53 +010048obj-y += locking/
Rafael J. Wysockidae5cbc2012-01-14 00:33:03 +010049obj-y += power/
Joe Perchesb9ee9792013-07-31 13:53:42 -070050obj-y += printk/
Martin Schwidefsky0244ad02013-08-30 09:39:53 +020051obj-y += irq/
Paul E. McKenney4102ada2013-10-08 20:23:47 -070052obj-y += rcu/
Seth Jenningsb700e7f2014-12-16 11:58:19 -060053obj-y += livepatch/
Christoph Hellwigcf65a0f2018-06-12 19:01:45 +020054obj-y += dma/
Thomas Gleixner142781e2020-07-22 23:59:56 +020055obj-y += entry/
Peter Zijlstra391e43d2011-11-15 17:14:39 +010056
Chris Wilsonbfe39112021-02-05 22:00:12 +000057obj-$(CONFIG_KCMP) += kcmp.o
Matt Helsley8174f152008-10-18 20:27:19 -070058obj-$(CONFIG_FREEZER) += freezer.o
Adrian Bunkb03f6482008-07-25 01:45:35 -070059obj-$(CONFIG_PROFILING) += profile.o
Ingo Molnar8637c092006-07-03 00:24:38 -070060obj-$(CONFIG_STACKTRACE) += stacktrace.o
john stultzad596172006-06-26 00:25:06 -070061obj-y += time/
Peter Zijlstra77e52ae2021-09-23 14:10:50 -030062obj-$(CONFIG_FUTEX) += futex/
Linus Torvalds1da177e2005-04-16 15:20:36 -070063obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
Amerigo Wang351f8f82011-01-12 16:59:39 -080064obj-$(CONFIG_SMP) += smp.o
Andrew Morton9316fca2009-01-14 09:35:44 -080065ifneq ($(CONFIG_SMP),y)
Andrew Morton53ce3d92009-01-09 12:27:08 -080066obj-y += up.o
67endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070068obj-$(CONFIG_UID16) += uid16.o
69obj-$(CONFIG_MODULES) += module.o
Dmitry Torokhovb1ae6dc2022-01-05 13:55:12 -080070obj-$(CONFIG_MODULE_DECOMPRESS) += module_decompress.o
David Howellsb56e5a12013-08-30 16:07:30 +010071obj-$(CONFIG_MODULE_SIG) += module_signing.o
Thiago Jung Bauermannc8424e72019-07-04 15:57:34 -030072obj-$(CONFIG_MODULE_SIG_FORMAT) += module_signature.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070073obj-$(CONFIG_KALLSYMS) += kallsyms.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070074obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
Hari Bathini692f66f2017-05-08 15:56:18 -070075obj-$(CONFIG_CRASH_CORE) += crash_core.o
Dave Young2965faa2015-09-09 15:38:55 -070076obj-$(CONFIG_KEXEC_CORE) += kexec_core.o
Eric W. Biedermandc009d92005-06-25 14:57:52 -070077obj-$(CONFIG_KEXEC) += kexec.o
Dave Younga43cac02015-09-09 15:38:51 -070078obj-$(CONFIG_KEXEC_FILE) += kexec_file.o
Sven Schnelle175fca32019-08-23 21:49:13 +020079obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o
Arjan van de Ven6dab2772008-01-30 13:33:08 +010080obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070081obj-$(CONFIG_COMPAT) += compat.o
Tejun Heo201af4c2016-12-27 14:49:05 -050082obj-$(CONFIG_CGROUPS) += cgroup/
Pavel Emelyanovaee16ce2008-02-08 04:18:23 -080083obj-$(CONFIG_UTS_NS) += utsname.o
84obj-$(CONFIG_USER_NS) += user_namespace.o
Pavel Emelyanov74bd59b2008-02-08 04:18:24 -080085obj-$(CONFIG_PID_NS) += pid_namespace.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070086obj-$(CONFIG_IKCONFIG) += configs.o
Joel Fernandes (Google)f7b101d2019-05-15 17:35:51 -040087obj-$(CONFIG_IKHEADERS) += kheaders.o
Tejun Heobbf1bb32010-05-08 16:20:53 +020088obj-$(CONFIG_SMP) += stop_machine.o
Eric Paris939a67f2009-12-17 20:12:06 -050089obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
Richard Guy Briggsc8fc5d42018-11-16 12:17:35 -050090obj-$(CONFIG_AUDITSYSCALL) += auditsc.o audit_watch.o audit_fsnotify.o audit_tree.o
Eric Paris939a67f2009-12-17 20:12:06 -050091obj-$(CONFIG_GCOV_KERNEL) += gcov/
Dmitry Vyukov5c9a8752016-03-22 14:27:30 -070092obj-$(CONFIG_KCOV) += kcov.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070093obj-$(CONFIG_KPROBES) += kprobes.o
Masami Hiramatsu4b1a29a2018-01-13 02:56:03 +090094obj-$(CONFIG_FAIL_FUNCTION) += fail_function.o
Jason Wesselc4338202009-05-19 07:49:32 -050095obj-$(CONFIG_KGDB) += debug/
Mandeep Singh Bainese162b392009-01-15 11:08:40 -080096obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o
Don Zickus58687ac2010-05-07 17:11:44 -040097obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o
Nicholas Piggin05a4a952017-07-12 14:35:46 -070098obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_hld.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070099obj-$(CONFIG_SECCOMP) += seccomp.o
Jens Axboeb86ff9812006-03-23 19:56:55 +0100100obj-$(CONFIG_RELAY) += relay.o
Eric W. Biederman39732ac2007-02-14 00:33:58 -0800101obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
Shailabh Nagarca74e922006-07-14 00:24:36 -0700102obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
Jay Lanf3cef7a2006-09-30 23:28:55 -0700103obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
Mathieu Desnoyers97e1c182008-07-18 12:16:16 -0400104obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
Arjan van de Ven97455122008-01-25 21:08:34 +0100105obj-$(CONFIG_LATENCYTOP) += latencytop.o
Steven Rostedt606576c2008-10-06 19:06:12 -0400106obj-$(CONFIG_FUNCTION_TRACER) += trace/
Steven Rostedtbc0c38d2008-05-12 21:20:42 +0200107obj-$(CONFIG_TRACING) += trace/
Josh Triplettea632e92012-09-02 19:45:14 -0700108obj-$(CONFIG_TRACE_CLOCK) += trace/
Paul Mundt1155de42009-06-25 14:30:12 +0900109obj-$(CONFIG_RING_BUFFER) += trace/
Mathieu Desnoyers870915e2010-10-28 11:31:17 -0400110obj-$(CONFIG_TRACEPOINTS) += trace/
Peter Zijlstrae360adb2010-10-14 14:01:34 +0800111obj-$(CONFIG_IRQ_WORK) += irq_work.o
Colin Crossab100232011-02-10 02:04:45 -0800112obj-$(CONFIG_CPU_PM) += cpu_pm.o
Alexei Starovoitovf89b7752014-10-23 18:41:08 -0700113obj-$(CONFIG_BPF) += bpf/
Marco Elverdfd402a2019-11-14 19:02:54 +0100114obj-$(CONFIG_KCSAN) += kcsan/
Sami Tolvanend08b9f02020-04-27 09:00:07 -0700115obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
Josh Poimboeuf9183c3f2020-08-18 15:57:42 +0200116obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o
Sami Tolvanencf68fff2021-04-08 11:28:26 -0700117obj-$(CONFIG_CFI_CLANG) += cfi.o
Borislav Petkovfae85b72010-10-26 20:24:03 +0200118
119obj-$(CONFIG_PERF_EVENTS) += events/
120
Avi Kivity7a041092009-10-25 14:24:45 +0200121obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o
Steffen Klassert16295be2010-01-06 19:47:10 +1100122obj-$(CONFIG_PADATA) += padata.o
Olaf Hering93a72052011-03-23 16:43:29 -0700123obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
Jason Baronb77f0f32011-08-05 16:40:40 -0400124obj-$(CONFIG_JUMP_LABEL) += jump_label.o
Frederic Weisbecker91d1aa432012-11-27 19:33:25 +0100125obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o
Paul E. McKenney51b11302014-01-27 11:49:39 -0800126obj-$(CONFIG_TORTURE_TEST) += torture.o
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
Dan Williams59816902018-03-29 19:07:13 -0700128obj-$(CONFIG_HAS_IOMEM) += iomem.o
Mathieu Desnoyersd7822b12018-06-02 08:43:54 -0400129obj-$(CONFIG_RSEQ) += rseq.o
David Howellsc73be612020-01-14 17:07:11 +0000130obj-$(CONFIG_WATCH_QUEUE) += watch_queue.o
Dan Williams92281dee2015-08-10 23:07:06 -0400131
Andy Shevchenko5df38ca2020-11-03 22:45:08 +0200132obj-$(CONFIG_RESOURCE_KUNIT_TEST) += resource_kunit.o
Iurii Zaikin2cb80db2019-09-23 02:02:47 -0700133obj-$(CONFIG_SYSCTL_KUNIT_TEST) += sysctl-test.o
134
Alexander Popov005e6962020-06-24 15:33:26 +0300135CFLAGS_stackleak.o += $(DISABLE_STACKLEAK_PLUGIN)
Alexander Popovafaef012018-08-17 01:16:58 +0300136obj-$(CONFIG_GCC_PLUGIN_STACKLEAK) += stackleak.o
137KASAN_SANITIZE_stackleak.o := n
Marco Elver0ebba712019-11-14 19:02:58 +0100138KCSAN_SANITIZE_stackleak.o := n
Alexander Popovafaef012018-08-17 01:16:58 +0300139KCOV_INSTRUMENT_stackleak.o := n
140
Paul E. McKenneye9d338a2020-06-24 15:59:59 -0700141obj-$(CONFIG_SCF_TORTURE_TEST) += scftorture.o
142
Masahiro Yamada13610aa2019-03-07 16:29:53 -0800143$(obj)/configs.o: $(obj)/config_data.gz
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Masahiro Yamada46b41d52021-04-25 15:24:07 +0900145targets += config_data config_data.gz
146$(obj)/config_data.gz: $(obj)/config_data FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 $(call if_changed,gzip)
Joel Fernandes (Google)43d8ce92019-04-26 15:04:29 -0400148
Masahiro Yamada46b41d52021-04-25 15:24:07 +0900149filechk_cat = cat $<
150
151$(obj)/config_data: $(KCONFIG_CONFIG) FORCE
152 $(call filechk,cat)
153
Joel Fernandes (Google)43d8ce92019-04-26 15:04:29 -0400154$(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
155
156quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz
Masahiro Yamada1463f742019-10-08 21:05:55 +0900157 cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@
Joel Fernandes (Google)43d8ce92019-04-26 15:04:29 -0400158$(obj)/kheaders_data.tar.xz: FORCE
159 $(call cmd,genikh)
160
161clean-files := kheaders_data.tar.xz kheaders.md5