aboutsummaryrefslogtreecommitdiffstats
path: root/module/Kbuild.in
blob: 11099999fb87d23fec47b14f66a662905b95db7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# When integrated in to a monolithic kernel the spl module must appear
# first.  This ensures its module initialization function is run before
# any of the other module initialization functions which depend on it.

ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@  @NO_FORMAT_ZERO_LENGTH@

ifneq ($(KBUILD_EXTMOD),)
zfs_include = @abs_top_srcdir@/include
icp_include = @abs_srcdir@/icp/include
zstd_include = @abs_srcdir@/zstd/include
ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
ZFS_MODULE_CFLAGS += -I@abs_top_builddir@/include
src = @abs_srcdir@
obj = @abs_builddir@
else
zfs_include = $(srctree)/include/zfs
icp_include = $(srctree)/$(src)/icp/include
zstd_include = $(srctree)/$(src)/zstd/include
ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h
endif

ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/kernel
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/spl
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/zfs
ZFS_MODULE_CFLAGS += -I$(zfs_include)
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@

# KASAN enables -Werror=frame-larger-than=1024, which
# breaks oh so many parts of our build.
ifeq ($(CONFIG_KASAN),y)
ZFS_MODULE_CFLAGS += -Wno-error=frame-larger-than=
endif

ifneq ($(KBUILD_EXTMOD),)
@CONFIG_QAT_TRUE@ZFS_MODULE_CFLAGS += -I@QAT_SRC@/include
@CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@
endif

asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)

# Suppress unused-value warnings in sparc64 architecture headers
ccflags-$(CONFIG_SPARC64) += -Wno-unused-value


obj-$(CONFIG_ZFS) := spl.o zfs.o

SPL_OBJS := \
	spl-atomic.o \
	spl-condvar.o \
	spl-cred.o \
	spl-err.o \
	spl-generic.o \
	spl-kmem-cache.o \
	spl-kmem.o \
	spl-kstat.o \
	spl-proc.o \
	spl-procfs-list.o \
	spl-taskq.o \
	spl-thread.o \
	spl-trace.o \
	spl-tsd.o \
	spl-vmem.o \
	spl-xdr.o \
	spl-zlib.o

spl-objs += $(addprefix os/linux/spl/,$(SPL_OBJS))

zfs-objs += avl/avl.o

ICP_OBJS := \
	algs/aes/aes_impl.o \
	algs/aes/aes_impl_generic.o \
	algs/aes/aes_modes.o \
	algs/edonr/edonr.o \
	algs/modes/cbc.o \
	algs/modes/ccm.o \
	algs/modes/ctr.o \
	algs/modes/ecb.o \
	algs/modes/gcm.o \
	algs/modes/gcm_generic.o \
	algs/modes/modes.o \
	algs/sha2/sha2.o \
	algs/skein/skein.o \
	algs/skein/skein_block.o \
	algs/skein/skein_iv.o \
	api/kcf_cipher.o \
	api/kcf_ctxops.o \
	api/kcf_mac.o \
	core/kcf_callprov.o \
	core/kcf_mech_tabs.o \
	core/kcf_prov_lib.o \
	core/kcf_prov_tabs.o \
	core/kcf_sched.o \
	illumos-crypto.o \
	io/aes.o \
	io/sha2_mod.o \
	io/skein_mod.o \
	spi/kcf_spi.o

ICP_OBJS_X86_64 := \
	asm-x86_64/aes/aes_aesni.o \
	asm-x86_64/aes/aes_amd64.o \
	asm-x86_64/aes/aeskey.o \
	asm-x86_64/modes/aesni-gcm-x86_64.o \
	asm-x86_64/modes/gcm_pclmulqdq.o \
	asm-x86_64/modes/ghash-x86_64.o \
	asm-x86_64/sha2/sha256_impl.o \
	asm-x86_64/sha2/sha512_impl.o

ICP_OBJS_X86 := \
	algs/aes/aes_impl_aesni.o \
	algs/aes/aes_impl_x86-64.o \
	algs/modes/gcm_pclmulqdq.o

zfs-objs             += $(addprefix icp/,$(ICP_OBJS))
zfs-$(CONFIG_X86)    += $(addprefix icp/,$(ICP_OBJS_X86))
zfs-$(CONFIG_X86_64) += $(addprefix icp/,$(ICP_OBJS_X86_64))

$(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64)) : asflags-y += -I$(icp_include)
$(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64)) : ccflags-y += -I$(icp_include)

# Suppress objtool "can't find jump dest instruction at" warnings.  They
# are caused by the constants which are defined in the text section of the
# assembly file using .byte instructions (e.g. bswap_mask).  The objtool
# utility tries to interpret them as opcodes and obviously fails doing so.
OBJECT_FILES_NON_STANDARD_aesni-gcm-x86_64.o := y
OBJECT_FILES_NON_STANDARD_ghash-x86_64.o := y
# Suppress objtool "unsupported stack pointer realignment" warnings. We are
# not using a DRAP register while aligning the stack to a 64 byte boundary.
# See #6950 for the reasoning.
OBJECT_FILES_NON_STANDARD_sha256_impl.o := y
OBJECT_FILES_NON_STANDARD_sha512_impl.o := y


