xref: /openbmc/linux/lib/Makefile (revision 8ab8ba38)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds# Makefile for some libs needed in the kernel.
41da177e4SLinus Torvalds#
51da177e4SLinus Torvalds
6606576ceSSteven Rostedtifdef CONFIG_FUNCTION_TRACER
72464a609SIngo MolnarORIG_CFLAGS := $(KBUILD_CFLAGS)
8c0a80c0cSHeiko CarstensKBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))
92464a609SIngo Molnarendif
102464a609SIngo Molnar
115c9a8750SDmitry Vyukov# These files are disabled because they produce lots of non-interesting and/or
125c9a8750SDmitry Vyukov# flaky coverage that is not a function of syscall inputs. For example,
135c9a8750SDmitry Vyukov# rbtree can be global and individual rotations don't correlate with inputs.
145c9a8750SDmitry VyukovKCOV_INSTRUMENT_string.o := n
155c9a8750SDmitry VyukovKCOV_INSTRUMENT_rbtree.o := n
165c9a8750SDmitry VyukovKCOV_INSTRUMENT_list_debug.o := n
175c9a8750SDmitry VyukovKCOV_INSTRUMENT_debugobjects.o := n
185c9a8750SDmitry VyukovKCOV_INSTRUMENT_dynamic_debug.o := n
195c9a8750SDmitry Vyukov
207a5c5d57SAlexey Dobriyanlib-y := ctype.o string.o vsprintf.o cmdline.o \
21e36df28fSDave Young	 rbtree.o radix-tree.o timerqueue.o\
22b4d3ba33SRandy Dunlap	 idr.o int_sqrt.o extable.o \
233c7eb3ccSJason A. Donenfeld	 sha1.o chacha20.o irq_regs.o argv_split.o \
24d18d12d0SRichard Cochran	 flex_proportions.o ratelimit.o show_mem.o \
2518dd0bf2SLinus Torvalds	 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
26f2ae6794SSebastian Andrzej Siewior	 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
272c956a60SJason A. Donenfeld	 nmi_backtrace.o nodemask.o win_minmax.o
289a19fea4Smochel@digitalimplant.org
29e36df28fSDave Younglib-$(CONFIG_PRINTK) += dump_stack.o
3074588d8bSHaavard Skinnemoenlib-$(CONFIG_MMU) += ioremap.o
31ccb46000SAndrew Mortonlib-$(CONFIG_SMP) += cpumask.o
32ccb46000SAndrew Morton
334af679cdSPeter Zijlstralib-y	+= kobject.o klist.o
342f4f12e5SLinus Torvaldsobj-y	+= lockref.o
351da177e4SLinus Torvalds
361c83a9aaSJason A. Donenfeldobj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \
3764d1d77aSAndy Shevchenko	 bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \
38d879cb83SAl Viro	 gcd.o lcm.o list_sort.o uuid.o flex_array.o iov_iter.o clz_ctz.o \
39840620a1SYury Norov	 bsearch.o find_bit.o llist.o memweight.o kfifo.o \
4046234253SHannes Frederic Sowa	 percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o \
4192f36ccaSTom Herbert	 once.o refcount.o usercopy.o errseq.o bucket_locks.o
42d6b28e09SGeert Uytterhoevenobj-$(CONFIG_STRING_SELFTEST) += test_string.o
4316c7fa05SAndy Shevchenkoobj-y += string_helpers.o
4416c7fa05SAndy Shevchenkoobj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
4564d1d77aSAndy Shevchenkoobj-y += hexdump.o
4660b2e8f4SAndy Shevchenkoobj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o
4733ee3b2eSAlexey Dobriyanobj-y += kstrtox.o
48dceeb3e7SYury Norovobj-$(CONFIG_FIND_BIT_BENCHMARK) += find_bit_benchmark.o
4964a8946bSAlexei Starovoitovobj-$(CONFIG_TEST_BPF) += test_bpf.o
500a8adf58SKees Cookobj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
519308f2f9SLuis R. Rodriguezobj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o
522c956a60SJason A. Donenfeldobj-$(CONFIG_TEST_HASH) += test_hash.o test_siphash.o
53*8ab8ba38SMatthew Wilcoxobj-$(CONFIG_TEST_IDA) += test_ida.o
543f15801cSAndrey Ryabininobj-$(CONFIG_TEST_KASAN) += test_kasan.o
5569ca372cSAndrey KonovalovCFLAGS_test_kasan.o += -fno-builtin
56854686f4SJinbum Parkobj-$(CONFIG_TEST_UBSAN) += test_ubsan.o
57854686f4SJinbum ParkUBSAN_SANITIZE_test_ubsan.o := y
583f15801cSAndrey Ryabininobj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
59e327fd7cSGeert Uytterhoevenobj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o
603f15801cSAndrey Ryabininobj-$(CONFIG_TEST_LKM) += test_module.o
61455a35a6SRasmus Villemoesobj-$(CONFIG_TEST_OVERFLOW) += test_overflow.o
629d6dbe1bSGeert Uytterhoevenobj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o
63c5adae95SKostenzer Felixobj-$(CONFIG_TEST_SORT) += test_sort.o
643f15801cSAndrey Ryabininobj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
652bf9e0abSIngo Molnarobj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o
662bf9e0abSIngo Molnarobj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o
67707cc728SRasmus Villemoesobj-$(CONFIG_TEST_PRINTF) += test_printf.o
685fd003f5SDavid Decotignyobj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
69cfaff0e5SAndy Shevchenkoobj-$(CONFIG_TEST_UUID) += test_uuid.o
7044091d29SJiri Pirkoobj-$(CONFIG_TEST_PARMAN) += test_parman.o
71d9c6a72dSLuis R. Rodriguezobj-$(CONFIG_TEST_KMOD) += test_kmod.o
72e4dace36SFlorian Fainelliobj-$(CONFIG_TEST_DEBUG_VIRTUAL) += test_debug_virtual.o
731da177e4SLinus Torvalds
741da177e4SLinus Torvaldsifeq ($(CONFIG_DEBUG_KOBJECT),y)
751da177e4SLinus TorvaldsCFLAGS_kobject.o += -DDEBUG
761da177e4SLinus TorvaldsCFLAGS_kobject_uevent.o += -DDEBUG
771da177e4SLinus Torvaldsendif
781da177e4SLinus Torvalds
7950ab9a69SRasmus Villemoesobj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o
8050ab9a69SRasmus VillemoesCFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any)
8150ab9a69SRasmus Villemoes
825ea81769SAl Viroobj-$(CONFIG_GENERIC_IOMAP) += iomap.o
8366eab4dfSMichael S. Tsirkinobj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
84928923c7SGeert Uytterhoevenobj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
85928923c7SGeert Uytterhoevenobj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
86cae2ed9aSIngo Molnarobj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
87d61931d8SBorislav Petkov
88031e3601SZhichang Yuanobj-y += logic_pio.o
89031e3601SZhichang Yuan
90702a28b1SRandy Dunlapobj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
91d61931d8SBorislav Petkov
925db53f3eSJoern Engelobj-$(CONFIG_BTREE) += btree.o
93a88cc108SChris Wilsonobj-$(CONFIG_INTERVAL_TREE) += interval_tree.o
943cb98950SDavid Howellsobj-$(CONFIG_ASSOCIATIVE_ARRAY) += assoc_array.o
9539c715b7SIngo Molnarobj-$(CONFIG_DEBUG_PREEMPT) += smp_processor_id.o
96199a9afcSDave Jonesobj-$(CONFIG_DEBUG_LIST) += list_debug.o
973ac7fe5aSThomas Gleixnerobj-$(CONFIG_DEBUG_OBJECTS) += debugobjects.o
981da177e4SLinus Torvalds
99a5cfc1ecSAkinobu Mitaobj-$(CONFIG_BITREVERSE) += bitrev.o
1008759ef32SOskar Schirmerobj-$(CONFIG_RATIONAL)	+= rational.o
1011da177e4SLinus Torvaldsobj-$(CONFIG_CRC_CCITT)	+= crc-ccitt.o
1027657ec1fSEvgeniy Polyakovobj-$(CONFIG_CRC16)	+= crc16.o
103f11f594eSMartin K. Petersenobj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o
1043e7cbae7SIvo van Doornobj-$(CONFIG_CRC_ITU_T)	+= crc-itu-t.o
1051da177e4SLinus Torvaldsobj-$(CONFIG_CRC32)	+= crc32.o
1065fb7f874SGeert Uytterhoevenobj-$(CONFIG_CRC32_SELFTEST)	+= crc32test.o
1070cbaa448SJeremy Kerrobj-$(CONFIG_CRC4)	+= crc4.o
108ad241528SJan Nikitenkoobj-$(CONFIG_CRC7)	+= crc7.o
1091da177e4SLinus Torvaldsobj-$(CONFIG_LIBCRC32C)	+= libcrc32c.o
1107150962dSArend van Sprielobj-$(CONFIG_CRC8)	+= crc8.o
1115d240522SNick Terrellobj-$(CONFIG_XXHASH)	+= xxhash.o
112f14f75b8SJes Sorensenobj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
1131da177e4SLinus Torvalds
1142da572c9SDan Streetmanobj-$(CONFIG_842_COMPRESS) += 842/
1152da572c9SDan Streetmanobj-$(CONFIG_842_DECOMPRESS) += 842/
1161da177e4SLinus Torvaldsobj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
1171da177e4SLinus Torvaldsobj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
1181da177e4SLinus Torvaldsobj-$(CONFIG_REED_SOLOMON) += reed_solomon/
119437aa565SIvan Djelicobj-$(CONFIG_BCH) += bch.o
12064c70b1cSRichard Purdieobj-$(CONFIG_LZO_COMPRESS) += lzo/
12164c70b1cSRichard Purdieobj-$(CONFIG_LZO_DECOMPRESS) += lzo/
122c72ac7a1SChanho Minobj-$(CONFIG_LZ4_COMPRESS) += lz4/
123c72ac7a1SChanho Minobj-$(CONFIG_LZ4HC_COMPRESS) += lz4/
124e76e1fdfSKyungsik Leeobj-$(CONFIG_LZ4_DECOMPRESS) += lz4/
12573f3d1b4SNick Terrellobj-$(CONFIG_ZSTD_COMPRESS) += zstd/
12673f3d1b4SNick Terrellobj-$(CONFIG_ZSTD_DECOMPRESS) += zstd/
12724fa0402SLasse Collinobj-$(CONFIG_XZ_DEC) += xz/
128f5e70d0fSDavid Woodhouseobj-$(CONFIG_RAID6_PQ) += raid6/
1291da177e4SLinus Torvalds
130889c92d2SH. Peter Anvinlib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
131889c92d2SH. Peter Anvinlib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
132889c92d2SH. Peter Anvinlib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
1333ebe1243SLasse Collinlib-$(CONFIG_DECOMPRESS_XZ) += decompress_unxz.o
134cacb246fSAlbin Tonnerrelib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
135e76e1fdfSKyungsik Leelib-$(CONFIG_DECOMPRESS_LZ4) += decompress_unlz4.o
136c8531ab3SH. Peter Anvin
13765df877aSDavid S. Millerobj-$(CONFIG_TEXTSEARCH) += textsearch.o
138df3fb93aSThomas Grafobj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
1398082e4edSPablo Neira Ayusoobj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o
1406408f79cSThomas Grafobj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o
1413cbc5640SRavikiran G Thirumalaiobj-$(CONFIG_SMP) += percpu_counter.o
142e65e1fc2SAl Viroobj-$(CONFIG_AUDIT_GENERIC) += audit.o
1434b588411SAKASHI Takahiroobj-$(CONFIG_AUDIT_COMPAT_GENERIC) += compat_audit.o
1442de4ff7bSThomas Graf
1450d3fdb15SChristoph Hellwigobj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o
1466ff1cb35SAkinobu Mitaobj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
1478d438288SAkinobu Mitaobj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o
148048b9c35SAkinobu Mitaobj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o
14902fff96aSNikolay Aleksandrovobj-$(CONFIG_NETDEV_NOTIFIER_ERROR_INJECT) += netdev-notifier-error-inject.o
1509579f5bdSAkinobu Mitaobj-$(CONFIG_MEMORY_NOTIFIER_ERROR_INJECT) += memory-notifier-error-inject.o
151d526e85fSBenjamin Herrenschmidtobj-$(CONFIG_OF_RECONFIG_NOTIFIER_ERROR_INJECT) += \
152d526e85fSBenjamin Herrenschmidt	of-reconfig-notifier-error-inject.o
153540adea3SMasami Hiramatsuobj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
1546c654b5fSJohn W. Linville
1557664c5a1SJeremy Fitzhardingelib-$(CONFIG_GENERIC_BUG) += bug.o
1567664c5a1SJeremy Fitzhardinge
157bbc69863SRoland McGrathobj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
158bbc69863SRoland McGrath
159e9d376f0SJason Baronobj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o
160346e15beSJason Baron
161e9cc8bddSGeert Uytterhoevenobj-$(CONFIG_NLATTR) += nlattr.o
1621da177e4SLinus Torvalds
163b411b363SPhilipp Reisnerobj-$(CONFIG_LRU_CACHE) += lru_cache.o
164b411b363SPhilipp Reisner
16526a28fa4SArnd Bergmannobj-$(CONFIG_GENERIC_CSUM) += checksum.o
16626a28fa4SArnd Bergmann
16709d4e0edSPaul Mackerrasobj-$(CONFIG_GENERIC_ATOMIC64) += atomic64.o
16809d4e0edSPaul Mackerras
16986a89380SLuca Barbieriobj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
17086a89380SLuca Barbieri
171c39649c3SBen Hutchingsobj-$(CONFIG_CPU_RMAP) += cpu_rmap.o
172c39649c3SBen Hutchings
17310f8113eSArend van Sprielobj-$(CONFIG_CORDIC) += cordic.o
17410f8113eSArend van Spriel
17575957ba3STom Herbertobj-$(CONFIG_DQL) += dynamic_queue_limits.o
17675957ba3STom Herbert
177b0125085SGeorge Spelvinobj-$(CONFIG_GLOB) += glob.o
178ba95b045SGeert Uytterhoevenobj-$(CONFIG_GLOB_SELFTEST) += globtest.o
179b0125085SGeorge Spelvin
180d9c46b18SDmitry Kasatkinobj-$(CONFIG_MPILIB) += mpi/
1815e8898e9SDmitry Kasatkinobj-$(CONFIG_SIGNATURE) += digsig.o
182d9c46b18SDmitry Kasatkin
183f5948701SChris Metcalflib-$(CONFIG_CLZ_TAB) += clz_tab.o
184c6df4b17SDavid Miller
1859c1c21a0SAneesh Vobj-$(CONFIG_DDR) += jedec_ddr_data.o
1869c1c21a0SAneesh V
1872922585bSDavid S. Millerobj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) += strncpy_from_user.o
188a08c5356SLinus Torvaldsobj-$(CONFIG_GENERIC_STRNLEN_USER) += strnlen_user.o
1892922585bSDavid S. Miller
1904cd5773aSAndy Shevchenkoobj-$(CONFIG_GENERIC_NET_UTILS) += net_utils.o
1914cd5773aSAndy Shevchenko
192f8bcbe62SRobert Jarzmikobj-$(CONFIG_SG_SPLIT) += sg_split.o
1939b1d6c89SMing Linobj-$(CONFIG_SG_POOL) += sg_pool.o
1944ccf4beaSWolfram Sangobj-$(CONFIG_STMP_DEVICE) += stmp_device.o
195511cbce2SChristoph Hellwigobj-$(CONFIG_IRQ_POLL) += irq_poll.o
1964ccf4beaSWolfram Sang
197cd11016eSAlexander Potapenkoobj-$(CONFIG_STACKDEPOT) += stackdepot.o
198cd11016eSAlexander PotapenkoKASAN_SANITIZE_stackdepot.o := n
19965deb8afSAlexander PotapenkoKCOV_INSTRUMENT_stackdepot.o := n
200cd11016eSAlexander Potapenko
201adaf5687SMark Salterlibfdt_files = fdt.o fdt_ro.o fdt_wip.o fdt_rw.o fdt_sw.o fdt_strerror.o \
202adaf5687SMark Salter	       fdt_empty_tree.o
203ab253839SDavid Daney$(foreach file, $(libfdt_files), \
204ab253839SDavid Daney	$(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt))
205ab253839SDavid Daneylib-$(CONFIG_LIBFDT) += $(libfdt_files)
206ab253839SDavid Daney
207910a742dSMichel Lespinasseobj-$(CONFIG_RBTREE_TEST) += rbtree_test.o
208fff3fd8aSMichel Lespinasseobj-$(CONFIG_INTERVAL_TREE_TEST) += interval_tree_test.o
209fff3fd8aSMichel Lespinasse
210623fd807SGreg Thelenobj-$(CONFIG_PERCPU_TEST) += percpu_test.o
211623fd807SGreg Thelen
21242d5ec27SDavid Howellsobj-$(CONFIG_ASN1) += asn1_decoder.o
21342d5ec27SDavid Howells
214ee89bd6bSGeert Uytterhoevenobj-$(CONFIG_FONT_SUPPORT) += fonts/
215ee89bd6bSGeert Uytterhoeven
216cf4a7207SChris Wilsonobj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
217cf4a7207SChris Wilson
2181da177e4SLinus Torvaldshostprogs-y	:= gen_crc32table
2191da177e4SLinus Torvaldsclean-files	:= crc32table.h
2201da177e4SLinus Torvalds
2211da177e4SLinus Torvalds$(obj)/crc32.o: $(obj)/crc32table.h
2221da177e4SLinus Torvalds
2231da177e4SLinus Torvaldsquiet_cmd_crc32 = GEN     $@
2241da177e4SLinus Torvalds      cmd_crc32 = $< > $@
2251da177e4SLinus Torvalds
2261da177e4SLinus Torvalds$(obj)/crc32table.h: $(obj)/gen_crc32table
2271da177e4SLinus Torvalds	$(call cmd,crc32)
228a77ad6eaSDavid Howells
229a77ad6eaSDavid Howells#
230a77ad6eaSDavid Howells# Build a fast OID lookip registry from include/linux/oid_registry.h
231a77ad6eaSDavid Howells#
232a77ad6eaSDavid Howellsobj-$(CONFIG_OID_REGISTRY) += oid_registry.o
233a77ad6eaSDavid Howells
234527897ccSTim Gardner$(obj)/oid_registry.o: $(obj)/oid_registry_data.c
235a77ad6eaSDavid Howells
236a77ad6eaSDavid Howells$(obj)/oid_registry_data.c: $(srctree)/include/linux/oid_registry.h \
237a77ad6eaSDavid Howells			    $(src)/build_OID_registry
238a77ad6eaSDavid Howells	$(call cmd,build_OID_registry)
239a77ad6eaSDavid Howells
240a77ad6eaSDavid Howellsquiet_cmd_build_OID_registry = GEN     $@
241a77ad6eaSDavid Howells      cmd_build_OID_registry = perl $(srctree)/$(src)/build_OID_registry $< $@
242a77ad6eaSDavid Howells
243a77ad6eaSDavid Howellsclean-files	+= oid_registry_data.c
2440635eb8aSMatthew Garrett
2450635eb8aSMatthew Garrettobj-$(CONFIG_UCS2_STRING) += ucs2_string.o
246c6d30853SAndrey Ryabininobj-$(CONFIG_UBSAN) += ubsan.o
247c6d30853SAndrey Ryabinin
248c6d30853SAndrey RyabininUBSAN_SANITIZE_ubsan.o := n
24988459642SOmar Sandoval
25088459642SOmar Sandovalobj-$(CONFIG_SBITMAP) += sbitmap.o
25144091d29SJiri Pirko
25244091d29SJiri Pirkoobj-$(CONFIG_PARMAN) += parman.o
253b35cd988SPalmer Dabbelt
254b35cd988SPalmer Dabbelt# GCC library routines
255e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
256e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
257e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
258e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
259e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o
260e3d59805SMatt Redfearnobj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o
261