Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada:

- Remove potentially incomplete targets when Kbuid is interrupted by
SIGINT etc in case GNU Make may miss to do that when stderr is piped
to another program.

- Rewrite the single target build so it works more correctly.

- Fix rpm-pkg builds with V=1.

- List top-level subdirectories in ./Kbuild.

- Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in
kallsyms.

- Avoid two different modules in lib/zstd/ having shared code, which
potentially causes building the common code as build-in and modular
back-and-forth.

- Unify two modpost invocations to optimize the build process.

- Remove head-y syntax in favor of linker scripts for placing
particular sections in the head of vmlinux.

- Bump the minimal GNU Make version to 3.82.

- Clean up misc Makefiles and scripts.

* tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits)
docs: bump minimal GNU Make version to 3.82
ia64: simplify esi object addition in Makefile
Revert "kbuild: Check if linker supports the -X option"
kbuild: rebuild .vmlinux.export.o when its prerequisite is updated
kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o
zstd: Fixing mixed module-builtin objects
kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols
kallsyms: take the input file instead of reading stdin
kallsyms: drop duplicated ignore patterns from kallsyms.c
kbuild: reuse mksysmap output for kallsyms
mksysmap: update comment about __crc_*
kbuild: remove head-y syntax
kbuild: use obj-y instead extra-y for objects placed at the head
kbuild: hide error checker logs for V=1 builds
kbuild: re-run modpost when it is updated
kbuild: unify two modpost invocations
kbuild: move vmlinux.o rule to the top Makefile
kbuild: move .vmlinux.objs rule to Makefile.modpost
kbuild: list sub-directories in ./Kbuild
Makefile.compiler: replace cc-ifversion with compiler-specific macros
...