LUA_OBJS := \
	lapi.o \
	lauxlib.o \
	lbaselib.o \
	lcode.o \
	lcompat.o \
	lcorolib.o \
	lctype.o \
	ldebug.o \
	ldo.o \
	lfunc.o \
	lgc.o \
	llex.o \
	lmem.o \
	lobject.o \
	lopcodes.o \
	lparser.o \
	lstate.o \
	lstring.o \
	lstrlib.o \
	ltable.o \
	ltablib.o \
	ltm.o \
	lvm.o \
	lzio.o \
	setjmp/setjmp.o

zfs-objs += $(addprefix lua/,$(LUA_OBJS))


NVPAIR_OBJS := \
	fnvpair.o \
	nvpair.o \
	nvpair_alloc_fixed.o \
	nvpair_alloc_spl.o

zfs-objs += $(addprefix nvpair/,$(NVPAIR_OBJS))


UNICODE_OBJS := \
	u8_textprep.o \
	uconv.o

zfs-objs += $(addprefix unicode/,$(UNICODE_OBJS))


ZCOMMON_OBJS := \
	cityhash.o \
	zfeature_common.o \
	zfs_comutil.o \
	zfs_deleg.o \
	zfs_fletcher.o \
	zfs_fletcher_superscalar.o \
	zfs_fletcher_superscalar4.o \
	zfs_namecheck.o \
	zfs_prop.o \
	zpool_prop.o \
	zprop_common.o

ZCOMMON_OBJS_X86 := \
	zfs_fletcher_avx512.o \
	zfs_fletcher_intel.o \
	zfs_fletcher_sse.o

ZCOMMON_OBJS_ARM64 := \
	zfs_fletcher_aarch64_neon.o

zfs-objs            += $(addprefix zcommon/,$(ZCOMMON_OBJS))
zfs-$(CONFIG_X86)   += $(addprefix zcommon/,$(ZCOMMON_OBJS_X86))
zfs-$(CONFIG_ARM64) += $(addprefix zcommon/,$(ZCOMMON_OBJS_ARM64))


# Zstd uses -O3 by default, so we should follow
ZFS_ZSTD_FLAGS := -O3

# -fno-tree-vectorize gets set for gcc in zstd/common/compiler.h
# Set it for other compilers, too.
ZFS_ZSTD_FLAGS += -fno-tree-vectorize

# SSE register return with SSE disabled if -march=znverX is passed
ZFS_ZSTD_FLAGS += -U__BMI__

# Quiet warnings about frame size due to unused code in unmodified zstd lib
ZFS_ZSTD_FLAGS += -Wframe-larger-than=20480

ZSTD_OBJS := \
	zfs_zstd.o \
	zstd_sparc.o

ZSTD_UPSTREAM_OBJS := \
	lib/common/entropy_common.o \
	lib/common/error_private.o \
	lib/common/fse_decompress.o \
	lib/common/pool.o \
	lib/common/zstd_common.o \
	lib/compress/fse_compress.o \
	lib/compress/hist.o \
	lib/compress/huf_compress.o \
	lib/compress/zstd_compress.o \
	lib/compress/zstd_compress_literals.o \
	lib/compress/zstd_compress_sequences.o \
	lib/compress/zstd_compress_superblock.o \
	lib/compress/zstd_double_fast.o \
	lib/compress/zstd_fast.o \
	lib/compress/zstd_lazy.o \
	lib/compress/zstd_ldm.o \
	lib/compress/zstd_opt.o \
	lib/decompress/huf_decompress.o \
	lib/decompress/zstd_ddict.o \
	lib/decompress/zstd_decompress.o \
	lib/decompress/zstd_decompress_block.o

zfs-objs += $(addprefix zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS))

# Disable aarch64 neon SIMD instructions for kernel mode
$(addprefix $(obj)/zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS)) : ccflags-y += -I$(zstd_include) $(ZFS_ZSTD_FLAGS)
$(addprefix $(obj)/zstd/,$(ZSTD_OBJS) $(ZSTD_UPSTREAM_OBJS)) : asflags-y += -I$(zstd_include)
$(addprefix $(obj)/zstd/,$(ZSTD_UPSTREAM_OBJS)) : ccflags-y += -include $(zstd_include)/aarch64_compat.h -include $(zstd_include)/zstd_compat_wrapper.h -Wp,-w
$(obj)/zstd/zfs_zstd.o : ccflags-y += -include $(zstd_include)/zstd_compat_wrapper.h


