Lines Matching +full:real +full:-

1 # SPDX-License-Identifier: GPL-2.0
3 asflags-y += $(EXTRA_AFLAGS)
4 ccflags-y += $(EXTRA_CFLAGS)
5 cppflags-y += $(EXTRA_CPPFLAGS)
6 ldflags-y += $(EXTRA_LDFLAGS)
9 KBUILD_AFLAGS += $(subdir-asflags-y)
10 KBUILD_CFLAGS += $(subdir-ccflags-y)
11 KBUILD_RUSTFLAGS += $(subdir-rustflags-y)
16 # When an object is listed to be built compiled-in and modular,
17 # only build the compiled-in version
18 obj-m := $(filter-out $(obj-y),$(obj-m))
21 # Filter out objects already built-in
22 lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
25 subdir-ym := $(sort $(subdir-y) $(subdir-m) \
26 $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-m))))
29 # - If we encounter foo/ in $(obj-y), replace it by foo/built-in.a and
31 # - If we encounter foo/ in $(obj-m), replace it by foo/modules.order
34 # information about ordering between -y and -m subdirs. Just put -y's first.
36 ifdef need-modorder
37 obj-m := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m))
39 obj-m := $(filter-out %/, $(obj-m))
42 ifdef need-builtin
43 obj-y := $(patsubst %/, %/built-in.a, $(obj-y))
45 obj-y := $(filter-out %/, $(obj-y))
48 # Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
49 suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
51 multi-search = $(sort $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $m)))
53 real-search = $(foreach m, $1, $(if $(call suffix-search, $m, $2, $3 -), $(call suffix-search, $m, …
55 # If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object
56 multi-obj-y := $(call multi-search, $(obj-y), .o, -objs -y)
57 multi-obj-m := $(call multi-search, $(obj-m), .o, -objs -y -m)
58 multi-obj-ym := $(multi-obj-y) $(multi-obj-m)
60 # Replace multi-part objects by their individual parts,
61 # including built-in.a from subdirectories
62 real-obj-y := $(call real-search, $(obj-y), .o, -objs -y)
63 real-obj-m := $(call real-search, $(obj-m), .o, -objs -y -m)
65 always-y += $(always-m)
67 # hostprogs-always-y += foo
70 # always-y += foo
71 hostprogs += $(hostprogs-always-y) $(hostprogs-always-m)
72 always-y += $(hostprogs-always-y) $(hostprogs-always-m)
74 # userprogs-always-y is likewise.
75 userprogs += $(userprogs-always-y) $(userprogs-always-m)
76 always-y += $(userprogs-always-y) $(userprogs-always-m)
81 extra-y := $(addprefix $(obj)/,$(extra-y))
82 always-y := $(addprefix $(obj)/,$(always-y))
84 obj-m := $(addprefix $(obj)/,$(obj-m))
85 lib-y := $(addprefix $(obj)/,$(lib-y))
86 real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
87 real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
88 multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
89 subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
92 # Finds the multi-part object the current object will be linked into.
93 # If the object belongs to two or more multi-part objects, list them all.
94 modname-multi = $(sort $(foreach m,$(multi-obj-ym),\
95 $(if $(filter $*.o, $(call suffix-search, $m, .o, -objs -y -m)),$(m:.o=))))
97 __modname = $(or $(modname-multi),$(basetarget))
103 target-stem = $(basename $(patsubst $(obj)/%,%,$@))
108 name-fix-token = $(subst $(comma),_,$(subst -,_,$1))
109 name-fix = $(call stringify,$(call name-fix-token,$1))
110 basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
111 modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) \
112 -D__KBUILD_MODNAME=kmod_$(call name-fix-token,$(modname))
113 modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile))
115 _c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), \
116 $(filter-out $(ccflags-remove-y), \
117 $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(ccflags-y)) \
118 $(CFLAGS_$(target-stem).o))
119 _rust_flags = $(filter-out $(RUSTFLAGS_REMOVE_$(target-stem).o), \
120 $(filter-out $(rustflags-remove-y), \
121 $(KBUILD_RUSTFLAGS) $(rustflags-y)) \
122 $(RUSTFLAGS_$(target-stem).o))
123 _a_flags = $(filter-out $(AFLAGS_REMOVE_$(target-stem).o), \
124 $(filter-out $(asflags-remove-y), \
125 $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(asflags-y)) \
126 $(AFLAGS_$(target-stem).o))
127 _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds)
136 …$(GCOV_PROFILE_$(target-stem).o)$(GCOV_PROFILE)$(if $(is-kernel-object),$(CONFIG_GCOV_PROFILE_ALL)…
147 $(KASAN_SANITIZE_$(target-stem).o)$(KASAN_SANITIZE)$(is-kernel-object)), \
150 $(KASAN_SANITIZE_$(target-stem).o)$(KASAN_SANITIZE)$(is-kernel-object)), \
157 $(KMSAN_SANITIZE_$(target-stem).o)$(KMSAN_SANITIZE)$(is-kernel-object)), \
160 $(KMSAN_ENABLE_CHECKS_$(target-stem).o)$(KMSAN_ENABLE_CHECKS)$(is-kernel-object)), \
161 , -mllvm -msan-disable-checks=1)
166 $(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SANITIZE)$(is-kernel-object)), \
169 …$(UBSAN_SIGNED_WRAP_$(target-stem).o)$(UBSAN_SANITIZE_$(target-stem).o)$(UBSAN_SIGNED_WRAP)$(UBSAN…
175 …$(KCOV_INSTRUMENT_$(target-stem).o)$(KCOV_INSTRUMENT)$(if $(is-kernel-object),$(CONFIG_KCOV_INSTRU…
185 $(KCSAN_SANITIZE_$(target-stem).o)$(KCSAN_SANITIZE)$(is-kernel-object)), \
190 $(KCSAN_INSTRUMENT_BARRIERS_$(target-stem).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \
191 -D__KCSAN_INSTRUMENT_BARRIERS__)
198 _c_flags += $(addprefix -I, $(src) $(obj))
199 _a_flags += $(addprefix -I, $(src) $(obj))
200 _cpp_flags += $(addprefix -I, $(src) $(obj))
204 # If $(is-kernel-object) is 'y', this object will be linked to vmlinux or modules
205 is-kernel-object = $(or $(part-of-builtin),$(part-of-module))
207 part-of-builtin = $(if $(filter $(basename $@).o, $(real-obj-y) $(lib-y)),y)
208 part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y)
209 quiet_modtag = $(if $(part-of-module),[M], )
212 $(if $(part-of-module), \
217 $(if $(part-of-module), \
221 modkern_aflags = $(if $(part-of-module), \
225 c_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
226 -include $(srctree)/include/linux/compiler_types.h \
232 a_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
235 cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
238 ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
244 objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
245 objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
246 objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
247 objtool-args-$(CONFIG_X86_KERNEL_IBT) += --ibt
248 objtool-args-$(CONFIG_FINEIBT) += --cfi
249 objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
251 objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) += --mnop
253 objtool-args-$(CONFIG_UNWINDER_ORC) += --orc
254 objtool-args-$(CONFIG_MITIGATION_RETPOLINE) += --retpoline
255 objtool-args-$(CONFIG_MITIGATION_RETHUNK) += --rethunk
256 objtool-args-$(CONFIG_MITIGATION_SLS) += --sls
257 objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval
258 objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
259 objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
260 objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
261 objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
263 objtool-args = $(objtool-args-y) \
264 $(if $(delay-objtool), --link) \
265 $(if $(part-of-module), --module)
267 delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT))
269 cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@)
270 cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(…
280 $(addprefix $(obj)/, $(call suffix-search, $(patsubst $(obj)/%,%,$m), $2, $3))))
285 # 'cp' preserves permissions. If you use it to copy a file in read-only srctree,
286 # the copy would be read-only as well, leading to an error when executing the
306 # ---------------------------------------------------------------------------
309 cmd_ld = $(LD) $(ld_flags) $(real-prereqs) -o $@
312 # ---------------------------------------------------------------------------
315 cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
318 # ---------------------------------------------------------------------------
324 # ---------------------------------------------------------------------------
327 cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@
330 # ---------------------------------------------------------------------------
333 # append the size as a 32-bit littleendian number as gzip does.
336 for F in $(real-prereqs); do \
337 fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \
353 cmd_bzip2 = cat $(real-prereqs) | $(KBZIP2) -9 > $@
356 cmd_bzip2_with_size = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@
359 # ---------------------------------------------------------------------------
362 cmd_lzma = cat $(real-prereqs) | $(LZMA) -9 > $@
365 cmd_lzma_with_size = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
368 cmd_lzo = cat $(real-prereqs) | $(KLZOP) -9 > $@
371 cmd_lzo_with_size = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
374 cmd_lz4 = cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout > $@
377 cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
380 # U-Boot mkimage
381 # ---------------------------------------------------------------------------
389 UIMAGE_OPTS-y ?=
393 UIMAGE_NAME ?= Linux-$(KERNELRELEASE)
396 cmd_uimage = $(BASH) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \
397 -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \
398 -T $(UIMAGE_TYPE) \
399 -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \
400 -n '$(UIMAGE_NAME)' -d $< $@
405 # ---------------------------------------------------------------------------
413 cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
414 --name '$(UIMAGE_NAME)' \
415 $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
416 $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
417 --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
420 # ---------------------------------------------------------------------------
437 # big dictionary would increase the memory usage too much in the multi-call
440 cmd_xzkern = cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh > $@
443 cmd_xzkern_with_size = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh; \
447 cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 --lzma2=dict=1MiB > $@
450 # ---------------------------------------------------------------------------
466 cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
469 cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
472 cmd_zstd22_with_size = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@
475 # ---------------------------------------------------------------------------
477 # Default sed regexp - multiline due to syntax constraints
480 # the .ascii directive whereas GCC keeps the <space> as-is.
481 define sed-offsets
483 /^->/{s:->#\(.*\):/* \1 */:; \
484 s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
485 s:->::; p;}'
499 sed -ne $(sed-offsets) < $<; \