+723 -757
+23 -33
Documentation/kbuild/makefiles.rst
··· 341 341 342 342 Examples are: 343 343 344 - 1) head objects 345 - 346 - Some objects must be placed at the head of vmlinux. They are 347 - directly linked to vmlinux without going through built-in.a 348 - A typical use-case is an object that contains the entry point. 349 - 350 - arch/$(SRCARCH)/Makefile should specify such objects as head-y. 351 - 352 - Discussion: 353 - Given that we can control the section order in the linker script, 354 - why do we need head-y? 355 - 356 - 2) vmlinux linker script 344 + 1) vmlinux linker script 357 345 358 346 The linker script for vmlinux is located at 359 347 arch/$(SRCARCH)/kernel/vmlinux.lds ··· 349 361 Example:: 350 362 351 363 # arch/x86/kernel/Makefile 352 - extra-y := head_$(BITS).o 353 - extra-y += head$(BITS).o 354 - extra-y += ebda.o 355 - extra-y += platform-quirks.o 356 364 extra-y += vmlinux.lds 357 365 358 366 $(extra-y) should only contain targets needed for vmlinux. ··· 667 683 In the above example, -Wno-unused-but-set-variable will be added to 668 684 KBUILD_CFLAGS only if gcc really accepts it. 669 685 670 - cc-ifversion 671 - cc-ifversion tests the version of $(CC) and equals the fourth parameter 672 - if version expression is true, or the fifth (if given) if the version 673 - expression is false. 686 + gcc-min-version 687 + gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than 688 + or equal to the provided value and evaluates to y if so. 674 689 675 690 Example:: 676 691 677 - #fs/reiserfs/Makefile 678 - ccflags-y := $(call cc-ifversion, -lt, 0402, -O1) 692 + cflags-$(call gcc-min-version, 70100) := -foo 679 693 680 - In this example, ccflags-y will be assigned the value -O1 if the 681 - $(CC) version is less than 4.2. 682 - cc-ifversion takes all the shell operators: 683 - -eq, -ne, -lt, -le, -gt, and -ge 684 - The third parameter may be a text as in this example, but it may also 685 - be an expanded variable or a macro. 694 + In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and 695 + $(CONFIG_GCC_VERSION) is >= 7.1. 696 + 697 + clang-min-version 698 + clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater 699 + than or equal to the provided value and evaluates to y if so. 700 + 701 + Example:: 702 + 703 + cflags-$(call clang-min-version, 110000) := -foo 704 + 705 + In this example, cflags-y will be assigned the value -foo if $(CC) is clang 706 + and $(CONFIG_CLANG_VERSION) is >= 11.0.0. 686 707 687 708 cc-cross-prefix 688 709 cc-cross-prefix is used to check if there exists a $(CC) in path with ··· 1088 1099 - The values of the above variables are expanded in arch/$(SRCARCH)/Makefile. 1089 1100 5) All object files are then linked and the resulting file vmlinux is 1090 1101 located at the root of the obj tree. 1091 - The very first objects linked are listed in head-y, assigned by 1092 - arch/$(SRCARCH)/Makefile. 1102 + The very first objects linked are listed in scripts/head-object-list.txt. 1093 1103 6) Finally, the architecture-specific part does any required post processing 1094 1104 and builds the final bootimage. 1095 1105 - This includes building boot records ··· 1260 1272 All object files for vmlinux. They are linked to vmlinux in the same 1261 1273 order as listed in KBUILD_VMLINUX_OBJS. 1262 1274 1275 + The objects listed in scripts/head-object-list.txt are exceptions; 1276 + they are placed before the other objects. 1277 + 1263 1278 KBUILD_VMLINUX_LIBS 1264 1279 1265 1280 All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and ··· 1306 1315 machinery is all architecture-independent. 1307 1316 1308 1317 1309 - head-y, core-y, libs-y, drivers-y 1310 - $(head-y) lists objects to be linked first in vmlinux. 1318 + core-y, libs-y, drivers-y 1311 1319 1312 1320 $(libs-y) lists directories where a lib.a archive can be located. 1313 1321
+2 -2
Documentation/process/changes.rst
··· 33 33 Clang/LLVM (optional) 11.0.0 clang --version 34 34 Rust (optional) 1.62.0 rustc --version 35 35 bindgen (optional) 0.56.0 bindgen --version 36 - GNU make 3.81 make --version 36 + GNU make 3.82 make --version 37 37 bash 4.2 bash --version 38 38 binutils 2.23 ld -v 39 39 flex 2.5.35 flex --version ··· 108 108 Make 109 109 ---- 110 110 111 - You will need GNU make 3.81 or later to build the kernel. 111 + You will need GNU make 3.82 or later to build the kernel. 112 112 113 113 Bash 114 114 ----
+56 -16
Kbuild
··· 2 2 # 3 3 # Kbuild for top-level directory of the kernel 4 4 5 - ##### 5 + # Prepare global headers and check sanity before descending into sub-directories 6 + # --------------------------------------------------------------------------- 7 + 6 8 # Generate bounds.h 7 9 8 10 bounds-file := include/generated/bounds.h 9 11 10 - always-y := $(bounds-file) 11 12 targets := kernel/bounds.s 12 13 13 14 $(bounds-file): kernel/bounds.s FORCE 14 15 $(call filechk,offsets,__LINUX_BOUNDS_H__) 15 16 16 - ##### 17 17 # Generate timeconst.h 18 18 19 19 timeconst-file := include/generated/timeconst.h ··· 23 23 $(timeconst-file): kernel/time/timeconst.bc FORCE 24 24 $(call filechk,gentimeconst) 25 25 26 - ##### 27 26 # Generate asm-offsets.h 28 27 29 28 offsets-file := include/generated/asm-offsets.h 30 29 31 - always-y += $(offsets-file) 32 30 targets += arch/$(SRCARCH)/kernel/asm-offsets.s 33 31 34 32 arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) ··· 34 36 $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE 35 37 $(call filechk,offsets,__ASM_OFFSETS_H__) 36 38 37 - ##### 38 39 # Check for missing system calls 39 - 40 - always-y += missing-syscalls 41 40 42 41 quiet_cmd_syscalls = CALL $< 43 42 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) 44 43 45 - missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE 44 + PHONY += missing-syscalls 45 + missing-syscalls: scripts/checksyscalls.sh $(offsets-file) 46 46 $(call cmd,syscalls) 47 47 48 - ##### 49 - # Check atomic headers are up-to-date 48 + # Check the manual modification of atomic headers 50 49 51 - always-y += old-atomics 50 + quiet_cmd_check_sha1 = CHKSHA1 $< 51 + cmd_check_sha1 = \ 52 + if ! command -v sha1sum >/dev/null; then \ 53 + echo "warning: cannot check the header due to sha1sum missing"; \ 54 + exit 0; \ 55 + fi; \ 56 + if [ "$$(sed -n '$$s:// ::p' $<)" != \ 57 + "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \ 58 + echo "error: $< has been modified." >&2; \ 59 + exit 1; \ 60 + fi; \ 61 + touch $@ 52 62 53 - quiet_cmd_atomics = CALL $< 54 - cmd_atomics = $(CONFIG_SHELL) $< 63 + atomic-checks += $(addprefix $(obj)/.checked-, \ 64 + atomic-arch-fallback.h \ 65 + atomic-instrumented.h \ 66 + atomic-long.h) 55 67 56 - old-atomics: scripts/atomic/check-atomics.sh FORCE 57 - $(call cmd,atomics) 68 + targets += $(atomic-checks) 69 + $(atomic-checks): $(obj)/.checked-%: include/linux/atomic/% FORCE 70 + $(call if_changed,check_sha1) 71 + 72 + # A phony target that depends on all the preparation targets 73 + 74 + PHONY += prepare 75 + prepare: $(offsets-file) missing-syscalls $(atomic-checks) 76 + @: 77 + 78 + # Ordinary directory descending 79 + # --------------------------------------------------------------------------- 80 + 81 + obj-y += init/ 82 + obj-y += usr/ 83 + obj-y += arch/$(SRCARCH)/ 84 + obj-y += $(ARCH_CORE) 85 + obj-y += kernel/ 86 + obj-y += certs/ 87 + obj-y += mm/ 88 + obj-y += fs/ 89 + obj-y += ipc/ 90 + obj-y += security/ 91 + obj-y += crypto/ 92 + obj-$(CONFIG_BLOCK) += block/ 93 + obj-$(CONFIG_IO_URING) += io_uring/ 94 + obj-$(CONFIG_RUST) += rust/ 95 + obj-y += $(ARCH_LIB) 96 + obj-y += drivers/ 97 + obj-y += sound/ 98 + obj-$(CONFIG_SAMPLES) += samples/ 99 + obj-$(CONFIG_NET) += net/ 100 + obj-y += virt/ 101 + obj-y += $(ARCH_DRIVERS)
+86 -98
Makefile
··· 538 538 CFLAGS_KERNEL = 539 539 RUSTFLAGS_KERNEL = 540 540 AFLAGS_KERNEL = 541 - LDFLAGS_vmlinux = 541 + export LDFLAGS_vmlinux = 542 542 543 543 # Use USERINCLUDE when you must reference the UAPI directories only. 544 544 USERINCLUDE := \ ··· 648 648 } > Makefile 649 649 650 650 outputmakefile: 651 - $(Q)if [ -f $(srctree)/.config -o \ 651 + @if [ -f $(srctree)/.config -o \ 652 652 -d $(srctree)/include/config -o \ 653 653 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ 654 654 echo >&2 "***"; \ ··· 710 710 __all: modules 711 711 endif 712 712 713 + targets := 714 + 713 715 # Decide whether to build built-in, modular, or both. 714 716 # Normally, just do built-in. 715 717 ··· 743 741 744 742 ifeq ($(KBUILD_EXTMOD),) 745 743 # Objects we will link into vmlinux / subdirs we need to visit 746 - core-y := init/ usr/ arch/$(SRCARCH)/ 747 - drivers-y := drivers/ sound/ 748 - drivers-$(CONFIG_SAMPLES) += samples/ 749 - drivers-$(CONFIG_NET) += net/ 750 - drivers-y += virt/ 744 + core-y := 745 + drivers-y := 751 746 libs-y := lib/ 752 747 endif # KBUILD_EXTMOD 753 748 ··· 803 804 PHONY += include/config/auto.conf 804 805 805 806 include/config/auto.conf: 806 - $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ 807 + @test -e include/generated/autoconf.h -a -e $@ || ( \ 807 808 echo >&2; \ 808 809 echo >&2 " ERROR: Kernel configuration is invalid."; \ 809 810 echo >&2 " include/generated/autoconf.h or $@ are missing.";\ ··· 861 862 862 863 KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror 863 864 KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds 864 - KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) 865 865 866 866 KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings 867 867 KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y) ··· 1039 1041 KBUILD_CFLAGS += -Wno-maybe-uninitialized 1040 1042 endif 1041 1043 1042 - ifdef CONFIG_CC_IS_GCC 1043 1044 # The allocators already balk at large sizes, so silence the compiler 1044 1045 # warnings for bounds checks involving those possible values. While 1045 1046 # -Wno-alloc-size-larger-than would normally be used here, earlier versions ··· 1050 1053 # ignored, continuing to default to PTRDIFF_MAX. So, left with no other 1051 1054 # choice, we must perform a versioned check to disable this warning. 1052 1055 # https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au 1053 - KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0901, -Wno-alloc-size-larger-than) 1054 - endif 1056 + KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than 1057 + KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) 1055 1058 1056 1059 # disable invalid "can't wrap" optimizations for signed / pointers 1057 1060 KBUILD_CFLAGS += -fno-strict-overflow ··· 1107 1110 endif 1108 1111 1109 1112 ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 1110 - LDFLAGS_vmlinux += $(call ld-option, -X,) 1113 + LDFLAGS_vmlinux += -X 1111 1114 endif 1112 1115 1113 1116 ifeq ($(CONFIG_RELR),y) ··· 1168 1171 export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps 1169 1172 1170 1173 ifeq ($(KBUILD_EXTMOD),) 1171 - core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ 1172 - core-$(CONFIG_BLOCK) += block/ 1173 - core-$(CONFIG_IO_URING) += io_uring/ 1174 - core-$(CONFIG_RUST) += rust/ 1175 1174 1176 - vmlinux-dirs := $(patsubst %/,%,$(filter %/, \ 1177 - $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 1178 - $(libs-y) $(libs-m))) 1179 - 1180 - vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \ 1175 + build-dir := . 1176 + clean-dirs := $(sort . Documentation \ 1181 1177 $(patsubst %/,%,$(filter %/, $(core-) \ 1182 1178 $(drivers-) $(libs-)))) 1183 1179 1184 - build-dirs := $(vmlinux-dirs) 1185 - clean-dirs := $(vmlinux-alldirs) 1186 - 1187 - subdir-modorder := $(addsuffix /modules.order, $(build-dirs)) 1188 - 1180 + export ARCH_CORE := $(core-y) 1181 + export ARCH_LIB := $(filter %/, $(libs-y)) 1182 + export ARCH_DRIVERS := $(drivers-y) $(drivers-m) 1189 1183 # Externally visible symbols (used by link-vmlinux.sh) 1190 - KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y)) 1191 - KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y))) 1184 + 1185 + KBUILD_VMLINUX_OBJS := ./built-in.a 1192 1186 ifdef CONFIG_MODULES 1193 1187 KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y))) 1194 1188 KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y)) 1195 1189 else 1196 1190 KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y)) 1197 1191 endif 1198 - KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y)) 1199 1192 1200 - export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS 1193 + export KBUILD_VMLINUX_LIBS 1201 1194 export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds 1202 - # used by scripts/Makefile.package 1203 - export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools) 1204 - 1205 - vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) 1206 1195 1207 1196 # Recurse until adjust_autoksyms.sh is satisfied 1208 1197 PHONY += autoksyms_recursive ··· 1198 1215 # (this can be evaluated only once include/config/auto.conf has been included) 1199 1216 KBUILD_MODULES := 1 1200 1217 1201 - autoksyms_recursive: descend modules.order 1218 + autoksyms_recursive: $(build-dir) modules.order 1202 1219 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ 1203 1220 "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive" 1204 1221 endif ··· 1212 1229 $(autoksyms_h): 1213 1230 $(call cmd,autoksyms_h) 1214 1231 1215 - ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) 1232 + # '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14 1233 + quiet_cmd_ar_vmlinux.a = AR $@ 1234 + cmd_ar_vmlinux.a = \ 1235 + rm -f $@; \ 1236 + $(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \ 1237 + $(AR) mPiT $$($(AR) t $@ | head -n1) $@ $$($(AR) t $@ | grep -F --file=$(srctree)/scripts/head-object-list.txt) 1216 1238 1217 - # Final link of vmlinux with optional arch pass after final link 1218 - cmd_link-vmlinux = \ 1219 - $(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ 1220 - $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1239 + targets += vmlinux.a 1240 + vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt autoksyms_recursive FORCE 1241 + $(call if_changed,ar_vmlinux.a) 1221 1242 1222 - vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE 1223 - +$(call if_changed_dep,link-vmlinux) 1243 + PHONY += vmlinux_o 1244 + vmlinux_o: vmlinux.a $(KBUILD_VMLINUX_LIBS) 1245 + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o 1224 1246 1225 - targets := vmlinux 1247 + vmlinux.o modules.builtin.modinfo modules.builtin: vmlinux_o 1248 + @: 1249 + 1250 + PHONY += vmlinux 1251 + vmlinux: vmlinux.o $(KBUILD_LDS) modpost 1252 + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux 1226 1253 1227 1254 # The actual objects are generated when descending, 1228 1255 # make sure no implicit rule kicks in 1229 - $(sort $(vmlinux-deps) $(subdir-modorder)): descend ; 1256 + $(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ; 1230 1257 1231 1258 filechk_kernel.release = \ 1232 1259 echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" ··· 1262 1269 1263 1270 archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ 1264 1271 asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ 1265 - include/generated/autoconf.h remove-stale-files 1272 + include/generated/compile.h include/generated/autoconf.h remove-stale-files 1266 1273 1267 1274 prepare0: archprepare 1268 1275 $(Q)$(MAKE) $(build)=scripts/mod 1269 - $(Q)$(MAKE) $(build)=. 1276 + $(Q)$(MAKE) $(build)=. prepare 1270 1277 1271 1278 # All the preparing.. 1272 1279 prepare: prepare0 ··· 1327 1334 1328 1335 include/generated/utsrelease.h: include/config/kernel.release FORCE 1329 1336 $(call filechk,utsrelease.h) 1337 + 1338 + filechk_compile.h = $(srctree)/scripts/mkcompile_h \ 1339 + "$(UTS_MACHINE)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)" 1340 + 1341 + include/generated/compile.h: FORCE 1342 + $(call filechk,compile.h) 1330 1343 1331 1344 PHONY += headerdep 1332 1345 headerdep: ··· 1508 1509 1509 1510 # Build modules 1510 1511 # 1511 - # A module can be listed more than once in obj-m resulting in 1512 - # duplicate lines in modules.order files. Those are removed 1513 - # using awk while concatenating to the final file. 1514 1512 1515 - PHONY += modules 1516 - modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare 1513 + # *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES 1514 + # is an exception. 1515 + ifdef CONFIG_DEBUG_INFO_BTF_MODULES 1516 + modules: vmlinux 1517 + endif 1517 1518 1518 - cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@ 1519 - 1520 - modules.order: $(subdir-modorder) FORCE 1521 - $(call if_changed,modules_order) 1522 - 1523 - targets += modules.order 1519 + modules: modules_prepare 1524 1520 1525 1521 # Target to prepare building external modules 1526 - PHONY += modules_prepare 1527 1522 modules_prepare: prepare 1528 1523 $(Q)$(MAKE) $(build)=scripts scripts/module.lds 1529 1524 ··· 1567 1574 # Directories & files removed with 'make clean' 1568 1575 CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \ 1569 1576 modules.builtin modules.builtin.modinfo modules.nsdeps \ 1570 - compile_commands.json .thinlto-cache rust/test rust/doc 1577 + compile_commands.json .thinlto-cache rust/test rust/doc \ 1578 + .vmlinux.objs .vmlinux.export.c 1571 1579 1572 1580 # Directories & files removed with 'make mrproper' 1573 1581 MRPROPER_FILES += include/config include/generated \ ··· 1856 1862 KBUILD_BUILTIN := 1857 1863 KBUILD_MODULES := 1 1858 1864 1859 - build-dirs := $(KBUILD_EXTMOD) 1860 - $(MODORDER): descend 1861 - @: 1865 + build-dir := $(KBUILD_EXTMOD) 1862 1866 1863 1867 compile_commands.json: $(extmod_prefix)compile_commands.json 1864 1868 PHONY += compile_commands.json ··· 1885 1893 @echo ' clean - remove generated files in module directory only' 1886 1894 @echo '' 1887 1895 1888 - # no-op for external module builds 1889 - PHONY += modules_prepare 1890 - 1891 1896 endif # KBUILD_EXTMOD 1892 1897 1893 1898 # --------------------------------------------------------------------------- 1894 1899 # Modules 1895 1900 1896 - PHONY += modules modules_install 1901 + PHONY += modules modules_install modules_prepare 1897 1902 1898 1903 ifdef CONFIG_MODULES 1899 1904 1900 - modules: modules_check 1901 - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1905 + $(MODORDER): $(build-dir) 1906 + @: 1907 + 1908 + # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. 1909 + # This is solely useful to speed up test compiles. 1910 + modules: modpost 1911 + ifneq ($(KBUILD_MODPOST_NOFINAL),1) 1912 + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal 1913 + endif 1902 1914 1903 1915 PHONY += modules_check 1904 1916 modules_check: $(MODORDER) ··· 1929 1933 @echo >&2 '***' 1930 1934 @exit 1 1931 1935 1936 + KBUILD_MODULES := 1937 + 1932 1938 endif # CONFIG_MODULES 1939 + 1940 + PHONY += modpost 1941 + modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \ 1942 + $(if $(KBUILD_MODULES), modules_check) 1943 + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1933 1944 1934 1945 # Single targets 1935 1946 # --------------------------------------------------------------------------- ··· 1957 1954 single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \ 1958 1955 $(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko))) 1959 1956 1960 - $(single-ko): single_modpost 1957 + $(single-ko): single_modules 1961 1958 @: 1962 - $(single-no-ko): descend 1959 + $(single-no-ko): $(build-dir) 1963 1960 @: 1964 1961 1965 - ifeq ($(KBUILD_EXTMOD),) 1966 - # For the single build of in-tree modules, use a temporary file to avoid 1967 - # the situation of modules_install installing an invalid modules.order. 1968 - MODORDER := .modules.tmp 1969 - endif 1970 - 1971 - PHONY += single_modpost 1972 - single_modpost: $(single-no-ko) modules_prepare 1962 + # Remove MODORDER when done because it is not the real one. 1963 + PHONY += single_modules 1964 + single_modules: $(single-no-ko) modules_prepare 1973 1965 $(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER) 1974 1966 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1967 + ifneq ($(KBUILD_MODPOST_NOFINAL),1) 1968 + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal 1969 + endif 1970 + $(Q)rm -f $(MODORDER) 1975 1971 1976 - KBUILD_MODULES := 1 1977 - 1978 - export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod_prefix), $(single-no-ko)) 1979 - 1980 - # trim unrelated directories 1981 - build-dirs := $(foreach d, $(build-dirs), \ 1982 - $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d))) 1972 + single-goals := $(addprefix $(build-dir)/, $(single-no-ko)) 1983 1973 1984 1974 endif 1985 1975 1986 - ifndef CONFIG_MODULES 1987 - KBUILD_MODULES := 1988 - endif 1989 - 1990 - # Handle descending into subdirectories listed in $(build-dirs) 1991 1976 # Preset locale variables to speed up the build process. Limit locale 1992 1977 # tweaks to this spot to avoid wrong language settings when running 1993 1978 # make menuconfig etc. 1994 1979 # Error messages still appears in the original language 1995 - PHONY += descend $(build-dirs) 1996 - descend: $(build-dirs) 1997 - $(build-dirs): prepare 1998 - $(Q)$(MAKE) $(build)=$@ \ 1999 - single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \ 2000 - need-builtin=1 need-modorder=1 1980 + PHONY += $(build-dir) 1981 + $(build-dir): prepare 1982 + $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 $(single-goals) 2001 1983 2002 1984 clean-dirs := $(addprefix _clean_, $(clean-dirs)) 2003 1985 PHONY += $(clean-dirs) clean ··· 2030 2042 cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs)) 2031 2043 2032 2044 $(extmod_prefix)compile_commands.json: scripts/clang-tools/gen_compile_commands.py \ 2033 - $(if $(KBUILD_EXTMOD),,$(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)) \ 2045 + $(if $(KBUILD_EXTMOD),, vmlinux.a $(KBUILD_VMLINUX_LIBS)) \ 2034 2046 $(if $(CONFIG_MODULES), $(MODORDER)) FORCE 2035 2047 $(call if_changed,gen_compile_commands) 2036 2048
-2
arch/alpha/Makefile
··· 36 36 # BWX is most important, but we don't really want any emulation ever. 37 37 KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6 38 38 39 - head-y := arch/alpha/kernel/head.o 40 - 41 39 libs-y += arch/alpha/lib/ 42 40 43 41 # export what is needed by arch/alpha/boot/Makefile
+2 -2
arch/alpha/kernel/Makefile
··· 3 3 # Makefile for the linux kernel. 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 asflags-y := $(KBUILD_CFLAGS) 8 8 ccflags-y := -Wno-sign-compare 9 9 10 - obj-y := entry.o traps.o process.o osf_sys.o irq.o \ 10 + obj-y := head.o entry.o traps.o process.o osf_sys.o irq.o \ 11 11 irq_alpha.o signal.o setup.o ptrace.o time.o \ 12 12 systbls.o err_common.o io.o bugs.o termios.o 13 13
-2
arch/arc/Makefile
··· 82 82 KBUILD_AFLAGS += $(KBUILD_CFLAGS) 83 83 KBUILD_LDFLAGS += $(ldflags-y) 84 84 85 - head-y := arch/arc/kernel/head.o 86 - 87 85 # w/o this dtb won't embed into kernel binary 88 86 core-y += arch/arc/boot/dts/ 89 87
+2 -2
arch/arc/kernel/Makefile
··· 3 3 # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4 4 # 5 5 6 - obj-y := arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o 6 + obj-y := head.o arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o 7 7 obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o 8 8 obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o 9 9 obj-$(CONFIG_ISA_ARCV2) += entry-arcv2.o intc-arcv2.o ··· 31 31 obj-y += ctx_sw_asm.o 32 32 endif 33 33 34 - extra-y := vmlinux.lds head.o 34 + extra-y := vmlinux.lds
-3
arch/arm/Makefile
··· 137 137 138 138 CHECKFLAGS += -D__arm__ 139 139 140 - #Default value 141 - head-y := arch/arm/kernel/head$(MMUEXT).o 142 - 143 140 # Text offset. This list is sorted numerically by address in order to 144 141 # provide a means to avoid/resolve conflicts in multi-arch kernels. 145 142 # Note: the 32kB below this value is reserved for use by the kernel
+2 -2
arch/arm/kernel/Makefile
··· 88 88 obj-$(CONFIG_EFI) += efi.o 89 89 obj-$(CONFIG_PARAVIRT) += paravirt.o 90 90 91 - head-y := head$(MMUEXT).o 91 + obj-y += head$(MMUEXT).o 92 92 obj-$(CONFIG_DEBUG_LL) += debug.o 93 93 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 94 94 obj-$(CONFIG_ARM_PATCH_PHYS_VIRT) += phys2virt.o ··· 108 108 109 109 obj-$(CONFIG_GENERIC_CPU_VULNERABILITIES) += spectre.o 110 110 111 - extra-y := $(head-y) vmlinux.lds 111 + extra-y := vmlinux.lds
-3
arch/arm64/Makefile
··· 133 133 CC_FLAGS_FTRACE := -fpatchable-function-entry=2 134 134 endif 135 135 136 - # Default value 137 - head-y := arch/arm64/kernel/head.o 138 - 139 136 ifeq ($(CONFIG_KASAN_SW_TAGS), y) 140 137 KASAN_SHADOW_SCALE_SHIFT := 4 141 138 else ifeq ($(CONFIG_KASAN_GENERIC), y)
+2 -2
arch/arm64/kernel/Makefile
··· 86 86 $(obj)/vdso32-wrap.o: $(obj)/vdso32/vdso.so 87 87 88 88 obj-y += probes/ 89 - head-y := head.o 90 - extra-y += $(head-y) vmlinux.lds 89 + obj-y += head.o 90 + extra-y += vmlinux.lds 91 91 92 92 ifeq ($(CONFIG_DEBUG_EFI),y) 93 93 AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\""
-2
arch/csky/Makefile
··· 59 59 60 60 KBUILD_AFLAGS += $(KBUILD_CFLAGS) 61 61 62 - head-y := arch/csky/kernel/head.o 63 - 64 62 core-y += arch/csky/$(CSKYABI)/ 65 63 66 64 libs-y += arch/csky/lib/ \
+2 -2
arch/csky/kernel/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - extra-y := head.o vmlinux.lds 2 + extra-y := vmlinux.lds 3 3 4 - obj-y += entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/ 4 + obj-y += head.o entry.o atomic.o signal.o traps.o irq.o time.o vdso.o vdso/ 5 5 obj-y += power.o syscall.o syscall_table.o setup.o io.o 6 6 obj-y += process.o cpu-probe.o ptrace.o stacktrace.o 7 7 obj-y += probes/
-2
arch/hexagon/Makefile
··· 32 32 TIR_NAME := r19 33 33 KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__ 34 34 KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME) 35 - 36 - head-y := arch/hexagon/kernel/head.o
+2 -1
arch/hexagon/kernel/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - extra-y := head.o vmlinux.lds 2 + extra-y := vmlinux.lds 3 3 4 + obj-y += head.o 4 5 obj-$(CONFIG_SMP) += smp.o 5 6 6 7 obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o
-1
arch/ia64/Makefile
··· 44 44 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ 45 45 46 46 KBUILD_CFLAGS += $(cflags-y) 47 - head-y := arch/ia64/kernel/head.o 48 47 49 48 libs-y += arch/ia64/lib/ 50 49
+3 -6
arch/ia64/kernel/Makefile
··· 7 7 CFLAGS_REMOVE_ftrace.o = -pg 8 8 endif 9 9 10 - extra-y := head.o vmlinux.lds 10 + extra-y := vmlinux.lds 11 11 12 - obj-y := entry.o efi.o efi_stub.o gate-data.o fsys.o irq.o irq_ia64.o \ 12 + obj-y := head.o entry.o efi.o efi_stub.o gate-data.o fsys.o irq.o irq_ia64.o \ 13 13 irq_lsapic.o ivt.o pal.o patch.o process.o ptrace.o sal.o \ 14 14 salinfo.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \ 15 15 unwind.o mca.o mca_asm.o topology.o dma-mapping.o iosapic.o acpi.o \ ··· 34 34 obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o 35 35 obj-$(CONFIG_STACKTRACE) += stacktrace.o 36 36 37 - obj-$(CONFIG_IA64_ESI) += esi.o 38 - ifneq ($(CONFIG_IA64_ESI),) 39 - obj-y += esi_stub.o # must be in kernel proper 40 - endif 37 + obj-$(CONFIG_IA64_ESI) += esi.o esi_stub.o # must be in kernel proper 41 38 obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o 42 39 43 40 obj-$(CONFIG_ELF_CORE) += elfcore.o
-2
arch/loongarch/Makefile
··· 79 79 sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') 80 80 endif 81 81 82 - head-y := arch/loongarch/kernel/head.o 83 - 84 82 libs-y += arch/loongarch/lib/ 85 83 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a 86 84
+2 -2
arch/loongarch/kernel/Makefile
··· 3 3 # Makefile for the Linux/LoongArch kernel. 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 - obj-y += cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ 8 + obj-y += head.o cpu-probe.o cacheinfo.o env.o setup.o entry.o genex.o \ 9 9 traps.o irq.o idle.o process.o dma.o mem.o io.o reset.o switch.o \ 10 10 elf.o syscall.o signal.o time.o topology.o inst.o ptrace.o vdso.o 11 11
+1 -1
arch/m68k/68000/Makefile
··· 17 17 obj-$(CONFIG_UCSIMM) += ucsimm.o 18 18 obj-$(CONFIG_UCDIMM) += ucsimm.o 19 19 20 - extra-y := head.o 20 + obj-y += head.o
-9
arch/m68k/Makefile
··· 86 86 KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g 87 87 endif 88 88 89 - # 90 - # Select the assembler head startup code. Order is important. The default 91 - # head code is first, processor specific selections can override it after. 92 - # 93 - head-y := arch/m68k/kernel/head.o 94 - head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o 95 - head-$(CONFIG_M68000) := arch/m68k/68000/head.o 96 - head-$(CONFIG_COLDFIRE) := arch/m68k/coldfire/head.o 97 - 98 89 libs-y += arch/m68k/lib/ 99 90 100 91
+1 -1
arch/m68k/coldfire/Makefile
··· 45 45 obj-$(CONFIG_PCI) += pci.o 46 46 47 47 obj-y += gpio.o 48 - extra-y := head.o 48 + obj-y += head.o
+12 -11
arch/m68k/kernel/Makefile
··· 3 3 # Makefile for the linux kernel. 4 4 # 5 5 6 - extra-$(CONFIG_AMIGA) := head.o 7 - extra-$(CONFIG_ATARI) := head.o 8 - extra-$(CONFIG_MAC) := head.o 9 - extra-$(CONFIG_APOLLO) := head.o 10 - extra-$(CONFIG_VME) := head.o 11 - extra-$(CONFIG_HP300) := head.o 12 - extra-$(CONFIG_Q40) := head.o 13 - extra-$(CONFIG_SUN3X) := head.o 14 - extra-$(CONFIG_VIRT) := head.o 15 - extra-$(CONFIG_SUN3) := sun3-head.o 16 6 extra-y += vmlinux.lds 17 7 18 - obj-y := entry.o irq.o module.o process.o ptrace.o 8 + obj-$(CONFIG_AMIGA) := head.o 9 + obj-$(CONFIG_ATARI) := head.o 10 + obj-$(CONFIG_MAC) := head.o 11 + obj-$(CONFIG_APOLLO) := head.o 12 + obj-$(CONFIG_VME) := head.o 13 + obj-$(CONFIG_HP300) := head.o 14 + obj-$(CONFIG_Q40) := head.o 15 + obj-$(CONFIG_SUN3X) := head.o 16 + obj-$(CONFIG_VIRT) := head.o 17 + obj-$(CONFIG_SUN3) := sun3-head.o 18 + 19 + obj-y += entry.o irq.o module.o process.o ptrace.o 19 20 obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o 20 21 21 22 obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
-1
arch/microblaze/Makefile
··· 48 48 # r31 holds current when in kernel mode 49 49 KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2) 50 50 51 - head-y := arch/microblaze/kernel/head.o 52 51 libs-y += arch/microblaze/lib/ 53 52 54 53 boot := arch/microblaze/boot
+2 -2
arch/microblaze/kernel/Makefile
··· 12 12 CFLAGS_REMOVE_process.o = -pg 13 13 endif 14 14 15 - extra-y := head.o vmlinux.lds 15 + extra-y := vmlinux.lds 16 16 17 - obj-y += dma.o exceptions.o \ 17 + obj-y += head.o dma.o exceptions.o \ 18 18 hw_exception_handler.o irq.o \ 19 19 process.o prom.o ptrace.o \ 20 20 reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
-2
arch/mips/Makefile
··· 324 324 325 325 OBJCOPYFLAGS += --remove-section=.reginfo 326 326 327 - head-y := arch/mips/kernel/head.o 328 - 329 327 libs-y += arch/mips/lib/ 330 328 libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/ 331 329
+2 -2
arch/mips/kernel/Makefile
··· 3 3 # Makefile for the Linux/MIPS kernel. 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 - obj-y += branch.o cmpxchg.o elf.o entry.o genex.o idle.o irq.o \ 8 + obj-y += head.o branch.o cmpxchg.o elf.o entry.o genex.o idle.o irq.o \ 9 9 process.o prom.o ptrace.o reset.o setup.o signal.o \ 10 10 syscall.o time.o topology.o traps.o unaligned.o watch.o \ 11 11 vdso.o cacheinfo.o
+2
arch/nios2/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 + obj-y += kernel/ mm/ platform/ boot/dts/ 4 + 3 5 # for cleaning 4 6 subdir- += boot
-5
arch/nios2/Makefile
··· 37 37 KBUILD_CFLAGS += -fno-builtin 38 38 KBUILD_CFLAGS += -G 0 39 39 40 - head-y := arch/nios2/kernel/head.o 41 40 libs-y += arch/nios2/lib/ $(LIBGCC) 42 - core-y += arch/nios2/kernel/ arch/nios2/mm/ 43 - core-y += arch/nios2/platform/ 44 41 45 42 INSTALL_PATH ?= /tftpboot 46 43 nios2-boot := arch/$(ARCH)/boot 47 44 BOOT_TARGETS = vmImage zImage 48 45 PHONY += $(BOOT_TARGETS) install 49 46 KBUILD_IMAGE := $(nios2-boot)/vmImage 50 - 51 - core-y += $(nios2-boot)/dts/ 52 47 53 48 all: vmImage 54 49
+1 -1
arch/nios2/kernel/Makefile
··· 3 3 # Makefile for the nios2 linux kernel. 4 4 # 5 5 6 - extra-y += head.o 7 6 extra-y += vmlinux.lds 8 7 8 + obj-y += head.o 9 9 obj-y += cpuinfo.o 10 10 obj-y += entry.o 11 11 obj-y += insnemu.o
-2
arch/openrisc/Makefile
··· 55 55 KBUILD_CFLAGS += $(call cc-option,-msext) 56 56 endif 57 57 58 - head-y := arch/openrisc/kernel/head.o 59 - 60 58 libs-y += $(LIBGCC) 61 59 62 60 PHONY += vmlinux.bin
+2 -2
arch/openrisc/kernel/Makefile
··· 3 3 # Makefile for the linux kernel. 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 - obj-y := setup.o or32_ksyms.o process.o dma.o \ 8 + obj-y := head.o setup.o or32_ksyms.o process.o dma.o \ 9 9 traps.o time.o irq.o entry.o ptrace.o signal.o \ 10 10 sys_call_table.o unwinder.o 11 11
-2
arch/parisc/Makefile
··· 113 113 cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300 114 114 cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000 115 115 116 - head-y := arch/parisc/kernel/head.o 117 - 118 116 KBUILD_CFLAGS += $(cflags-y) 119 117 LIBGCC := $(shell $(CC) -print-libgcc-file-name) 120 118 export LIBGCC
+2 -2
arch/parisc/kernel/Makefile
··· 3 3 # Makefile for arch/parisc/kernel 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 - obj-y := cache.o pacache.o setup.o pdt.o traps.o time.o irq.o \ 8 + obj-y := head.o cache.o pacache.o setup.o pdt.o traps.o time.o irq.o \ 9 9 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 10 10 ptrace.o hardware.o inventory.o drivers.o alternative.o \ 11 11 signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
-12
arch/powerpc/Makefile
··· 232 232 KBUILD_AFLAGS += $(aflags-y) 233 233 KBUILD_CFLAGS += $(cflags-y) 234 234 235 - head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o 236 - head-$(CONFIG_PPC_BOOK3S_32) := arch/powerpc/kernel/head_book3s_32.o 237 - head-$(CONFIG_PPC_8xx) := arch/powerpc/kernel/head_8xx.o 238 - head-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o 239 - head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 240 - head-$(CONFIG_PPC_85xx) := arch/powerpc/kernel/head_85xx.o 241 - 242 - head-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 243 - head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 244 - head-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o 245 - head-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o 246 - 247 235 # Default to zImage, override when needed 248 236 all: zImage 249 237
+1 -1
arch/powerpc/boot/wrapper
··· 433 433 # Extract kernel version information, some platforms want to include 434 434 # it in the image header 435 435 version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ 436 - cut -d' ' -f3` 436 + head -n1 | cut -d' ' -f3` 437 437 if [ -n "$version" ]; then 438 438 uboot_version="-n Linux-$version" 439 439 fi
+10 -10
arch/powerpc/kernel/Makefile
··· 116 116 obj-$(CONFIG_PPC_DOORBELL) += dbell.o 117 117 obj-$(CONFIG_JUMP_LABEL) += jump_label.o 118 118 119 - extra-$(CONFIG_PPC64) := head_64.o 120 - extra-$(CONFIG_PPC_BOOK3S_32) := head_book3s_32.o 121 - extra-$(CONFIG_40x) := head_40x.o 122 - extra-$(CONFIG_44x) := head_44x.o 123 - extra-$(CONFIG_PPC_85xx) := head_85xx.o 124 - extra-$(CONFIG_PPC_8xx) := head_8xx.o 119 + obj-$(CONFIG_PPC64) += head_64.o 120 + obj-$(CONFIG_PPC_BOOK3S_32) += head_book3s_32.o 121 + obj-$(CONFIG_40x) += head_40x.o 122 + obj-$(CONFIG_44x) += head_44x.o 123 + obj-$(CONFIG_PPC_8xx) += head_8xx.o 124 + obj-$(CONFIG_FSL_BOOKE) += head_85xx.o 125 125 extra-y += vmlinux.lds 126 126 127 127 obj-$(CONFIG_RELOCATABLE) += reloc_$(BITS).o ··· 196 196 CFLAGS_setup_64.o += -fno-stack-protector 197 197 CFLAGS_paca.o += -fno-stack-protector 198 198 199 - extra-$(CONFIG_PPC_FPU) += fpu.o 200 - extra-$(CONFIG_ALTIVEC) += vector.o 201 - extra-$(CONFIG_PPC64) += entry_64.o 202 - extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o 199 + obj-$(CONFIG_PPC_FPU) += fpu.o 200 + obj-$(CONFIG_ALTIVEC) += vector.o 201 + obj-$(CONFIG_PPC64) += entry_64.o 202 + obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o 203 203 204 204 extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check 205 205
-2
arch/riscv/Makefile
··· 110 110 KBUILD_IMAGE := $(boot)/Image.gz 111 111 endif 112 112 113 - head-y := arch/riscv/kernel/head.o 114 - 115 113 libs-y += arch/riscv/lib/ 116 114 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a 117 115
+1 -1
arch/riscv/kernel/Makefile
··· 28 28 endif 29 29 endif 30 30 31 - extra-y += head.o 32 31 extra-y += vmlinux.lds 33 32 33 + obj-y += head.o 34 34 obj-y += soc.o 35 35 obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative.o 36 36 obj-y += cpu.o
-2
arch/s390/Makefile
··· 119 119 120 120 OBJCOPYFLAGS := -O binary 121 121 122 - head-y := arch/s390/kernel/head64.o 123 - 124 122 libs-y += arch/s390/lib/ 125 123 drivers-y += drivers/s390/ 126 124
+1
arch/s390/boot/version.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include <generated/utsversion.h> 2 3 #include <generated/utsrelease.h> 3 4 #include <generated/compile.h> 4 5 #include "boot.h"
+2 -2
arch/s390/kernel/Makefile
··· 33 33 CFLAGS_dumpstack.o += -fno-optimize-sibling-calls 34 34 CFLAGS_unwind_bc.o += -fno-optimize-sibling-calls 35 35 36 - obj-y := traps.o time.o process.o earlypgm.o early.o setup.o idle.o vtime.o 36 + obj-y := head64.o traps.o time.o process.o earlypgm.o early.o setup.o idle.o vtime.o 37 37 obj-y += processor.o syscall.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o 38 38 obj-y += debug.o irq.o ipl.o dis.o diag.o vdso.o cpufeature.o 39 39 obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o ··· 42 42 obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o 43 43 obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o 44 44 45 - extra-y += head64.o vmlinux.lds 45 + extra-y += vmlinux.lds 46 46 47 47 obj-$(CONFIG_SYSFS) += nospec-sysfs.o 48 48 CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE)
-2
arch/sh/Makefile
··· 114 114 115 115 export ld-bfd 116 116 117 - head-y := arch/sh/kernel/head_32.o 118 - 119 117 # Mach groups 120 118 machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se 121 119 machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
+2 -2
arch/sh/kernel/Makefile
··· 3 3 # Makefile for the Linux/SuperH kernel. 4 4 # 5 5 6 - extra-y := head_32.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 8 ifdef CONFIG_FUNCTION_TRACER 9 9 # Do not profile debug and lowlevel utilities ··· 12 12 13 13 CFLAGS_REMOVE_return_address.o = -pg 14 14 15 - obj-y := debugtraps.o dumpstack.o \ 15 + obj-y := head_32.o debugtraps.o dumpstack.o \ 16 16 idle.o io.o irq.o irq_32.o kdebugfs.o \ 17 17 machvec.o nmi_debug.o process.o \ 18 18 process_32.o ptrace.o ptrace_32.o \
-2
arch/sparc/Makefile
··· 56 56 57 57 endif 58 58 59 - head-y := arch/sparc/kernel/head_$(BITS).o 60 - 61 59 libs-y += arch/sparc/prom/ 62 60 libs-y += arch/sparc/lib/ 63 61
+1 -2
arch/sparc/kernel/Makefile
··· 7 7 asflags-y := -ansi 8 8 ccflags-y := -Werror 9 9 10 - extra-y := head_$(BITS).o 11 - 12 10 # Undefine sparc when processing vmlinux.lds - it is used 13 11 # And teach CPP we are doing $(BITS) builds (for this case) 14 12 CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS) ··· 20 22 CFLAGS_REMOVE_pcr.o := -pg 21 23 endif 22 24 25 + obj-y := head_$(BITS).o 23 26 obj-$(CONFIG_SPARC64) += urtt_fill.o 24 27 obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o 25 28 obj-$(CONFIG_SPARC32) += etrap_32.o
-5
arch/x86/Makefile
··· 244 244 ### 245 245 # Kernel objects 246 246 247 - head-y := arch/x86/kernel/head_$(BITS).o 248 - head-y += arch/x86/kernel/head$(BITS).o 249 - head-y += arch/x86/kernel/ebda.o 250 - head-y += arch/x86/kernel/platform-quirks.o 251 - 252 247 libs-y += arch/x86/lib/ 253 248 254 249 # drivers-y are linked after core-y
+1
arch/x86/boot/compressed/kaslr.c
··· 29 29 #include <linux/uts.h> 30 30 #include <linux/utsname.h> 31 31 #include <linux/ctype.h> 32 + #include <generated/utsversion.h> 32 33 #include <generated/utsrelease.h> 33 34 34 35 #define _SETUP
+1
arch/x86/boot/version.c
··· 11 11 */ 12 12 13 13 #include "boot.h" 14 + #include <generated/utsversion.h> 14 15 #include <generated/utsrelease.h> 15 16 #include <generated/compile.h> 16 17
+5 -5
arch/x86/kernel/Makefile
··· 3 3 # Makefile for the linux kernel. 4 4 # 5 5 6 - extra-y := head_$(BITS).o 7 - extra-y += head$(BITS).o 8 - extra-y += ebda.o 9 - extra-y += platform-quirks.o 10 6 extra-y += vmlinux.lds 11 7 12 8 CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) ··· 38 42 39 43 CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace 40 44 41 - obj-y := process_$(BITS).o signal.o 45 + obj-y += head_$(BITS).o 46 + obj-y += head$(BITS).o 47 + obj-y += ebda.o 48 + obj-y += platform-quirks.o 49 + obj-y += process_$(BITS).o signal.o 42 50 obj-$(CONFIG_COMPAT) += signal_compat.o 43 51 obj-y += traps.o idt.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 44 52 obj-y += time.o ioport.o dumpstack.o nmi.o
-2
arch/xtensa/Makefile
··· 55 55 56 56 KBUILD_DEFCONFIG := iss_defconfig 57 57 58 - head-y := arch/xtensa/kernel/head.o 59 - 60 58 libs-y += arch/xtensa/lib/ 61 59 62 60 boot := arch/xtensa/boot
+2 -2
arch/xtensa/kernel/Makefile
··· 3 3 # Makefile for the Linux/Xtensa kernel. 4 4 # 5 5 6 - extra-y := head.o vmlinux.lds 6 + extra-y := vmlinux.lds 7 7 8 - obj-y := align.o coprocessor.o entry.o irq.o platform.o process.o \ 8 + obj-y := head.o align.o coprocessor.o entry.o irq.o platform.o process.o \ 9 9 ptrace.o setup.o signal.o stacktrace.o syscall.o time.o traps.o \ 10 10 vectors.o 11 11
+1 -1
drivers/gpu/drm/amd/display/dc/dml/Makefile
··· 34 34 endif 35 35 36 36 ifdef CONFIG_CC_IS_GCC 37 - ifeq ($(call cc-ifversion, -lt, 0701, y), y) 37 + ifneq ($(call gcc-min-version, 70100),y) 38 38 IS_OLD_GCC = 1 39 39 endif 40 40 endif
+4 -2
include/linux/export-internal.h
··· 10 10 #include <linux/compiler.h> 11 11 #include <linux/types.h> 12 12 13 - /* __used is needed to keep __crc_* for LTO */ 14 13 #define SYMBOL_CRC(sym, crc, sec) \ 15 - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym = crc 14 + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ 15 + "__crc_" #sym ":" "\n" \ 16 + ".long " #crc "\n" \ 17 + ".previous" "\n") 16 18 17 19 #endif /* __LINUX_EXPORT_INTERNAL_H__ */
+2
init/.gitignore
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + /utsversion-tmp.h
+37 -14
init/Makefile
··· 19 19 mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o 20 20 mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 21 21 22 - # dependencies on generated files need to be listed explicitly 23 - $(obj)/version.o: include/generated/compile.h 22 + # 23 + # UTS_VERSION 24 + # 24 25 25 - # compile.h changes depending on hostname, generation number, etc, 26 - # so we regenerate it always. 27 - # mkcompile_h will make sure to only update the 28 - # actual file if its content has changed. 26 + smp-flag-$(CONFIG_SMP) := SMP 27 + preempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT 28 + preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC 29 + preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT 29 30 30 - quiet_cmd_compile.h = CHK $@ 31 - cmd_compile.h = \ 32 - $(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ 33 - "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \ 34 - "$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \ 35 - "$(CONFIG_CC_VERSION_TEXT)" "$(LD)" 31 + build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) 32 + build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto)) 36 33 37 - include/generated/compile.h: FORCE 38 - $(call cmd,compile.h) 34 + # Maximum length of UTS_VERSION is 64 chars 35 + filechk_uts_version = \ 36 + utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \ 37 + echo '$(pound)'define UTS_VERSION \""$${utsver}"\" 38 + 39 + # 40 + # Build version.c with temporary UTS_VERSION 41 + # 42 + 43 + $(obj)/utsversion-tmp.h: FORCE 44 + $(call filechk,uts_version) 45 + 46 + clean-files += utsversion-tmp.h 47 + 48 + $(obj)/version.o: $(obj)/utsversion-tmp.h 49 + CFLAGS_version.o := -include $(obj)/utsversion-tmp.h 50 + 51 + # 52 + # Build version-timestamp.c with final UTS_VERSION 53 + # 54 + 55 + include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/build-version) 56 + include/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date) 57 + include/generated/utsversion.h: FORCE 58 + $(call filechk,uts_version) 59 + 60 + $(obj)/version-timestamp.o: include/generated/utsversion.h 61 + CFLAGS_version-timestamp.o := -include include/generated/utsversion.h
+10
init/build-version
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + 4 + prev_ver=$(cat .version 2>/dev/null) && 5 + ver=$(expr ${prev_ver} + 1 2>/dev/null) || 6 + ver=1 7 + 8 + echo ${ver} > .version 9 + 10 + echo ${ver}
+31
init/version-timestamp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + 3 + #include <generated/compile.h> 4 + #include <generated/utsrelease.h> 5 + #include <linux/version.h> 6 + #include <linux/proc_ns.h> 7 + #include <linux/refcount.h> 8 + #include <linux/uts.h> 9 + #include <linux/utsname.h> 10 + 11 + struct uts_namespace init_uts_ns = { 12 + .ns.count = REFCOUNT_INIT(2), 13 + .name = { 14 + .sysname = UTS_SYSNAME, 15 + .nodename = UTS_NODENAME, 16 + .release = UTS_RELEASE, 17 + .version = UTS_VERSION, 18 + .machine = UTS_MACHINE, 19 + .domainname = UTS_DOMAINNAME, 20 + }, 21 + .user_ns = &init_user_ns, 22 + .ns.inum = PROC_UTS_INIT_INO, 23 + #ifdef CONFIG_UTS_NS 24 + .ns.ops = &utsns_operations, 25 + #endif 26 + }; 27 + 28 + /* FIXED STRINGS! Don't touch! */ 29 + const char linux_banner[] = 30 + "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" 31 + LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
+13 -24
init/version.c
··· 16 16 #include <linux/uts.h> 17 17 #include <linux/utsname.h> 18 18 #include <generated/utsrelease.h> 19 - #include <linux/version.h> 20 19 #include <linux/proc_ns.h> 21 - 22 - struct uts_namespace init_uts_ns = { 23 - .ns.count = REFCOUNT_INIT(2), 24 - .name = { 25 - .sysname = UTS_SYSNAME, 26 - .nodename = UTS_NODENAME, 27 - .release = UTS_RELEASE, 28 - .version = UTS_VERSION, 29 - .machine = UTS_MACHINE, 30 - .domainname = UTS_DOMAINNAME, 31 - }, 32 - .user_ns = &init_user_ns, 33 - .ns.inum = PROC_UTS_INIT_INO, 34 - #ifdef CONFIG_UTS_NS 35 - .ns.ops = &utsns_operations, 36 - #endif 37 - }; 38 - EXPORT_SYMBOL_GPL(init_uts_ns); 39 20 40 21 static int __init early_hostname(char *arg) 41 22 { ··· 33 52 } 34 53 early_param("hostname", early_hostname); 35 54 36 - /* FIXED STRINGS! Don't touch! */ 37 - const char linux_banner[] = 38 - "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" 39 - LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; 40 - 41 55 const char linux_proc_banner[] = 42 56 "%s version %s" 43 57 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" ··· 40 64 41 65 BUILD_SALT; 42 66 BUILD_LTO_INFO; 67 + 68 + /* 69 + * init_uts_ns and linux_banner contain the build version and timestamp, 70 + * which are really fixed at the very last step of build process. 71 + * They are compiled with __weak first, and without __weak later. 72 + */ 73 + 74 + struct uts_namespace init_uts_ns __weak; 75 + const char linux_banner[] __weak; 76 + 77 + #include "version-timestamp.c" 78 + 79 + EXPORT_SYMBOL_GPL(init_uts_ns);
+3 -3
kernel/gen_kheaders.sh
··· 31 31 fi 32 32 all_dirs="$all_dirs $dir_list" 33 33 34 - # include/generated/compile.h is ignored because it is touched even when none 35 - # of the source files changed. 34 + # include/generated/utsversion.h is ignored because it is generated after this 35 + # script is executed. (utsversion.h is unneeded for kheaders) 36 36 # 37 37 # When Kconfig regenerates include/generated/autoconf.h, its timestamp is 38 38 # updated, but the contents might be still the same. When any CONFIG option is ··· 42 42 # 43 43 # Ignore them for md5 calculation to avoid pointless regeneration. 44 44 headers_md5="$(find $all_dirs -name "*.h" | 45 - grep -v "include/generated/compile.h" | 45 + grep -v "include/generated/utsversion.h" | 46 46 grep -v "include/generated/autoconf.h" | 47 47 xargs ls -l | md5sum | cut -d ' ' -f1)" 48 48
+6 -2
lib/Kconfig
··· 343 343 config LZ4_DECOMPRESS 344 344 tristate 345 345 346 - config ZSTD_COMPRESS 346 + config ZSTD_COMMON 347 347 select XXHASH 348 348 tristate 349 349 350 + config ZSTD_COMPRESS 351 + select ZSTD_COMMON 352 + tristate 353 + 350 354 config ZSTD_DECOMPRESS 351 - select XXHASH 355 + select ZSTD_COMMON 352 356 tristate 353 357 354 358 source "lib/xz/Kconfig"
+7 -9
lib/zstd/Makefile
··· 10 10 # ################################################################ 11 11 obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o 12 12 obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o 13 + obj-$(CONFIG_ZSTD_COMMON) += zstd_common.o 13 14 14 15 zstd_compress-y := \ 15 16 zstd_compress_module.o \ 16 - common/debug.o \ 17 - common/entropy_common.o \ 18 - common/error_private.o \ 19 - common/fse_decompress.o \ 20 - common/zstd_common.o \ 21 17 compress/fse_compress.o \ 22 18 compress/hist.o \ 23 19 compress/huf_compress.o \ ··· 29 33 30 34 zstd_decompress-y := \ 31 35 zstd_decompress_module.o \ 36 + decompress/huf_decompress.o \ 37 + decompress/zstd_ddict.o \ 38 + decompress/zstd_decompress.o \ 39 + decompress/zstd_decompress_block.o \ 40 + 41 + zstd_common-y := \ 32 42 common/debug.o \ 33 43 common/entropy_common.o \ 34 44 common/error_private.o \ 35 45 common/fse_decompress.o \ 36 46 common/zstd_common.o \ 37 - decompress/huf_decompress.o \ 38 - decompress/zstd_ddict.o \ 39 - decompress/zstd_decompress.o \ 40 - decompress/zstd_decompress_block.o \
+4 -1
lib/zstd/common/entropy_common.c
··· 15 15 /* ************************************* 16 16 * Dependencies 17 17 ***************************************/ 18 + #include <linux/module.h> 18 19 #include "mem.h" 19 20 #include "error_private.h" /* ERR_*, ERROR */ 20 21 #define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */ ··· 240 239 { 241 240 return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0); 242 241 } 243 - 242 + EXPORT_SYMBOL_GPL(FSE_readNCount); 244 243 245 244 /*! HUF_readStats() : 246 245 Read compact Huffman tree, saved by HUF_writeCTable(). ··· 256 255 U32 wksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; 257 256 return HUF_readStats_wksp(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, wksp, sizeof(wksp), /* bmi2 */ 0); 258 257 } 258 + EXPORT_SYMBOL_GPL(HUF_readStats); 259 259 260 260 FORCE_INLINE_TEMPLATE size_t 261 261 HUF_readStats_body(BYTE* huffWeight, size_t hwSize, U32* rankStats, ··· 357 355 (void)bmi2; 358 356 return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize); 359 357 } 358 + EXPORT_SYMBOL_GPL(HUF_readStats_wksp);
+10
lib/zstd/common/zstd_common.c
··· 13 13 /*-************************************* 14 14 * Dependencies 15 15 ***************************************/ 16 + #include <linux/module.h> 16 17 #define ZSTD_DEPS_NEED_MALLOC 17 18 #include "zstd_deps.h" /* ZSTD_malloc, ZSTD_calloc, ZSTD_free, ZSTD_memset */ 18 19 #include "error_private.h" ··· 36 35 * tells if a return value is an error code 37 36 * symbol is required for external callers */ 38 37 unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } 38 + EXPORT_SYMBOL_GPL(ZSTD_isError); 39 39 40 40 /*! ZSTD_getErrorName() : 41 41 * provides error code string from function result (useful for debugging) */ 42 42 const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); } 43 + EXPORT_SYMBOL_GPL(ZSTD_getErrorName); 43 44 44 45 /*! ZSTD_getError() : 45 46 * convert a `size_t` function result into a proper ZSTD_errorCode enum */ 46 47 ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } 48 + EXPORT_SYMBOL_GPL(ZSTD_getErrorCode); 47 49 48 50 /*! ZSTD_getErrorString() : 49 51 * provides error code string from enum */ ··· 63 59 return customMem.customAlloc(customMem.opaque, size); 64 60 return ZSTD_malloc(size); 65 61 } 62 + EXPORT_SYMBOL_GPL(ZSTD_customMalloc); 66 63 67 64 void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem) 68 65 { ··· 76 71 } 77 72 return ZSTD_calloc(1, size); 78 73 } 74 + EXPORT_SYMBOL_GPL(ZSTD_customCalloc); 79 75 80 76 void ZSTD_customFree(void* ptr, ZSTD_customMem customMem) 81 77 { ··· 87 81 ZSTD_free(ptr); 88 82 } 89 83 } 84 + EXPORT_SYMBOL_GPL(ZSTD_customFree); 85 + 86 + MODULE_LICENSE("Dual BSD/GPL"); 87 + MODULE_DESCRIPTION("Zstd Common");
+22 -1
scripts/Kbuild.include
··· 100 100 quiet_redirect := 101 101 silent_redirect := exec >/dev/null; 102 102 103 + # Delete the target on interruption 104 + # 105 + # GNU Make automatically deletes the target if it has already been changed by 106 + # the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make 107 + # will delete incomplete targets), and resume it later. 108 + # 109 + # However, this does not work when the stderr is piped to another program, like 110 + # $ make >&2 | tee log 111 + # Make dies with SIGPIPE before cleaning the targets. 112 + # 113 + # To address it, we clean the target in signal traps. 114 + # 115 + # Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. 116 + # So, we cover them, and also SIGPIPE just in case. 117 + # 118 + # Of course, this is unneeded for phony targets. 119 + delete-on-interrupt = \ 120 + $(if $(filter-out $(PHONY), $@), \ 121 + $(foreach sig, HUP INT QUIT TERM PIPE, \ 122 + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) 123 + 103 124 # printing commands 104 - cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1)) 125 + cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1)) 105 126 106 127 ### 107 128 # if_changed - execute command if any prerequisite is newer than
+18 -40
scripts/Makefile.build
··· 5 5 6 6 src := $(obj) 7 7 8 - PHONY := __build 9 - __build: 8 + PHONY := $(obj)/ 9 + $(obj)/: 10 10 11 11 # Init all relevant variables used in kbuild files so 12 12 # 1) they have correct type ··· 383 383 384 384 targets += $(filter-out $(subdir-builtin), $(real-obj-y)) 385 385 targets += $(filter-out $(subdir-modorder), $(real-obj-m)) 386 - targets += $(real-dtb-y) $(lib-y) $(always-y) $(MAKECMDGOALS) 386 + targets += $(real-dtb-y) $(lib-y) $(always-y) 387 387 388 388 # Linker scripts preprocessor (.lds.S -> .lds) 389 389 # --------------------------------------------------------------------------- ··· 434 434 435 435 cmd_modules_order = { $(foreach m, $(real-prereqs), \ 436 436 $(if $(filter %/modules.order, $m), cat $m, echo $(patsubst %.o,%.ko,$m));) :; } \ 437 - | $(AWK) '!x[$$0]++' - > $@ 437 + > $@ 438 438 439 439 $(obj)/modules.order: $(obj-m) FORCE 440 440 $(call if_changed,modules_order) ··· 460 460 $(call if_changed_rule,ld_multi_m) 461 461 $(call multi_depend, $(multi-obj-m), .o, -objs -y -m) 462 462 463 - targets := $(filter-out $(PHONY), $(targets)) 464 - 465 463 # Add intermediate targets: 466 464 # When building objects with specific suffix patterns, add intermediate 467 465 # targets that the final targets are derived from. ··· 478 480 # Build 479 481 # --------------------------------------------------------------------------- 480 482 481 - ifdef single-build 482 - 483 - KBUILD_SINGLE_TARGETS := $(filter $(obj)/%, $(KBUILD_SINGLE_TARGETS)) 484 - 485 - curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \ 486 - $(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x)))) 487 - 488 - # Handle single targets without any rule: show "Nothing to be done for ..." or 489 - # "No rule to make target ..." depending on whether the target exists. 490 - unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \ 491 - $(filter-out $(curdir-single), $(KBUILD_SINGLE_TARGETS))) 492 - 493 - single-subdirs := $(foreach d, $(subdir-ym), \ 494 - $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d))) 495 - 496 - __build: $(curdir-single) $(single-subdirs) 497 - ifneq ($(unknown-single),) 498 - $(Q)$(MAKE) -f /dev/null $(unknown-single) 499 - endif 500 - @: 501 - 502 - ifeq ($(curdir-single),) 503 - # Nothing to do in this directory. Do not include any .*.cmd file for speed-up 504 - targets := 505 - else 506 - targets += $(curdir-single) 507 - endif 508 - 509 - else 510 - 511 - __build: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \ 483 + $(obj)/: $(if $(KBUILD_BUILTIN), $(targets-for-builtin)) \ 512 484 $(if $(KBUILD_MODULES), $(targets-for-modules)) \ 513 485 $(subdir-ym) $(always-y) 514 486 @: 515 487 516 - endif 488 + # Single targets 489 + # --------------------------------------------------------------------------- 490 + 491 + single-subdirs := $(foreach d, $(subdir-ym), $(if $(filter $d/%, $(MAKECMDGOALS)), $d)) 492 + single-subdir-goals := $(filter $(addsuffix /%, $(single-subdirs)), $(MAKECMDGOALS)) 493 + 494 + $(single-subdir-goals): $(single-subdirs) 495 + @: 517 496 518 497 # Descending 519 498 # --------------------------------------------------------------------------- ··· 498 523 PHONY += $(subdir-ym) 499 524 $(subdir-ym): 500 525 $(Q)$(MAKE) $(build)=$@ \ 501 - $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ 502 526 need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \ 503 - need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) 527 + need-modorder=$(if $(filter $@/modules.order, $(subdir-modorder)),1) \ 528 + $(filter $@/%, $(single-subdir-goals)) 504 529 505 530 # Add FORCE to the prequisites of a target to force it to be always rebuilt. 506 531 # --------------------------------------------------------------------------- ··· 508 533 PHONY += FORCE 509 534 510 535 FORCE: 536 + 537 + targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS)) 538 + targets := $(filter-out $(PHONY), $(targets)) 511 539 512 540 # Read all saved command lines and dependencies for the $(targets) we 513 541 # may be building above, using $(if_changed{,_dep}). As an
+7 -3
scripts/Makefile.compiler
··· 61 61 cc-disable-warning = $(call try-run,\ 62 62 $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) 63 63 64 - # cc-ifversion 65 - # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 66 - cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) 64 + # gcc-min-version 65 + # Usage: cflags-$(call gcc-min-version, 70100) += -foo 66 + gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION)0 -ge $(1)0 ] && echo y) 67 + 68 + # clang-min-version 69 + # Usage: cflags-$(call clang-min-version, 110000) += -foo 70 + clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION)0 -ge $(1)0 ] && echo y) 67 71 68 72 # ld-option 69 73 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
+2 -2
scripts/Makefile.extrawarn
··· 48 48 ifdef CONFIG_CC_IS_CLANG 49 49 KBUILD_CFLAGS += -Wno-initializer-overrides 50 50 # Clang before clang-16 would warn on default argument promotions. 51 - ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -lt 160000 ] && echo y),y) 51 + ifneq ($(call clang-min-version, 160000),y) 52 52 # Disable -Wformat 53 53 KBUILD_CFLAGS += -Wno-format 54 54 # Then re-enable flags that were part of the -Wformat group that aren't ··· 56 56 KBUILD_CFLAGS += -Wformat-extra-args -Wformat-invalid-specifier 57 57 KBUILD_CFLAGS += -Wformat-zero-length -Wnonnull 58 58 # Requires clang-12+. 59 - ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -ge 120000 ] && echo y),y) 59 + ifeq ($(call clang-min-version, 120000),y) 60 60 KBUILD_CFLAGS += -Wformat-insufficient-args 61 61 endif 62 62 endif
+18 -15
scripts/Makefile.lib
··· 90 90 91 91 # Add subdir path 92 92 93 + ifneq ($(obj),.) 93 94 extra-y := $(addprefix $(obj)/,$(extra-y)) 94 95 always-y := $(addprefix $(obj)/,$(always-y)) 95 96 targets := $(addprefix $(obj)/,$(targets)) ··· 102 101 multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y)) 103 102 real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y)) 104 103 subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) 104 + endif 105 105 106 106 # Finds the multi-part object the current object will be linked into. 107 107 # If the object belongs to two or more multi-part objects, list them all. ··· 243 241 244 242 objtool := $(objtree)/tools/objtool/objtool 245 243 246 - objtool_args = \ 247 - $(if $(CONFIG_HAVE_JUMP_LABEL_HACK), --hacks=jump_label) \ 248 - $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr) \ 249 - $(if $(CONFIG_X86_KERNEL_IBT), --ibt) \ 250 - $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \ 251 - $(if $(CONFIG_UNWINDER_ORC), --orc) \ 252 - $(if $(CONFIG_RETPOLINE), --retpoline) \ 253 - $(if $(CONFIG_RETHUNK), --rethunk) \ 254 - $(if $(CONFIG_SLS), --sls) \ 255 - $(if $(CONFIG_STACK_VALIDATION), --stackval) \ 256 - $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \ 257 - $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess) \ 244 + objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label 245 + objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr 246 + objtool-args-$(CONFIG_X86_KERNEL_IBT) += --ibt 247 + objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount 248 + objtool-args-$(CONFIG_UNWINDER_ORC) += --orc 249 + objtool-args-$(CONFIG_RETPOLINE) += --retpoline 250 + objtool-args-$(CONFIG_RETHUNK) += --rethunk 251 + objtool-args-$(CONFIG_SLS) += --sls 252 + objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval 253 + objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call 254 + objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess 255 + objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable 256 + 257 + objtool-args = $(objtool-args-y) \ 258 258 $(if $(delay-objtool), --link) \ 259 - $(if $(part-of-module), --module) \ 260 - $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) 259 + $(if $(part-of-module), --module) 261 260 262 261 delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT)) 263 262 264 - cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@) 263 + cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@) 265 264 cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) 266 265 267 266 endif # CONFIG_OBJTOOL
+1 -1
scripts/Makefile.modfinal
··· 57 57 printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) 58 58 59 59 # Re-generate module BTFs if either module's .ko or vmlinux changed 60 - $(modules): %.ko: %.o %.mod.o scripts/module.lds $(if $(KBUILD_BUILTIN),vmlinux) FORCE 60 + $(modules): %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE 61 61 +$(call if_changed_except,ld_ko_o,vmlinux) 62 62 ifdef CONFIG_DEBUG_INFO_BTF_MODULES 63 63 +$(if $(newer-prereqs),$(call cmd,btf_ko))
+51 -61
scripts/Makefile.modpost
··· 32 32 # Step 4 is solely used to allow module versioning in external modules, 33 33 # where the CRC of each module is retrieved from the Module.symvers file. 34 34 35 - # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. 36 - # This is solely useful to speed up test compiles 37 - 38 35 PHONY := __modpost 39 36 __modpost: 40 37 41 38 include include/config/auto.conf 42 39 include $(srctree)/scripts/Kbuild.include 43 40 44 - MODPOST = scripts/mod/modpost \ 41 + modpost-args = \ 45 42 $(if $(CONFIG_MODVERSIONS),-m) \ 46 43 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \ 47 44 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ 45 + $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \ 46 + $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \ 48 47 -o $@ 49 48 50 - ifdef MODPOST_VMLINUX 51 - 52 - quiet_cmd_modpost = MODPOST $@ 53 - cmd_modpost = $(MODPOST) $< 54 - 55 - vmlinux.symvers: vmlinux.o 56 - $(call cmd,modpost) 57 - 58 - __modpost: vmlinux.symvers 59 - 60 - else 49 + # 'make -i -k' ignores compile errors, and builds as many modules as possible. 50 + ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) 51 + modpost-args += -n 52 + endif 61 53 62 54 ifeq ($(KBUILD_EXTMOD),) 63 55 64 - input-symdump := vmlinux.symvers 65 - output-symdump := modules-only.symvers 56 + # Generate the list of in-tree objects in vmlinux 57 + # --------------------------------------------------------------------------- 66 58 67 - quiet_cmd_cat = GEN $@ 68 - cmd_cat = cat $(real-prereqs) > $@ 59 + # This is used to retrieve symbol versions generated by genksyms. 60 + ifdef CONFIG_MODVERSIONS 61 + vmlinux.symvers Module.symvers: .vmlinux.objs 62 + endif 69 63 70 - ifneq ($(wildcard vmlinux.symvers),) 64 + # Ignore libgcc.a 65 + # Some architectures do '$(CC) --print-libgcc-file-name' to borrow libgcc.a 66 + # from the toolchain, but there is no EXPORT_SYMBOL in it. 71 67 72 - __modpost: Module.symvers 73 - Module.symvers: vmlinux.symvers modules-only.symvers FORCE 74 - $(call if_changed,cat) 68 + quiet_cmd_vmlinux_objs = GEN $@ 69 + cmd_vmlinux_objs = \ 70 + for f in $(real-prereqs); do \ 71 + case $${f} in \ 72 + *libgcc.a) ;; \ 73 + *) $(AR) t $${f} ;; \ 74 + esac \ 75 + done > $@ 75 76 76 - targets += Module.symvers 77 + targets += .vmlinux.objs 78 + .vmlinux.objs: vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE 79 + $(call if_changed,vmlinux_objs) 77 80 81 + vmlinux.o-if-present := $(wildcard vmlinux.o) 82 + output-symdump := vmlinux.symvers 83 + 84 + ifdef KBUILD_MODULES 85 + output-symdump := $(if $(vmlinux.o-if-present), Module.symvers, modules-only.symvers) 86 + missing-input := $(filter-out $(vmlinux.o-if-present),vmlinux.o) 78 87 endif 79 88 80 89 else ··· 95 86 # Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS 96 87 include $(or $(wildcard $(src)/Kbuild), $(src)/Makefile) 97 88 98 - # modpost option for external modules 99 - MODPOST += -e 100 - 101 - input-symdump := Module.symvers $(KBUILD_EXTRA_SYMBOLS) 89 + module.symvers-if-present := $(wildcard Module.symvers) 102 90 output-symdump := $(KBUILD_EXTMOD)/Module.symvers 91 + missing-input := $(filter-out $(module.symvers-if-present), Module.symvers) 103 92 93 + modpost-args += -e $(addprefix -i ,$(module.symvers-if-present) $(KBUILD_EXTRA_SYMBOLS)) 94 + 95 + endif # ($(KBUILD_EXTMOD),) 96 + 97 + ifneq ($(KBUILD_MODPOST_WARN)$(missing-input),) 98 + modpost-args += -w 104 99 endif 105 100 106 - existing-input-symdump := $(wildcard $(input-symdump)) 101 + modorder-if-needed := $(if $(KBUILD_MODULES), $(MODORDER)) 107 102 108 - # modpost options for modules (both in-kernel and external) 109 - MODPOST += \ 110 - $(addprefix -i ,$(existing-input-symdump)) \ 111 - $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \ 112 - $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) 113 - 114 - # 'make -i -k' ignores compile errors, and builds as many modules as possible. 115 - ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),) 116 - MODPOST += -n 117 - endif 118 - 119 - # Clear VPATH to not search for *.symvers in $(srctree). Check only $(objtree). 120 - VPATH := 121 - $(input-symdump): 122 - @echo >&2 'WARNING: Symbol version dump "$@" is missing.' 123 - @echo >&2 ' Modules may not have dependencies or modversions.' 124 - @echo >&2 ' You may get many unresolved symbol warnings.' 125 - 126 - # KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined symbols 127 - ifneq ($(KBUILD_MODPOST_WARN)$(filter-out $(existing-input-symdump), $(input-symdump)),) 128 - MODPOST += -w 129 - endif 103 + MODPOST = scripts/mod/modpost 130 104 131 105 # Read out modules.order to pass in modpost. 132 106 # Otherwise, allmodconfig would fail with "Argument list too long". 133 107 quiet_cmd_modpost = MODPOST $@ 134 - cmd_modpost = sed 's/ko$$/o/' $< | $(MODPOST) -T - 135 - 136 - $(output-symdump): $(MODORDER) $(input-symdump) FORCE 137 - $(call if_changed,modpost) 108 + cmd_modpost = \ 109 + $(if $(missing-input), \ 110 + echo >&2 "WARNING: $(missing-input) is missing."; \ 111 + echo >&2 " Modules may not have dependencies or modversions."; \ 112 + echo >&2 " You may get many unresolved symbol warnings.";) \ 113 + sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) $(vmlinux.o-if-present) -T - 138 114 139 115 targets += $(output-symdump) 116 + $(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(moudle.symvers-if-present) $(MODPOST) FORCE 117 + $(call if_changed,modpost) 140 118 141 119 __modpost: $(output-symdump) 142 - ifneq ($(KBUILD_MODPOST_NOFINAL),1) 143 - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal 144 - endif 145 - 146 120 PHONY += FORCE 147 121 FORCE: 148 122 149 123 existing-targets := $(wildcard $(sort $(targets))) 150 124 151 125 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) 152 - 153 - endif 154 126 155 127 .PHONY: $(PHONY)
+4 -1
scripts/Makefile.package
··· 29 29 KBUILD_PKG_ROOTCMD ?="fakeroot -u" 30 30 export KDEB_SOURCENAME 31 31 # Include only those top-level files that are needed by make, plus the GPL copy 32 - TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \ 32 + TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ 33 + include init io_uring ipc kernel lib mm net samples scripts \ 34 + security sound tools usr virt \ 35 + .config .scmversion Makefile \ 33 36 Kbuild Kconfig COPYING $(wildcard localversion*) 34 37 MKSPEC := $(srctree)/scripts/package/mkspec 35 38
+20 -1
scripts/Makefile.vmlinux
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 + PHONY := __default 4 + __default: vmlinux 5 + 3 6 include include/config/auto.conf 4 7 include $(srctree)/scripts/Kbuild.include 5 8 6 9 # for c_flags 7 10 include $(srctree)/scripts/Makefile.lib 11 + 12 + targets := 8 13 9 14 quiet_cmd_cc_o_c = CC $@ 10 15 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< ··· 17 12 %.o: %.c FORCE 18 13 $(call if_changed_dep,cc_o_c) 19 14 20 - targets := $(MAKECMDGOALS) 15 + ifdef CONFIG_MODULES 16 + targets += .vmlinux.export.o 17 + vmlinux: .vmlinux.export.o 18 + endif 19 + 20 + ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) 21 + 22 + # Final link of vmlinux with optional arch pass after final link 23 + cmd_link_vmlinux = \ 24 + $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ 25 + $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 26 + 27 + targets += vmlinux 28 + vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE 29 + +$(call if_changed_dep,link_vmlinux) 21 30 22 31 # Add FORCE to the prequisites of a target to force it to be always rebuilt. 23 32 # ---------------------------------------------------------------------------
+32 -15
scripts/Makefile.vmlinux_o
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 PHONY := __default 4 - __default: vmlinux.o 4 + __default: vmlinux.o modules.builtin.modinfo modules.builtin 5 5 6 6 include include/config/auto.conf 7 7 include $(srctree)/scripts/Kbuild.include ··· 18 18 $(PERL) $(real-prereqs) > $@ 19 19 20 20 .tmp_initcalls.lds: $(srctree)/scripts/generate_initcall_order.pl \ 21 - $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE 21 + vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE 22 22 $(call if_changed,gen_initcalls_lds) 23 23 24 24 targets := .tmp_initcalls.lds ··· 35 35 36 36 objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION)) 37 37 38 - # Reuse objtool_args defined in scripts/Makefile.lib if LTO or IBT is enabled. 39 - # 40 - # Add some more flags as needed. 41 - # --no-unreachable and --link might be added twice, but it is fine. 42 - # 43 - # Expand objtool_args to a simple variable to avoid circular reference. 38 + vmlinux-objtool-args-$(delay-objtool) += $(objtool-args-y) 39 + vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable 40 + vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr $(if $(CONFIG_CPU_UNRET_ENTRY), --unret) 44 41 45 - objtool_args := \ 46 - $(if $(delay-objtool),$(objtool_args)) \ 47 - $(if $(CONFIG_NOINSTR_VALIDATION), --noinstr $(if $(CONFIG_CPU_UNRET_ENTRY), --unret)) \ 48 - $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) \ 49 - --link 42 + objtool-args = $(vmlinux-objtool-args-y) --link 50 43 51 44 # Link of vmlinux.o used for section mismatch analysis 52 45 # --------------------------------------------------------------------------- ··· 48 55 cmd_ld_vmlinux.o = \ 49 56 $(LD) ${KBUILD_LDFLAGS} -r -o $@ \ 50 57 $(addprefix -T , $(initcalls-lds)) \ 51 - --whole-archive $(KBUILD_VMLINUX_OBJS) --no-whole-archive \ 58 + --whole-archive vmlinux.a --no-whole-archive \ 52 59 --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ 53 60 $(cmd_objtool) 54 61 ··· 57 64 $(call cmd,gen_objtooldep) 58 65 endef 59 66 60 - vmlinux.o: $(initcalls-lds) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) FORCE 67 + vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE 61 68 $(call if_changed_rule,ld_vmlinux.o) 62 69 63 70 targets += vmlinux.o 71 + 72 + # module.builtin.modinfo 73 + # --------------------------------------------------------------------------- 74 + 75 + OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary 76 + 77 + targets += modules.builtin.modinfo 78 + modules.builtin.modinfo: vmlinux.o FORCE 79 + $(call if_changed,objcopy) 80 + 81 + # module.builtin 82 + # --------------------------------------------------------------------------- 83 + 84 + # The second line aids cases where multiple modules share the same object. 85 + 86 + quiet_cmd_modules_builtin = GEN $@ 87 + cmd_modules_builtin = \ 88 + tr '\0' '\n' < $< | \ 89 + sed -n 's/^[[:alnum:]:_]*\.file=//p' | \ 90 + tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@ 91 + 92 + targets += modules.builtin 93 + modules.builtin: modules.builtin.modinfo FORCE 94 + $(call if_changed,modules_builtin) 64 95 65 96 # Add FORCE to the prequisites of a target to force it to be always rebuilt. 66 97 # ---------------------------------------------------------------------------
+3 -3
scripts/asn1_compiler.c
··· 832 832 833 833 static struct element *element_list; 834 834 835 - static struct element *alloc_elem(struct token *type) 835 + static struct element *alloc_elem(void) 836 836 { 837 837 struct element *e = calloc(1, sizeof(*e)); 838 838 if (!e) { ··· 860 860 char *p; 861 861 int labelled = 0, implicit = 0; 862 862 863 - top = element = alloc_elem(cursor); 863 + top = element = alloc_elem(); 864 864 element->class = ASN1_UNIV; 865 865 element->method = ASN1_PRIM; 866 866 element->tag = token_to_tag[cursor->token_type]; ··· 939 939 if (!implicit) 940 940 element->method |= ASN1_CONS; 941 941 element->compound = implicit ? TAG_OVERRIDE : SEQUENCE; 942 - element->children = alloc_elem(cursor); 942 + element->children = alloc_elem(); 943 943 element = element->children; 944 944 element->class = ASN1_UNIV; 945 945 element->method = ASN1_PRIM;
-33
scripts/atomic/check-atomics.sh
··· 1 - #!/bin/sh 2 - # SPDX-License-Identifier: GPL-2.0 3 - # 4 - # Check if atomic headers are up-to-date 5 - 6 - ATOMICDIR=$(dirname $0) 7 - ATOMICTBL=${ATOMICDIR}/atomics.tbl 8 - LINUXDIR=${ATOMICDIR}/../.. 9 - 10 - echo '' | sha1sum - > /dev/null 2>&1 11 - if [ $? -ne 0 ]; then 12 - printf "sha1sum not available, skipping atomic header checks.\n" 13 - exit 0 14 - fi 15 - 16 - cat <<EOF | 17 - linux/atomic/atomic-instrumented.h 18 - linux/atomic/atomic-long.h 19 - linux/atomic/atomic-arch-fallback.h 20 - EOF 21 - while read header; do 22 - OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})" 23 - OLDSUM="${OLDSUM#// }" 24 - 25 - NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)" 26 - NEWSUM="${NEWSUM%% *}" 27 - 28 - if [ "${OLDSUM}" != "${NEWSUM}" ]; then 29 - printf "warning: generated include/${header} has been modified.\n" 30 - fi 31 - done 32 - 33 - exit 0
+48 -49
scripts/check-local-export
··· 1 - #!/usr/bin/env bash 1 + #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0-only 3 3 # 4 4 # Copyright (C) 2022 Masahiro Yamada <masahiroy@kernel.org> 5 + # Copyright (C) 2022 Owen Rafferty <owen@owenrafferty.com> 5 6 # 6 7 # Exit with error if a local exported symbol is found. 7 8 # EXPORT_SYMBOL should be used for global symbols. 8 9 9 10 set -e 10 - 11 - # catch errors from ${NM} 12 - set -o pipefail 13 - 14 - # Run the last element of a pipeline in the current shell. 15 - # Without this, the while-loop would be executed in a subshell, and 16 - # the changes made to 'symbol_types' and 'export_symbols' would be lost. 17 - shopt -s lastpipe 18 - 19 - declare -A symbol_types 20 - declare -a export_symbols 21 - 22 - exit_code=0 11 + pid=$$ 23 12 24 13 # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) shows 25 14 # 'no symbols' diagnostic (but exits with 0). It is harmless and hidden by ··· 18 29 # TODO: 19 30 # Use --quiet instead of 2>/dev/null when we upgrade the minimum version of 20 31 # binutils to 2.37, llvm to 13.0.0. 21 - # Then, the following line will be really simple: 22 - # ${NM} --quiet ${1} | 32 + # Then, the following line will be simpler: 33 + # { ${NM} --quiet ${1} || kill 0; } | 23 34 24 - { ${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } } | 25 - while read value type name 26 - do 27 - # Skip the line if the number of fields is less than 3. 28 - # 29 - # case 1) 30 - # For undefined symbols, the first field (value) is empty. 31 - # The outout looks like this: 32 - # " U _printk" 33 - # It is unneeded to record undefined symbols. 34 - # 35 - # case 2) 36 - # For Clang LTO, llvm-nm outputs a line with type 't' but empty name: 37 - # "---------------- t" 38 - if [[ -z ${name} ]]; then 39 - continue 40 - fi 35 + { ${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; kill $pid; } } | 36 + ${AWK} -v "file=${1}" ' 37 + BEGIN { 38 + i = 0 39 + } 41 40 42 - # save (name, type) in the associative array 43 - symbol_types[${name}]=${type} 41 + # Skip the line if the number of fields is less than 3. 42 + # 43 + # case 1) 44 + # For undefined symbols, the first field (value) is empty. 45 + # The outout looks like this: 46 + # " U _printk" 47 + # It is unneeded to record undefined symbols. 48 + # 49 + # case 2) 50 + # For Clang LTO, llvm-nm outputs a line with type t but empty name: 51 + # "---------------- t" 52 + !length($3) { 53 + next 54 + } 44 55 45 - # append the exported symbol to the array 46 - if [[ ${name} == __ksymtab_* ]]; then 47 - export_symbols+=(${name#__ksymtab_}) 48 - fi 49 - done 56 + # save (name, type) in the associative array 57 + { symbol_types[$3]=$2 } 50 58 51 - for name in "${export_symbols[@]}" 52 - do 53 - # nm(3) says "If lowercase, the symbol is usually local" 54 - if [[ ${symbol_types[$name]} =~ [a-z] ]]; then 55 - echo "$@: error: local symbol '${name}' was exported" >&2 56 - exit_code=1 57 - fi 58 - done 59 + # append the exported symbol to the array 60 + ($3 ~ /^__ksymtab_/) { 61 + export_symbols[i] = $3 62 + sub(/^__ksymtab_/, "", export_symbols[i]) 63 + i++ 64 + } 59 65 60 - exit ${exit_code} 66 + END { 67 + exit_code = 0 68 + for (j = 0; j < i; ++j) { 69 + name = export_symbols[j] 70 + # nm(3) says "If lowercase, the symbol is usually local" 71 + if (symbol_types[name] ~ /[a-z]/) { 72 + printf "%s: error: local symbol %s was exported\n", 73 + file, name | "cat 1>&2" 74 + exit_code = 1 75 + } 76 + } 77 + 78 + exit exit_code 79 + }' 80 + 81 + exit $?
+1 -18
scripts/clang-tools/gen_compile_commands.py
··· 109 109 return os.path.join(dir, '.' + base + '.cmd') 110 110 111 111 112 - def cmdfiles_for_o(obj): 113 - """Generate the iterator of .cmd files associated with the object 114 - 115 - Yield the .cmd file used to build the given object 116 - 117 - Args: 118 - obj: The object path 119 - 120 - Yields: 121 - The path to .cmd file 122 - """ 123 - yield to_cmdfile(obj) 124 - 125 - 126 112 def cmdfiles_for_a(archive, ar): 127 113 """Generate the iterator of .cmd files associated with the archive. 128 114 ··· 197 211 for path in paths: 198 212 # If 'path' is a directory, handle all .cmd files under it. 199 213 # Otherwise, handle .cmd files associated with the file. 200 - # Most of built-in objects are linked via archives (built-in.a or lib.a) 201 - # but some objects are linked to vmlinux directly. 214 + # built-in objects are linked via vmlinux.a 202 215 # Modules are listed in modules.order. 203 216 if os.path.isdir(path): 204 217 cmdfiles = cmdfiles_in_dir(path) 205 - elif path.endswith('.o'): 206 - cmdfiles = cmdfiles_for_o(path) 207 218 elif path.endswith('.a'): 208 219 cmdfiles = cmdfiles_for_a(path, ar) 209 220 elif path.endswith('modules.order'):
+53
scripts/head-object-list.txt
··· 1 + # Head objects 2 + # 3 + # The objects listed here are placed at the head of vmlinux. A typical use-case 4 + # is an object that contains the entry point. This is kept for compatibility 5 + # with head-y, which Kbuild used to support. 6 + # 7 + # A counter approach is to control the section placement by the linker script. 8 + # The code marked as __HEAD goes into the ".head.text" section, which is placed 9 + # before the normal ".text" section. 10 + # 11 + # If you can achieve the correct code ordering by linker script, please delete 12 + # the entry from this file. 13 + # 14 + arch/alpha/kernel/head.o 15 + arch/arc/kernel/head.o 16 + arch/arm/kernel/head-nommu.o 17 + arch/arm/kernel/head.o 18 + arch/arm64/kernel/head.o 19 + arch/csky/kernel/head.o 20 + arch/hexagon/kernel/head.o 21 + arch/ia64/kernel/head.o 22 + arch/loongarch/kernel/head.o 23 + arch/m68k/68000/head.o 24 + arch/m68k/coldfire/head.o 25 + arch/m68k/kernel/head.o 26 + arch/m68k/kernel/sun3-head.o 27 + arch/microblaze/kernel/head.o 28 + arch/mips/kernel/head.o 29 + arch/nios2/kernel/head.o 30 + arch/openrisc/kernel/head.o 31 + arch/parisc/kernel/head.o 32 + arch/powerpc/kernel/head_40x.o 33 + arch/powerpc/kernel/head_44x.o 34 + arch/powerpc/kernel/head_64.o 35 + arch/powerpc/kernel/head_8xx.o 36 + arch/powerpc/kernel/head_85xx.o 37 + arch/powerpc/kernel/head_book3s_32.o 38 + arch/powerpc/kernel/entry_64.o 39 + arch/powerpc/kernel/fpu.o 40 + arch/powerpc/kernel/vector.o 41 + arch/powerpc/kernel/prom_init.o 42 + arch/riscv/kernel/head.o 43 + arch/s390/kernel/head64.o 44 + arch/sh/kernel/head_32.o 45 + arch/sparc/kernel/head_32.o 46 + arch/sparc/kernel/head_64.o 47 + arch/x86/kernel/head_32.o 48 + arch/x86/kernel/head_64.o 49 + arch/x86/kernel/head32.o 50 + arch/x86/kernel/head64.o 51 + arch/x86/kernel/ebda.o 52 + arch/x86/kernel/platform-quirks.o 53 + arch/xtensa/kernel/head.o
+33 -21
scripts/kallsyms.c
··· 18 18 * 19 19 */ 20 20 21 + #include <getopt.h> 21 22 #include <stdbool.h> 22 23 #include <stdio.h> 23 24 #include <stdlib.h> ··· 88 87 static void usage(void) 89 88 { 90 89 fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] " 91 - "[--base-relative] < in.map > out.S\n"); 90 + "[--base-relative] in.map > out.S\n"); 92 91 exit(1); 93 92 } 94 93 ··· 124 123 125 124 /* Symbol names that begin with the following are ignored.*/ 126 125 static const char * const ignored_prefixes[] = { 127 - "$", /* local symbols for ARM, MIPS, etc. */ 128 - ".L", /* local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. */ 129 - "__crc_", /* modversions */ 130 126 "__efistub_", /* arm64 EFI stub namespace */ 131 127 "__kvm_nvhe_$", /* arm64 local symbols in non-VHE KVM namespace */ 132 128 "__kvm_nvhe_.L", /* arm64 local symbols in non-VHE KVM namespace */ ··· 328 330 } 329 331 } 330 332 331 - static void read_map(FILE *in) 333 + static void read_map(const char *in) 332 334 { 335 + FILE *fp; 333 336 struct sym_entry *sym; 334 337 335 - while (!feof(in)) { 336 - sym = read_symbol(in); 338 + fp = fopen(in, "r"); 339 + if (!fp) { 340 + perror(in); 341 + exit(1); 342 + } 343 + 344 + while (!feof(fp)) { 345 + sym = read_symbol(fp); 337 346 if (!sym) 338 347 continue; 339 348 ··· 351 346 table = realloc(table, sizeof(*table) * table_size); 352 347 if (!table) { 353 348 fprintf(stderr, "out of memory\n"); 349 + fclose(fp); 354 350 exit (1); 355 351 } 356 352 } 357 353 358 354 table[table_cnt++] = sym; 359 355 } 356 + 357 + fclose(fp); 360 358 } 361 359 362 360 static void output_label(const char *label) ··· 813 805 814 806 int main(int argc, char **argv) 815 807 { 816 - if (argc >= 2) { 817 - int i; 818 - for (i = 1; i < argc; i++) { 819 - if(strcmp(argv[i], "--all-symbols") == 0) 820 - all_symbols = 1; 821 - else if (strcmp(argv[i], "--absolute-percpu") == 0) 822 - absolute_percpu = 1; 823 - else if (strcmp(argv[i], "--base-relative") == 0) 824 - base_relative = 1; 825 - else 826 - usage(); 827 - } 828 - } else if (argc != 1) 808 + while (1) { 809 + static struct option long_options[] = { 810 + {"all-symbols", no_argument, &all_symbols, 1}, 811 + {"absolute-percpu", no_argument, &absolute_percpu, 1}, 812 + {"base-relative", no_argument, &base_relative, 1}, 813 + {}, 814 + }; 815 + 816 + int c = getopt_long(argc, argv, "", long_options, NULL); 817 + 818 + if (c == -1) 819 + break; 820 + if (c != 0) 821 + usage(); 822 + } 823 + 824 + if (optind >= argc) 829 825 usage(); 830 826 831 - read_map(stdin); 827 + read_map(argv[optind]); 832 828 shrink_table(); 833 829 if (absolute_percpu) 834 830 make_percpus_absolute();
+1 -1
scripts/kconfig/conf.c
··· 551 551 print_help(child); 552 552 continue; 553 553 } 554 - sym_set_choice_value(sym, child->sym); 554 + sym_set_tristate_value(child->sym, yes); 555 555 for (child = child->list; child; child = child->next) { 556 556 indent += 2; 557 557 conf(child);
-5
scripts/kconfig/lkc.h
··· 123 123 return (struct symbol *)sym->curr.val; 124 124 } 125 125 126 - static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) 127 - { 128 - return sym_set_tristate_value(chval, yes); 129 - } 130 - 131 126 static inline bool sym_is_choice(struct symbol *sym) 132 127 { 133 128 return sym->flags & SYMBOL_CHOICE ? true : false;
+11 -85
scripts/mkcompile_h
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 - TARGET=$1 5 - ARCH=$2 6 - SMP=$3 7 - PREEMPT=$4 8 - PREEMPT_DYNAMIC=$5 9 - PREEMPT_RT=$6 10 - CC_VERSION="$7" 11 - LD=$8 4 + UTS_MACHINE=$1 5 + CC_VERSION="$2" 6 + LD=$3 12 7 13 - # Do not expand names 14 - set -f 15 - 16 - # Fix the language to get consistent output 17 - LC_ALL=C 18 - export LC_ALL 19 - 20 - if [ -z "$KBUILD_BUILD_VERSION" ]; then 21 - VERSION=$(cat .version 2>/dev/null || echo 1) 22 - else 23 - VERSION=$KBUILD_BUILD_VERSION 24 - fi 25 - 26 - if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then 27 - TIMESTAMP=`date` 28 - else 29 - TIMESTAMP=$KBUILD_BUILD_TIMESTAMP 30 - fi 31 8 if test -z "$KBUILD_BUILD_USER"; then 32 9 LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/') 33 10 else ··· 16 39 LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST 17 40 fi 18 41 19 - UTS_VERSION="#$VERSION" 20 - CONFIG_FLAGS="" 21 - if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi 42 + LD_VERSION=$(LC_ALL=C $LD -v | head -n1 | 43 + sed -e 's/(compatible with [^)]*)//' -e 's/[[:space:]]*$//') 22 44 23 - if [ -n "$PREEMPT_RT" ] ; then 24 - CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT" 25 - elif [ -n "$PREEMPT_DYNAMIC" ] ; then 26 - CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_DYNAMIC" 27 - elif [ -n "$PREEMPT" ] ; then 28 - CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT" 29 - fi 30 - 31 - # Truncate to maximum length 32 - UTS_LEN=64 33 - UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)" 34 - 35 - # Generate a temporary compile.h 36 - 37 - { echo /\* This file is auto generated, version $VERSION \*/ 38 - if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi 39 - 40 - echo \#define UTS_MACHINE \"$ARCH\" 41 - 42 - echo \#define UTS_VERSION \"$UTS_VERSION\" 43 - 44 - printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY" 45 - echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\" 46 - 47 - LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \ 48 - | sed 's/[[:space:]]*$//') 49 - printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION" 50 - } > .tmpcompile 51 - 52 - # Only replace the real compile.h if the new one is different, 53 - # in order to preserve the timestamp and avoid unnecessary 54 - # recompilations. 55 - # We don't consider the file changed if only the date/time changed, 56 - # unless KBUILD_BUILD_TIMESTAMP was explicitly set (e.g. for 57 - # reproducible builds with that value referring to a commit timestamp). 58 - # A kernel config change will increase the generation number, thus 59 - # causing compile.h to be updated (including date/time) due to the 60 - # changed comment in the 61 - # first line. 62 - 63 - if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then 64 - IGNORE_PATTERN="UTS_VERSION" 65 - else 66 - IGNORE_PATTERN="NOT_A_PATTERN_TO_BE_MATCHED" 67 - fi 68 - 69 - if [ -r $TARGET ] && \ 70 - grep -v $IGNORE_PATTERN $TARGET > .tmpver.1 && \ 71 - grep -v $IGNORE_PATTERN .tmpcompile > .tmpver.2 && \ 72 - cmp -s .tmpver.1 .tmpver.2; then 73 - rm -f .tmpcompile 74 - else 75 - echo " UPD $TARGET" 76 - mv -f .tmpcompile $TARGET 77 - fi 78 - rm -f .tmpver.1 .tmpver.2 45 + cat <<EOF 46 + #define UTS_MACHINE "${UTS_MACHINE}" 47 + #define LINUX_COMPILE_BY "${LINUX_COMPILE_BY}" 48 + #define LINUX_COMPILE_HOST "${LINUX_COMPILE_HOST}" 49 + #define LINUX_COMPILER "${CC_VERSION}, ${LD_VERSION}" 50 + EOF
+20 -4
scripts/mksysmap
··· 37 37 38 38 # readprofile starts reading symbols when _stext is found, and 39 39 # continue until it finds a symbol which is not either of 'T', 't', 40 - # 'W' or 'w'. __crc_ are 'A' and placed in the middle 41 - # so we just ignore them to let readprofile continue to work. 42 - # (At least sparc64 has __crc_ in the middle). 40 + # 'W' or 'w'. 41 + # 42 + # Ignored prefixes: 43 + # $ - local symbols for ARM, MIPS, etc. 44 + # .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. 45 + # __crc_ - modversions 46 + # __kstrtab_ - EXPORT_SYMBOL (symbol name) 47 + # __kstrtabns_ - EXPORT_SYMBOL (namespace) 48 + # 49 + # Ignored symbols: 50 + # L0 - for LoongArch? 43 51 44 - $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)\|\( L0\)' > $2 52 + $NM -n $1 | grep -v \ 53 + -e ' [aNUw] ' \ 54 + -e ' \$' \ 55 + -e ' \.L' \ 56 + -e ' __crc_' \ 57 + -e ' __kstrtab_' \ 58 + -e ' __kstrtabns_' \ 59 + -e ' L0$' \ 60 + > $2
+2 -2
scripts/package/mkspec
··· 88 88 mkdir -p %{buildroot}/boot 89 89 %ifarch ia64 90 90 mkdir -p %{buildroot}/boot/efi 91 - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE 91 + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE 92 92 ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ 93 93 %else 94 - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE 94 + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE 95 95 %endif 96 96 $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install 97 97 $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install