ZFS_OBJS := \
	abd.o \
	aggsum.o \
	arc.o \
	blkptr.o \
	bplist.o \
	bpobj.o \
	bptree.o \
	bqueue.o \
	btree.o \
	dataset_kstats.o \
	dbuf.o \
	dbuf_stats.o \
	ddt.o \
	ddt_zap.o \
	dmu.o \
	dmu_diff.o \
	dmu_object.o \
	dmu_objset.o \
	dmu_recv.o \
	dmu_redact.o \
	dmu_send.o \
	dmu_traverse.o \
	dmu_tx.o \
	dmu_zfetch.o \
	dnode.o \
	dnode_sync.o \
	dsl_bookmark.o \
	dsl_crypt.o \
	dsl_dataset.o \
	dsl_deadlist.o \
	dsl_deleg.o \
	dsl_destroy.o \
	dsl_dir.o \
	dsl_pool.o \
	dsl_prop.o \
	dsl_scan.o \
	dsl_synctask.o \
	dsl_userhold.o \
	edonr_zfs.o \
	fm.o \
	gzip.o \
	hkdf.o \
	lz4.o \
	lz4_zfs.o \
	lzjb.o \
	metaslab.o \
	mmp.o \
	multilist.o \
	objlist.o \
	pathname.o \
	range_tree.o \
	refcount.o \
	rrwlock.o \
	sa.o \
	sha256.o \
	skein_zfs.o \
	spa.o \
	spa_boot.o \
	spa_checkpoint.o \
	spa_config.o \
	spa_errlog.o \
	spa_history.o \
	spa_log_spacemap.o \
	spa_misc.o \
	spa_stats.o \
	space_map.o \
	space_reftree.o \
	txg.o \
	uberblock.o \
	unique.o \
	vdev.o \
	vdev_cache.o \
	vdev_draid.o \
	vdev_draid_rand.o \
	vdev_indirect.o \
	vdev_indirect_births.o \
	vdev_indirect_mapping.o \
	vdev_initialize.o \
	vdev_label.o \
	vdev_mirror.o \
	vdev_missing.o \
	vdev_queue.o \
	vdev_raidz.o \
	vdev_raidz_math.o \
	vdev_raidz_math_scalar.o \
	vdev_rebuild.o \
	vdev_removal.o \
	vdev_root.o \
	vdev_trim.o \
	zap.o \
	zap_leaf.o \
	zap_micro.o \
	zcp.o \
	zcp_get.o \
	zcp_global.o \
	zcp_iter.o \
	zcp_set.o \
	zcp_synctask.o \
	zfeature.o \
	zfs_byteswap.o \
	zfs_fm.o \
	zfs_fuid.o \
	zfs_ioctl.o \
	zfs_log.o \
	zfs_onexit.o \
	zfs_quota.o \
	zfs_ratelimit.o \
	zfs_replay.o \
	zfs_rlock.o \
	zfs_sa.o \
	zfs_vnops.o \
	zil.o \
	zio.o \
	zio_checksum.o \
	zio_compress.o \
	zio_inject.o \
	zle.o \
	zrlock.o \
	zthr.o \
	zvol.o

ZFS_OBJS_OS := \
	abd_os.o \
	arc_os.o \
	mmp_os.o \
	policy.o \
	qat.o \
	qat_compress.o \
	qat_crypt.o \
	spa_misc_os.o \
	trace.o \
	vdev_disk.o \
	vdev_file.o \
	zfs_acl.o \
	zfs_ctldir.o \
	zfs_debug.o \
	zfs_dir.o \
	zfs_file_os.o \
	zfs_ioctl_os.o \
	zfs_racct.o \
	zfs_sysfs.o \
	zfs_uio.o \
	zfs_vfsops.o \
	zfs_vnops_os.o \
	zfs_znode.o \
	zio_crypt.o \
	zpl_ctldir.o \
	zpl_export.o \
	zpl_file.o \
	zpl_inode.o \
	zpl_super.o \
	zpl_xattr.o \
	zvol_os.o

ZFS_OBJS_X86 := \
	vdev_raidz_math_avx2.o \
	vdev_raidz_math_avx512bw.o \
	vdev_raidz_math_avx512f.o \
	vdev_raidz_math_sse2.o \
	vdev_raidz_math_ssse3.o

ZFS_OBJS_ARM64 := \
	vdev_raidz_math_aarch64_neon.o \
	vdev_raidz_math_aarch64_neonx2.o

ZFS_OBJS_PPC_PPC64 := \
	vdev_raidz_math_powerpc_altivec.o

zfs-objs            += $(addprefix zfs/,$(ZFS_OBJS)) $(addprefix os/linux/zfs/,$(ZFS_OBJS_OS))
zfs-$(CONFIG_X86)   += $(addprefix zfs/,$(ZFS_OBJS_X86))
zfs-$(CONFIG_ARM64) += $(addprefix zfs/,$(ZFS_OBJS_ARM64))
zfs-$(CONFIG_PPC)   += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))
zfs-$(CONFIG_PPC64) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))

# Suppress incorrect warnings from versions of objtool which are not
# aware of x86 EVEX prefix instructions used for AVX512.
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512bw.o := y
OBJECT_FILES_NON_STANDARD_vdev_raidz_math_avx512f.o := y

ifeq ($(CONFIG_ALTIVEC),y)
$(obj)/zfs/vdev_raidz_math_powerpc_altivec.o : c_flags += -maltivec
endif