Pull Kbuild updates from Masahiro Yamada: - add modpost warn exported symbols marked as 'static' because 'static' and EXPORT_SYMBOL is an odd combination - break the build early if gold linker is used - optimize the Bison rule to produce .c and .h files by a single pattern rule - handle PREEMPT_RT in the module vermagic and UTS_VERSION - warn CONFIG options leaked to the user-space except existing ones - make single targets work properly - rebuild modules when module linker scripts are updated - split the module final link stage into scripts/Makefile.modfinal - fix the missed error code in merge_config.sh - improve the error message displayed on the attempt of the O= build in unclean source tree - remove 'clean-dirs' syntax - disable -Wimplicit-fallthrough warning for Clang - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC - remove ARCH_{CPP,A,C}FLAGS variables - add $(BASH) to run bash scripts - change *CFLAGS_<basetarget>.o to take the relative path to $(obj) instead of the basename - stop suppressing Clang's -Wunused-function warnings when W=1 - fix linux/export.h to avoid genksyms calculating CRC of trimmed exported symbols - misc cleanups * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits) genksyms: convert to SPDX License Identifier for lex.l and parse.y modpost: use __section in the output to *.mod.c modpost: use MODULE_INFO() for __module_depends export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols export.h: remove defined(__KERNEL__), which is no longer needed kbuild: allow Clang to find unused static inline functions for W=1 build kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN kbuild: refactor scripts/Makefile.extrawarn merge_config.sh: ignore unwanted grep errors kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) modpost: add NOFAIL to strndup modpost: add guid_t type definition kbuild: add $(BASH) to run scripts with bash-extension kbuild: remove ARCH_{CPP,A,C}FLAGS kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC kbuild: Do not enable -Wimplicit-fallthrough for clang for now kbuild: clean up subdir-ymn calculation in Makefile.clean kbuild: remove unneeded '+' marker from cmd_clean kbuild: remove clean-dirs syntax kbuild: check clean srctree even earlier ...
Unified · Split
| @@ -34,7 +34,6 @@ · 33 unmodified lines | ||
| 34 | 34 | *.mod.c |
| 35 | 35 | *.o |
| 36 | 36 | *.o.* |
| 37 | −*.order | |
| 38 | 37 | *.patch |
| 39 | 38 | *.s |
| 40 | 39 | *.so |
| @@ -46,6 +45,7 @@ · 5 unmodified lines | ||
| 46 | 45 | *.xz |
| 47 | 46 | Module.symvers |
| 48 | 47 | modules.builtin |
| 48 | +modules.order | |
| 49 | 49 | |
| 50 | 50 | # |
| 51 | 51 | # Top-level generic files |
| @@ -105,6 +105,15 @@ The output directory can also be specified using "O=...". · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | Setting "O=..." takes precedence over KBUILD_OUTPUT. |
| 107 | 107 | |
| 108 | +KBUILD_EXTRA_WARN | |
| 109 | +----------------- | |
| 110 | +Specify the extra build checks. The same value can be assigned by passing | |
| 111 | +W=... from the command line. | |
| 112 | + | |
| 113 | +See `make help` for the list of the supported values. | |
| 114 | + | |
| 115 | +Setting "W=..." takes precedence over KBUILD_EXTRA_WARN. | |
| 116 | + | |
| 108 | 117 | KBUILD_DEBARCH |
| 109 | 118 | -------------- |
| 110 | 119 | For the deb-pkg target, allows overriding the normal heuristics deployed by |
| @@ -241,11 +250,6 @@ To get all available archs you can also specify all. E.g.:: · 130 unmodified lines | ||
| 241 | 250 | |
| 242 | 251 | $ make ALLSOURCE_ARCHS=all tags |
| 243 | 252 | |
| 244 | −KBUILD_ENABLE_EXTRA_GCC_CHECKS | |
| 245 | −------------------------------ | |
| 246 | −If enabled over the make command line with "W=1", it turns on additional | |
| 247 | −gcc -W... options for more extensive build-time checking. | |
| 248 | − | |
| 249 | 253 | KBUILD_BUILD_TIMESTAMP |
| 250 | 254 | ---------------------- |
| 251 | 255 | Setting this to a date string overrides the timestamp used in the |
| @@ -258,17 +262,3 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST · 6 unmodified lines | ||
| 258 | 262 | These two variables allow to override the user@host string displayed during |
| 259 | 263 | boot and in /proc/version. The default value is the output of the commands |
| 260 | 264 | whoami and host, respectively. |
| 261 | − | |
| 262 | −KBUILD_LDS | |
| 263 | −---------- | |
| 264 | −The linker script with full path. Assigned by the top-level Makefile. | |
| 265 | − | |
| 266 | −KBUILD_VMLINUX_OBJS | |
| 267 | −------------------- | |
| 268 | −All object files for vmlinux. They are linked to vmlinux in the same | |
| 269 | −order as listed in KBUILD_VMLINUX_OBJS. | |
| 270 | − | |
| 271 | −KBUILD_VMLINUX_LIBS | |
| 272 | −------------------- | |
| 273 | −All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS | |
| 274 | −together specify all the object files used to link vmlinux. | |
| @@ -471,21 +471,6 @@ more details, with real examples. · 470 unmodified lines | ||
| 471 | 471 | The second argument is optional, and if supplied will be used |
| 472 | 472 | if first argument is not supported. |
| 473 | 473 | |
| 474 | − cc-ldoption | |
| 475 | − cc-ldoption is used to check if $(CC) when used to link object files | |
| 476 | − supports the given option. An optional second option may be | |
| 477 | − specified if first option are not supported. | |
| 478 | − | |
| 479 | − Example:: | |
| 480 | − | |
| 481 | − #arch/x86/kernel/Makefile | |
| 482 | − vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | |
| 483 | − | |
| 484 | − In the above example, vsyscall-flags will be assigned the option | |
| 485 | − -Wl$(comma)--hash-style=sysv if it is supported by $(CC). | |
| 486 | − The second argument is optional, and if supplied will be used | |
| 487 | − if first argument is not supported. | |
| 488 | − | |
| 489 | 474 | as-instr |
| 490 | 475 | as-instr checks if the assembler reports a specific instruction |
| 491 | 476 | and then outputs either option1 or option2 |
| @@ -765,7 +750,8 @@ Files matching the patterns "*.[oas]", "*.ko", plus some additional files · 273 unmodified lines | ||
| 765 | 750 | generated by kbuild are deleted all over the kernel src tree when |
| 766 | 751 | "make clean" is executed. |
| 767 | 752 | |
| 768 | −Additional files can be specified in kbuild makefiles by use of $(clean-files). | |
| 753 | +Additional files or directories can be specified in kbuild makefiles by use of | |
| 754 | +$(clean-files). | |
| 769 | 755 | |
| 770 | 756 | Example:: |
| 771 | 757 | |
| @@ -776,23 +762,8 @@ When executing "make clean", the file "crc32table.h" will be deleted. · 4 unmodified lines | ||
| 776 | 762 | Kbuild will assume files to be in the same relative directory as the |
| 777 | 763 | Makefile, except if prefixed with $(objtree). |
| 778 | 764 | |
| 779 | −To delete a directory hierarchy use: | |
| 780 | − | |
| 781 | − Example:: | |
| 782 | − | |
| 783 | − #scripts/package/Makefile | |
| 784 | − clean-dirs := $(objtree)/debian/ | |
| 785 | − | |
| 786 | −This will delete the directory debian in the toplevel directory, including all | |
| 787 | −subdirectories. | |
| 788 | − | |
| 789 | −To exclude certain files from make clean, use the $(no-clean-files) variable. | |
| 790 | −This is only a special case used in the top level Kbuild file: | |
| 791 | − | |
| 792 | − Example:: | |
| 793 | − | |
| 794 | − #Kbuild | |
| 795 | − no-clean-files := $(bounds-file) $(offsets-file) | |
| 765 | +To exclude certain files or directories from make clean, use the | |
| 766 | +$(no-clean-files) variable. | |
| 796 | 767 | |
| 797 | 768 | Usually kbuild descends down in subdirectories due to "obj-* := dir/", |
| 798 | 769 | but in the architecture makefiles where the kbuild infrastructure |
| @@ -988,13 +959,25 @@ When kbuild executes, the following steps are followed (roughly): · 189 unmodified lines | ||
| 988 | 959 | $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic |
| 989 | 960 | mode) if this option is supported by $(AR). |
| 990 | 961 | |
| 991 | − ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS Overrides the kbuild defaults | |
| 962 | + KBUILD_LDS | |
| 963 | + | |
| 964 | + The linker script with full path. Assigned by the top-level Makefile. | |
| 965 | + | |
| 966 | + KBUILD_LDS_MODULE | |
| 967 | + | |
| 968 | + The module linker script with full path. Assigned by the top-level | |
| 969 | + Makefile and additionally by the arch Makefile. | |
| 970 | + | |
| 971 | + KBUILD_VMLINUX_OBJS | |
| 972 | + | |
| 973 | + All object files for vmlinux. They are linked to vmlinux in the same | |
| 974 | + order as listed in KBUILD_VMLINUX_OBJS. | |
| 992 | 975 | |
| 993 | − These variables are appended to the KBUILD_CPPFLAGS, | |
| 994 | − KBUILD_AFLAGS, and KBUILD_CFLAGS, respectively, after the | |
| 995 | − top-level Makefile has set any other flags. This provides a | |
| 996 | − means for an architecture to override the defaults. | |
| 976 | + KBUILD_VMLINUX_LIBS | |
| 997 | 977 | |
| 978 | + All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and | |
| 979 | + KBUILD_VMLINUX_LIBS together specify all the object files used to | |
| 980 | + link vmlinux. | |
| 998 | 981 | |
| 999 | 982 | 6.2 Add prerequisites to archheaders |
| 1000 | 983 | ------------------------------------ |
| @@ -1139,7 +1122,7 @@ When kbuild executes, the following steps are followed (roughly): · 138 unmodified lines | ||
| 1139 | 1122 | |
| 1140 | 1123 | header-test-y |
| 1141 | 1124 | |
| 1142 | − header-test-y specifies headers (*.h) in the current directory that | |
| 1125 | + header-test-y specifies headers (`*.h`) in the current directory that | |
| 1143 | 1126 | should be compile tested to ensure they are self-contained, |
| 1144 | 1127 | i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled, |
| 1145 | 1128 | this builds them as part of extra-y. |
| @@ -1147,11 +1130,11 @@ When kbuild executes, the following steps are followed (roughly): · 1 unmodified line | ||
| 1147 | 1130 | header-test-pattern-y |
| 1148 | 1131 | |
| 1149 | 1132 | This works as a weaker version of header-test-y, and accepts wildcard |
| 1150 | − patterns. The typical usage is: | |
| 1133 | + patterns. The typical usage is:: | |
| 1151 | 1134 | |
| 1152 | − header-test-pattern-y += *.h | |
| 1135 | + header-test-pattern-y += *.h | |
| 1153 | 1136 | |
| 1154 | − This specifies all the files that matches to '*.h' in the current | |
| 1137 | + This specifies all the files that matches to `*.h` in the current | |
| 1155 | 1138 | directory, but the files in 'header-test-' are excluded. |
| 1156 | 1139 | |
| 1157 | 1140 | 6.7 Commands useful for building a boot image |
| @@ -18,8 +18,6 @@ $(bounds-file): kernel/bounds.s FORCE · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | timeconst-file := include/generated/timeconst.h |
| 20 | 20 | |
| 21 | −targets += $(timeconst-file) | |
| 22 | − | |
| 23 | 21 | filechk_gentimeconst = echo $(CONFIG_HZ) | bc -q $< |
| 24 | 22 | |
| 25 | 23 | $(timeconst-file): kernel/time/timeconst.bc FORCE |
| @@ -42,7 +40,6 @@ $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE · 16 unmodified lines | ||
| 42 | 40 | # Check for missing system calls |
| 43 | 41 | |
| 44 | 42 | always += missing-syscalls |
| 45 | −targets += missing-syscalls | |
| 46 | 43 | |
| 47 | 44 | quiet_cmd_syscalls = CALL $< |
| 48 | 45 | cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags) |
| @@ -54,13 +51,9 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE · 5 unmodified lines | ||
| 54 | 51 | # Check atomic headers are up-to-date |
| 55 | 52 | |
| 56 | 53 | always += old-atomics |
| 57 | −targets += old-atomics | |
| 58 | 54 | |
| 59 | 55 | quiet_cmd_atomics = CALL $< |
| 60 | 56 | cmd_atomics = $(CONFIG_SHELL) $< |
| 61 | 57 | |
| 62 | 58 | old-atomics: scripts/atomic/check-atomics.sh FORCE |
| 63 | 59 | $(call cmd,atomics) |
| 64 | − | |
| 65 | −# Keep these three files during make clean | |
| 66 | −no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) | |
| @@ -230,6 +230,8 @@ endif · 229 unmodified lines | ||
| 230 | 230 | |
| 231 | 231 | export KBUILD_CHECKSRC KBUILD_EXTMOD |
| 232 | 232 | |
| 233 | +extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) | |
| 234 | + | |
| 233 | 235 | ifeq ($(abs_srctree),$(abs_objtree)) |
| 234 | 236 | # building in the source tree |
| 235 | 237 | srctree := . |
| @@ -271,52 +273,62 @@ no-dot-config-targets := $(clean-targets) \ · 35 unmodified lines | ||
| 271 | 273 | %asm-generic kernelversion %src-pkg |
| 272 | 274 | no-sync-config-targets := $(no-dot-config-targets) install %install \ |
| 273 | 275 | kernelrelease |
| 276 | +single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/ | |
| 274 | 277 | |
| 275 | −config-targets := 0 | |
| 276 | −mixed-targets := 0 | |
| 277 | −dot-config := 1 | |
| 278 | −may-sync-config := 1 | |
| 278 | +config-build := | |
| 279 | +mixed-build := | |
| 280 | +need-config := 1 | |
| 281 | +may-sync-config := 1 | |
| 282 | +single-build := | |
| 279 | 283 | |
| 280 | 284 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) |
| 281 | 285 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) |
| 282 | − dot-config := 0 | |
| 286 | + need-config := | |
| 283 | 287 | endif |
| 284 | 288 | endif |
| 285 | 289 | |
| 286 | 290 | ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) |
| 287 | 291 | ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) |
| 288 | − may-sync-config := 0 | |
| 292 | + may-sync-config := | |
| 289 | 293 | endif |
| 290 | 294 | endif |
| 291 | 295 | |
| 292 | 296 | ifneq ($(KBUILD_EXTMOD),) |
| 293 | − may-sync-config := 0 | |
| 297 | + may-sync-config := | |
| 294 | 298 | endif |
| 295 | 299 | |
| 296 | 300 | ifeq ($(KBUILD_EXTMOD),) |
| 297 | 301 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) |
| 298 | − config-targets := 1 | |
| 302 | + config-build := 1 | |
| 299 | 303 | ifneq ($(words $(MAKECMDGOALS)),1) |
| 300 | − mixed-targets := 1 | |
| 304 | + mixed-build := 1 | |
| 301 | 305 | endif |
| 302 | 306 | endif |
| 303 | 307 | endif |
| 304 | 308 | |
| 309 | +# We cannot build single targets and the others at the same time | |
| 310 | +ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),) | |
| 311 | + single-build := 1 | |
| 312 | + ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),) | |
| 313 | + mixed-build := 1 | |
| 314 | + endif | |
| 315 | +endif | |
| 316 | + | |
| 305 | 317 | # For "make -j clean all", "make -j mrproper defconfig all", etc. |
| 306 | 318 | ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),) |
| 307 | 319 | ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),) |
| 308 | − mixed-targets := 1 | |
| 320 | + mixed-build := 1 | |
| 309 | 321 | endif |
| 310 | 322 | endif |
| 311 | 323 | |
| 312 | 324 | # install and modules_install need also be processed one by one |
| 313 | 325 | ifneq ($(filter install,$(MAKECMDGOALS)),) |
| 314 | 326 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),) |
| 315 | − mixed-targets := 1 | |
| 327 | + mixed-build := 1 | |
| 316 | 328 | endif |
| 317 | 329 | endif |
| 318 | 330 | |
| 319 | −ifeq ($(mixed-targets),1) | |
| 331 | +ifdef mixed-build | |
| 320 | 332 | # =========================================================================== |
| 321 | 333 | # We're called with mixed targets (*config and build targets). |
| 322 | 334 | # Handle them one by one. |
| @@ -332,7 +344,7 @@ __build_one_by_one: · 9 unmodified lines | ||
| 332 | 344 | $(MAKE) -f $(srctree)/Makefile $$i; \ |
| 333 | 345 | done |
| 334 | 346 | |
| 335 | −else | |
| 347 | +else # !mixed-build | |
| 336 | 348 | |
| 337 | 349 | include scripts/Kbuild.include |
| 338 | 350 | |
| @@ -392,9 +404,7 @@ KCONFIG_CONFIG ?= .config · 53 unmodified lines | ||
| 392 | 404 | export KCONFIG_CONFIG |
| 393 | 405 | |
| 394 | 406 | # SHELL used by kbuild |
| 395 | −CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | |
| 396 | − else if [ -x /bin/bash ]; then echo /bin/bash; \ | |
| 397 | − else echo sh; fi ; fi) | |
| 407 | +CONFIG_SHELL := sh | |
| 398 | 408 | |
| 399 | 409 | HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) |
| 400 | 410 | HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null) |
| @@ -431,6 +441,7 @@ PYTHON = python · 30 unmodified lines | ||
| 431 | 441 | PYTHON2 = python2 |
| 432 | 442 | PYTHON3 = python3 |
| 433 | 443 | CHECK = sparse |
| 444 | +BASH = bash | |
| 434 | 445 | |
| 435 | 446 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ |
| 436 | 447 | -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) |
| @@ -470,12 +481,13 @@ KBUILD_AFLAGS_KERNEL := · 33 unmodified lines | ||
| 470 | 481 | KBUILD_CFLAGS_KERNEL := |
| 471 | 482 | KBUILD_AFLAGS_MODULE := -DMODULE |
| 472 | 483 | KBUILD_CFLAGS_MODULE := -DMODULE |
| 473 | −KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds | |
| 484 | +KBUILD_LDFLAGS_MODULE := | |
| 485 | +export KBUILD_LDS_MODULE := $(srctree)/scripts/module-common.lds | |
| 474 | 486 | KBUILD_LDFLAGS := |
| 475 | 487 | GCC_PLUGINS_CFLAGS := |
| 476 | 488 | CLANG_FLAGS := |
| 477 | 489 | |
| 478 | −export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC | |
| 490 | +export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC | |
| 479 | 491 | export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE PAHOLE LEX YACC AWK INSTALLKERNEL |
| 480 | 492 | export PERL PYTHON PYTHON2 PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX |
| 481 | 493 | export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE |
| @@ -506,6 +518,7 @@ scripts_basic: · 24 unmodified lines | ||
| 506 | 518 | $(Q)rm -f .tmp_quiet_recordmcount |
| 507 | 519 | |
| 508 | 520 | PHONY += outputmakefile |
| 521 | +# Before starting out-of-tree build, make sure the source tree is clean. | |
| 509 | 522 | # outputmakefile generates a Makefile in the output directory, if using a |
| 510 | 523 | # separate output directory. This allows convenient use of make in the |
| 511 | 524 | # output directory. |
| @@ -513,6 +526,15 @@ PHONY += outputmakefile · 1 unmodified line | ||
| 513 | 526 | # ignore whole output directory |
| 514 | 527 | outputmakefile: |
| 515 | 528 | ifdef building_out_of_srctree |
| 529 | + $(Q)if [ -f $(srctree)/.config -o \ | |
| 530 | + -d $(srctree)/include/config -o \ | |
| 531 | + -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ | |
| 532 | + echo >&2 "***"; \ | |
| 533 | + echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \ | |
| 534 | + echo >&2 "*** in $(abs_srctree)";\ | |
| 535 | + echo >&2 "***"; \ | |
| 536 | + false; \ | |
| 537 | + fi | |
| 516 | 538 | $(Q)ln -fsn $(srctree) source |
| 517 | 539 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) |
| 518 | 540 | $(Q)test -e .gitignore || \ |
| @@ -544,7 +566,7 @@ endif · 25 unmodified lines | ||
| 544 | 566 | # and from include/config/auto.conf.cmd to detect the compiler upgrade. |
| 545 | 567 | CC_VERSION_TEXT = $(shell $(CC) --version 2>/dev/null | head -n 1) |
| 546 | 568 | |
| 547 | −ifeq ($(config-targets),1) | |
| 569 | +ifdef config-build | |
| 548 | 570 | # =========================================================================== |
| 549 | 571 | # *config targets only - make sure prerequisites are updated, and descend |
| 550 | 572 | # in scripts/kconfig to make the *config target |
| @@ -555,13 +577,13 @@ ifeq ($(config-targets),1) · 4 unmodified lines | ||
| 555 | 577 | include arch/$(SRCARCH)/Makefile |
| 556 | 578 | export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT |
| 557 | 579 | |
| 558 | −config: scripts_basic outputmakefile FORCE | |
| 580 | +config: outputmakefile scripts_basic FORCE | |
| 559 | 581 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
| 560 | 582 | |
| 561 | −%config: scripts_basic outputmakefile FORCE | |
| 583 | +%config: outputmakefile scripts_basic FORCE | |
| 562 | 584 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
| 563 | 585 | |
| 564 | −else | |
| 586 | +else #!config-build | |
| 565 | 587 | # =========================================================================== |
| 566 | 588 | # Build targets only - this includes vmlinux, arch specific targets, clean |
| 567 | 589 | # targets and others. In general all targets except *config targets. |
| @@ -604,7 +626,7 @@ endif · 36 unmodified lines | ||
| 604 | 626 | |
| 605 | 627 | export KBUILD_MODULES KBUILD_BUILTIN |
| 606 | 628 | |
| 607 | −ifeq ($(dot-config),1) | |
| 629 | +ifdef need-config | |
| 608 | 630 | include include/config/auto.conf |
| 609 | 631 | endif |
| 610 | 632 | |
| @@ -645,15 +667,10 @@ RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc · 34 unmodified lines | ||
| 645 | 667 | export RETPOLINE_CFLAGS |
| 646 | 668 | export RETPOLINE_VDSO_CFLAGS |
| 647 | 669 | |
| 648 | −# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default | |
| 649 | −# values of the respective KBUILD_* variables | |
| 650 | −ARCH_CPPFLAGS := | |
| 651 | −ARCH_AFLAGS := | |
| 652 | −ARCH_CFLAGS := | |
| 653 | 670 | include arch/$(SRCARCH)/Makefile |
| 654 | 671 | |
| 655 | −ifeq ($(dot-config),1) | |
| 656 | −ifeq ($(may-sync-config),1) | |
| 672 | +ifdef need-config | |
| 673 | +ifdef may-sync-config | |
| 657 | 674 | # Read in dependencies to all Kconfig* files, make sure to run syncconfig if |
| 658 | 675 | # changes are detected. This should be included after arch/$(SRCARCH)/Makefile |
| 659 | 676 | # because some architectures define CROSS_COMPILE there. |
| @@ -676,7 +693,7 @@ $(KCONFIG_CONFIG): · 16 unmodified lines | ||
| 676 | 693 | # The syncconfig should be executed only once to make all the targets. |
| 677 | 694 | %/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG) |
| 678 | 695 | $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig |
| 679 | −else | |
| 696 | +else # !may-sync-config | |
| 680 | 697 | # External modules and some install targets need include/generated/autoconf.h |
| 681 | 698 | # and include/config/auto.conf but do not care if they are up-to-date. |
| 682 | 699 | # Use auto.conf to trigger the test |
| @@ -692,7 +709,7 @@ include/config/auto.conf: · 9 unmodified lines | ||
| 692 | 709 | /bin/false) |
| 693 | 710 | |
| 694 | 711 | endif # may-sync-config |
| 695 | −endif # $(dot-config) | |
| 712 | +endif # need-config | |
| 696 | 713 | |
| 697 | 714 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
| 698 | 715 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) |
| @@ -700,10 +717,12 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) · 1 unmodified line | ||
| 700 | 717 | KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) |
| 701 | 718 | KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) |
| 702 | 719 | |
| 703 | −ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | |
| 704 | −KBUILD_CFLAGS += -Os | |
| 705 | −else | |
| 706 | −KBUILD_CFLAGS += -O2 | |
| 720 | +ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE | |
| 721 | +KBUILD_CFLAGS += -O2 | |
| 722 | +else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 | |
| 723 | +KBUILD_CFLAGS += -O3 | |
| 724 | +else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | |
| 725 | +KBUILD_CFLAGS += -Os | |
| 707 | 726 | endif |
| 708 | 727 | |
| 709 | 728 | ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED |
| @@ -751,6 +770,11 @@ else · 41 unmodified lines | ||
| 751 | 770 | # These warnings generated too much noise in a regular build. |
| 752 | 771 | # Use make W=1 to enable them (see scripts/Makefile.extrawarn) |
| 753 | 772 | KBUILD_CFLAGS += -Wno-unused-but-set-variable |
| 773 | + | |
| 774 | +# Warn about unmarked fall-throughs in switch statement. | |
| 775 | +# Disabled for clang while comment to attribute conversion happens and | |
| 776 | +# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed. | |
| 777 | +KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) | |
| 754 | 778 | endif |
| 755 | 779 | |
| 756 | 780 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) |
| @@ -845,9 +869,6 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) · 88 unmodified lines | ||
| 845 | 869 | # warn about C99 declaration after statement |
| 846 | 870 | KBUILD_CFLAGS += -Wdeclaration-after-statement |
| 847 | 871 | |
| 848 | −# Warn about unmarked fall-throughs in switch statement. | |
| 849 | −KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,) | |
| 850 | − | |
| 851 | 872 | # Variable Length Arrays (VLAs) should not be used anywhere in the kernel |
| 852 | 873 | KBUILD_CFLAGS += -Wvla |
| 853 | 874 | |
| @@ -900,11 +921,10 @@ include scripts/Makefile.kasan · 46 unmodified lines | ||
| 900 | 921 | include scripts/Makefile.extrawarn |
| 901 | 922 | include scripts/Makefile.ubsan |
| 902 | 923 | |
| 903 | −# Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the | |
| 904 | −# last assignments | |
| 905 | −KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS) | |
| 906 | −KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS) | |
| 907 | −KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS) | |
| 924 | +# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | |
| 925 | +KBUILD_CPPFLAGS += $(KCPPFLAGS) | |
| 926 | +KBUILD_AFLAGS += $(KAFLAGS) | |
| 927 | +KBUILD_CFLAGS += $(KCFLAGS) | |
| 908 | 928 | |
| 909 | 929 | KBUILD_LDFLAGS_MODULE += --build-id |
| 910 | 930 | LDFLAGS_vmlinux += --build-id |
| @@ -1007,7 +1027,7 @@ endif · 96 unmodified lines | ||
| 1007 | 1027 | |
| 1008 | 1028 | PHONY += prepare0 |
| 1009 | 1029 | |
| 1010 | −export MODORDER := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order | |
| 1030 | +export MODORDER := $(extmod-prefix)modules.order | |
| 1011 | 1031 | |
| 1012 | 1032 | ifeq ($(KBUILD_EXTMOD),) |
| 1013 | 1033 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ |
| @@ -1020,6 +1040,9 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \ · 6 unmodified lines | ||
| 1020 | 1040 | $(patsubst %/,%,$(filter %/, $(init-) $(core-) \ |
| 1021 | 1041 | $(drivers-) $(net-) $(libs-) $(virt-)))) |
| 1022 | 1042 | |
| 1043 | +build-dirs := $(vmlinux-dirs) | |
| 1044 | +clean-dirs := $(vmlinux-alldirs) | |
| 1045 | + | |
| 1023 | 1046 | init-y := $(patsubst %/, %/built-in.a, $(init-y)) |
| 1024 | 1047 | core-y := $(patsubst %/, %/built-in.a, $(core-y)) |
| 1025 | 1048 | drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y)) |
| @@ -1042,7 +1065,7 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) · 16 unmodified lines | ||
| 1042 | 1065 | # Recurse until adjust_autoksyms.sh is satisfied |
| 1043 | 1066 | PHONY += autoksyms_recursive |
| 1044 | 1067 | ifdef CONFIG_TRIM_UNUSED_KSYMS |
| 1045 | −autoksyms_recursive: $(vmlinux-deps) modules.order | |
| 1068 | +autoksyms_recursive: descend modules.order | |
| 1046 | 1069 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ |
| 1047 | 1070 | "$(MAKE) -f $(srctree)/Makefile vmlinux" |
| 1048 | 1071 | endif |
| @@ -1074,17 +1097,7 @@ targets := vmlinux · 25 unmodified lines | ||
| 1074 | 1097 | |
| 1075 | 1098 | # The actual objects are generated when descending, |
| 1076 | 1099 | # make sure no implicit rule kicks in |
| 1077 | −$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; | |
| 1078 | − | |
| 1079 | −# Handle descending into subdirectories listed in $(vmlinux-dirs) | |
| 1080 | −# Preset locale variables to speed up the build process. Limit locale | |
| 1081 | −# tweaks to this spot to avoid wrong language settings when running | |
| 1082 | −# make menuconfig etc. | |
| 1083 | −# Error messages still appears in the original language | |
| 1084 | − | |
| 1085 | −PHONY += $(vmlinux-dirs) | |
| 1086 | −$(vmlinux-dirs): prepare | |
| 1087 | − $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 | |
| 1100 | +$(sort $(vmlinux-deps)): descend ; | |
| 1088 | 1101 | |
| 1089 | 1102 | filechk_kernel.release = \ |
| 1090 | 1103 | echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
| @@ -1106,24 +1119,9 @@ scripts: scripts_basic scripts_dtc · 15 unmodified lines | ||
| 1106 | 1119 | # archprepare is used in arch Makefiles and when processed asm symlink, |
| 1107 | 1120 | # version.h and scripts_basic is processed / created. |
| 1108 | 1121 | |
| 1109 | −PHONY += prepare archprepare prepare3 | |
| 1122 | +PHONY += prepare archprepare | |
| 1110 | 1123 | |
| 1111 | −# prepare3 is used to check if we are building in a separate output directory, | |
| 1112 | −# and if so do: | |
| 1113 | −# 1) Check that make has not been executed in the kernel src $(srctree) | |
| 1114 | −prepare3: include/config/kernel.release | |
| 1115 | −ifdef building_out_of_srctree | |
| 1116 | − @$(kecho) ' Using $(srctree) as source for kernel' | |
| 1117 | − $(Q)if [ -f $(srctree)/.config -o \ | |
| 1118 | − -d $(srctree)/include/config -o \ | |
| 1119 | − -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ | |
| 1120 | − echo >&2 " $(srctree) is not clean, please run 'make ARCH=$(ARCH) mrproper'"; \ | |
| 1121 | − echo >&2 " in the '$(srctree)' directory.";\ | |
| 1122 | − /bin/false; \ | |
| 1123 | − fi; | |
| 1124 | −endif | |
| 1125 | − | |
| 1126 | −archprepare: archheaders archscripts scripts prepare3 outputmakefile \ | |
| 1124 | +archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ | |
| 1127 | 1125 | asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h |
| 1128 | 1126 | |
| 1129 | 1127 | prepare0: archprepare |
| @@ -1248,7 +1246,7 @@ kselftest-merge: · 118 unmodified lines | ||
| 1248 | 1246 | $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!)) |
| 1249 | 1247 | $(Q)find $(srctree)/tools/testing/selftests -name config | \ |
| 1250 | 1248 | xargs $(srctree)/scripts/kconfig/merge_config.sh -m $(objtree)/.config |
| 1251 | − +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig | |
| 1249 | + $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig | |
| 1252 | 1250 | |
| 1253 | 1251 | # --------------------------------------------------------------------------- |
| 1254 | 1252 | # Devicetree files |
| @@ -1259,11 +1257,11 @@ endif · 4 unmodified lines | ||
| 1259 | 1257 | |
| 1260 | 1258 | ifneq ($(dtstree),) |
| 1261 | 1259 | |
| 1262 | −%.dtb: prepare3 scripts_dtc | |
| 1260 | +%.dtb: include/config/kernel.release scripts_dtc | |
| 1263 | 1261 | $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ |
| 1264 | 1262 | |
| 1265 | 1263 | PHONY += dtbs dtbs_install dt_binding_check |
| 1266 | −dtbs dtbs_check: prepare3 scripts_dtc | |
| 1264 | +dtbs dtbs_check: include/config/kernel.release scripts_dtc | |
| 1267 | 1265 | $(Q)$(MAKE) $(build)=$(dtstree) |
| 1268 | 1266 | |
| 1269 | 1267 | dtbs_check: export CHECK_DTBS=1 |
| @@ -1302,17 +1300,16 @@ all: modules · 32 unmodified lines | ||
| 1302 | 1300 | |
| 1303 | 1301 | PHONY += modules |
| 1304 | 1302 | modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin |
| 1305 | − @$(kecho) ' Building modules, stage 2.'; | |
| 1306 | 1303 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| 1307 | 1304 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh |
| 1308 | 1305 | |
| 1309 | −modules.order: $(vmlinux-dirs) | |
| 1310 | − $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@ | |
| 1306 | +modules.order: descend | |
| 1307 | + $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ | |
| 1311 | 1308 | |
| 1312 | −modbuiltin-dirs := $(addprefix _modbuiltin_, $(vmlinux-dirs)) | |
| 1309 | +modbuiltin-dirs := $(addprefix _modbuiltin_, $(build-dirs)) | |
| 1313 | 1310 | |
| 1314 | 1311 | modules.builtin: $(modbuiltin-dirs) |
| 1315 | − $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(vmlinux-dirs)) > $@ | |
| 1312 | + $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ | |
| 1316 | 1313 | |
| 1317 | 1314 | PHONY += $(modbuiltin-dirs) |
| 1318 | 1315 | # tristate.conf is not included from this Makefile. Add it as a prerequisite |
| @@ -1385,12 +1382,14 @@ CLEAN_FILES += modules.builtin.modinfo · 66 unmodified lines | ||
| 1385 | 1382 | |
| 1386 | 1383 | # Directories & files removed with 'make mrproper' |
| 1387 | 1384 | MRPROPER_DIRS += include/config include/generated \ |
| 1388 | − arch/$(SRCARCH)/include/generated .tmp_objdiff | |
| 1385 | + arch/$(SRCARCH)/include/generated .tmp_objdiff \ | |
| 1386 | + debian/ snap/ tar-install/ | |
| 1389 | 1387 | MRPROPER_FILES += .config .config.old .version \ |
| 1390 | 1388 | Module.symvers \ |
| 1391 | 1389 | signing_key.pem signing_key.priv signing_key.x509 \ |
| 1392 | 1390 | x509.genkey extra_certificates signing_key.x509.keyid \ |
| 1393 | − signing_key.x509.signer vmlinux-gdb.py | |
| 1391 | + signing_key.x509.signer vmlinux-gdb.py \ | |
| 1392 | + *.spec | |
| 1394 | 1393 | |
| 1395 | 1394 | # Directories & files removed with 'make distclean' |
| 1396 | 1395 | DISTCLEAN_DIRS += |
| @@ -1400,11 +1399,8 @@ DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS · 3 unmodified lines | ||
| 1400 | 1399 | # |
| 1401 | 1400 | clean: rm-dirs := $(CLEAN_DIRS) |
| 1402 | 1401 | clean: rm-files := $(CLEAN_FILES) |
| 1403 | −clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs)) | |
| 1404 | 1402 | |
| 1405 | −PHONY += $(clean-dirs) clean archclean vmlinuxclean | |
| 1406 | −$(clean-dirs): | |
| 1407 | − $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | |
| 1403 | +PHONY += archclean vmlinuxclean | |
| 1408 | 1404 | |
| 1409 | 1405 | vmlinuxclean: |
| 1410 | 1406 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean |
| @@ -1445,13 +1441,11 @@ distclean: mrproper · 34 unmodified lines | ||
| 1445 | 1441 | |
| 1446 | 1442 | # Packaging of the kernel to various formats |
| 1447 | 1443 | # --------------------------------------------------------------------------- |
| 1448 | −package-dir := scripts/package | |
| 1449 | 1444 | |
| 1450 | 1445 | %src-pkg: FORCE |
| 1451 | − $(Q)$(MAKE) $(build)=$(package-dir) $@ | |
| 1446 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ | |
| 1452 | 1447 | %pkg: include/config/kernel.release FORCE |
| 1453 | − $(Q)$(MAKE) $(build)=$(package-dir) $@ | |
| 1454 | − | |
| 1448 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@ | |
| 1455 | 1449 | |
| 1456 | 1450 | # Brief documentation of the typical targets used |
| 1457 | 1451 | # --------------------------------------------------------------------------- |
| @@ -1525,7 +1519,7 @@ help: · 67 unmodified lines | ||
| 1525 | 1519 | @echo ' or "cd tools; make help"' |
| 1526 | 1520 | @echo '' |
| 1527 | 1521 | @echo 'Kernel packaging:' |
| 1528 | − @$(MAKE) $(build)=$(package-dir) help | |
| 1522 | + @$(MAKE) -f $(srctree)/scripts/Makefile.package help | |
| 1529 | 1523 | @echo '' |
| 1530 | 1524 | @echo 'Documentation targets:' |
| 1531 | 1525 | @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp |
| @@ -1550,7 +1544,7 @@ help: · 18 unmodified lines | ||
| 1550 | 1544 | @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)' |
| 1551 | 1545 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' |
| 1552 | 1546 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' |
| 1553 | − @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' | |
| 1547 | + @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where' | |
| 1554 | 1548 | @echo ' 1: warnings which may be relevant and do not occur too often' |
| 1555 | 1549 | @echo ' 2: warnings which occur quite often but may still be relevant' |
| 1556 | 1550 | @echo ' 3: more obscure warnings, can most likely be ignored' |
| @@ -1579,7 +1573,7 @@ $(help-board-dirs): help-%: · 22 unmodified lines | ||
| 1579 | 1573 | DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \ |
| 1580 | 1574 | linkcheckdocs dochelp refcheckdocs |
| 1581 | 1575 | PHONY += $(DOC_TARGETS) |
| 1582 | −$(DOC_TARGETS): scripts_basic FORCE | |
| 1576 | +$(DOC_TARGETS): | |
| 1583 | 1577 | $(Q)$(MAKE) $(build)=Documentation $@ |
| 1584 | 1578 | |
| 1585 | 1579 | # Misc |
| @@ -1624,13 +1618,9 @@ $(objtree)/Module.symvers: · 38 unmodified lines | ||
| 1624 | 1618 | echo " is missing; modules will have no dependencies and modversions."; \ |
| 1625 | 1619 | echo ) |
| 1626 | 1620 | |
| 1627 | −module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) | |
| 1628 | −PHONY += $(module-dirs) modules | |
| 1629 | −$(module-dirs): prepare $(objtree)/Module.symvers | |
| 1630 | − $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) need-modorder=1 | |
| 1631 | − | |
| 1632 | −modules: $(module-dirs) | |
| 1633 | − @$(kecho) ' Building modules, stage 2.'; | |
| 1621 | +build-dirs := $(KBUILD_EXTMOD) | |
| 1622 | +PHONY += modules | |
| 1623 | +modules: descend $(objtree)/Module.symvers | |
| 1634 | 1624 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| 1635 | 1625 | |
| 1636 | 1626 | PHONY += modules_install |
| @@ -1646,14 +1636,13 @@ PHONY += _emodinst_post · 9 unmodified lines | ||
| 1646 | 1636 | _emodinst_post: _emodinst_ |
| 1647 | 1637 | $(call cmd,depmod) |
| 1648 | 1638 | |
| 1649 | −clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) | |
| 1650 | − | |
| 1651 | −PHONY += $(clean-dirs) clean | |
| 1652 | −$(clean-dirs): | |
| 1653 | − $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | |
| 1654 | − | |
| 1639 | +clean-dirs := $(KBUILD_EXTMOD) | |
| 1655 | 1640 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers |
| 1656 | 1641 | |
| 1642 | +PHONY += / | |
| 1643 | +/: | |
| 1644 | + @echo >&2 '"$(MAKE) /" is no longer supported. Please use "$(MAKE) ./" instead.' | |
| 1645 | + | |
| 1657 | 1646 | PHONY += help |
| 1658 | 1647 | help: |
| 1659 | 1648 | @echo ' Building external modules.' |
| @@ -1667,6 +1656,21 @@ help: · 7 unmodified lines | ||
| 1667 | 1656 | PHONY += prepare |
| 1668 | 1657 | endif # KBUILD_EXTMOD |
| 1669 | 1658 | |
| 1659 | +# Handle descending into subdirectories listed in $(build-dirs) | |
| 1660 | +# Preset locale variables to speed up the build process. Limit locale | |
| 1661 | +# tweaks to this spot to avoid wrong language settings when running | |
| 1662 | +# make menuconfig etc. | |
| 1663 | +# Error messages still appears in the original language | |
| 1664 | +PHONY += descend $(build-dirs) | |
| 1665 | +descend: $(build-dirs) | |
| 1666 | +$(build-dirs): prepare | |
| 1667 | + $(Q)$(MAKE) $(build)=$@ single-build=$(single-build) need-builtin=1 need-modorder=1 | |
| 1668 | + | |
| 1669 | +clean-dirs := $(addprefix _clean_, $(clean-dirs)) | |
| 1670 | +PHONY += $(clean-dirs) clean | |
| 1671 | +$(clean-dirs): | |
| 1672 | + $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | |
| 1673 | + | |
| 1670 | 1674 | clean: $(clean-dirs) |
| 1671 | 1675 | $(call cmd,rmdirs) |
| 1672 | 1676 | $(call cmd,rmfiles) |
| @@ -1688,7 +1692,7 @@ clean: $(clean-dirs) · 15 unmodified lines | ||
| 1688 | 1692 | # Generate tags for editors |
| 1689 | 1693 | # --------------------------------------------------------------------------- |
| 1690 | 1694 | quiet_cmd_tags = GEN $@ |
| 1691 | − cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ | |
| 1695 | + cmd_tags = $(BASH) $(srctree)/scripts/tags.sh $@ | |
| 1692 | 1696 | |
| 1693 | 1697 | tags TAGS cscope gtags: FORCE |
| 1694 | 1698 | $(call cmd,tags) |
| @@ -1709,7 +1713,7 @@ versioncheck: · 14 unmodified lines | ||
| 1709 | 1713 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl |
| 1710 | 1714 | |
| 1711 | 1715 | coccicheck: |
| 1712 | − $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@ | |
| 1716 | + $(Q)$(BASH) $(srctree)/scripts/$@ | |
| 1713 | 1717 | |
| 1714 | 1718 | namespacecheck: |
| 1715 | 1719 | $(PERL) $(srctree)/scripts/namespace.pl |
| @@ -1757,45 +1761,47 @@ tools/%: FORCE · 41 unmodified lines | ||
| 1757 | 1761 | |
| 1758 | 1762 | # Single targets |
| 1759 | 1763 | # --------------------------------------------------------------------------- |
| 1760 | −# Single targets are compatible with: | |
| 1761 | −# - build with mixed source and output | |
| 1762 | −# - build with separate output dir 'make O=...' | |
| 1763 | −# - external modules | |
| 1764 | +# To build individual files in subdirectories, you can do like this: | |
| 1765 | +# | |
| 1766 | +# make foo/bar/baz.s | |
| 1764 | 1767 | # |
| 1765 | −# target-dir => where to store outputfile | |
| 1766 | −# build-dir => directory in kernel source tree to use | |
| 1767 | − | |
| 1768 | −build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@ | |
| 1769 | −build-dir = $(patsubst %/,%,$(dir $(build-target))) | |
| 1770 | − | |
| 1771 | −%.i: prepare FORCE | |
| 1772 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1773 | −%.ll: prepare FORCE | |
| 1774 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1775 | −%.lst: prepare FORCE | |
| 1776 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1777 | −%.o: prepare FORCE | |
| 1778 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1779 | −%.s: prepare FORCE | |
| 1780 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1781 | −%.symtypes: prepare FORCE | |
| 1782 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target) | |
| 1768 | +# The supported suffixes for single-target are listed in 'single-targets' | |
| 1769 | +# | |
| 1770 | +# To build only under specific subdirectories, you can do like this: | |
| 1771 | +# | |
| 1772 | +# make foo/bar/baz/ | |
| 1773 | + | |
| 1774 | +ifdef single-build | |
| 1775 | + | |
| 1776 | +single-all := $(filter $(single-targets), $(MAKECMDGOALS)) | |
| 1777 | + | |
| 1778 | +# .ko is special because modpost is needed | |
| 1779 | +single-ko := $(sort $(filter %.ko, $(single-all))) | |
| 1780 | +single-no-ko := $(sort $(patsubst %.ko,%.mod, $(single-all))) | |
| 1781 | + | |
| 1782 | +$(single-ko): single_modpost | |
| 1783 | + @: | |
| 1784 | +$(single-no-ko): descend | |
| 1785 | + @: | |
| 1786 | + | |
| 1783 | 1787 | ifeq ($(KBUILD_EXTMOD),) |
| 1784 | −# For the single build of an in-tree module, use a temporary file to avoid | |
| 1788 | +# For the single build of in-tree modules, use a temporary file to avoid | |
| 1785 | 1789 | # the situation of modules_install installing an invalid modules.order. |
| 1786 | −%.ko: MODORDER := .modules.tmp | |
| 1790 | +MODORDER := .modules.tmp | |
| 1787 | 1791 | endif |
| 1788 | −%.ko: prepare FORCE | |
| 1789 | − $(Q)$(MAKE) $(build)=$(build-dir) $(build-target:.ko=.mod) | |
| 1790 | − $(Q)echo $(build-target) > $(MODORDER) | |
| 1792 | + | |
| 1793 | +PHONY += single_modpost | |
| 1794 | +single_modpost: $(single-no-ko) | |
| 1795 | + $(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER) | |
| 1791 | 1796 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
| 1792 | 1797 | |
| 1793 | −# Modules | |
| 1794 | −PHONY += / | |
| 1795 | −/: ./ | |
| 1798 | +KBUILD_MODULES := 1 | |
| 1796 | 1799 | |
| 1797 | −%/: prepare FORCE | |
| 1798 | − $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) need-modorder=1 | |
| 1800 | +export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko)) | |
| 1801 | + | |
| 1802 | +single-build = $(if $(filter-out $@/, $(single-no-ko)),1) | |
| 1803 | + | |
| 1804 | +endif | |
| 1799 | 1805 | |
| 1800 | 1806 | # FIXME Should go into a make.lib or something |
| 1801 | 1807 | # =========================================================================== |
| @@ -1816,9 +1822,9 @@ existing-targets := $(wildcard $(sort $(targets))) · 14 unmodified lines | ||
| 1816 | 1822 | |
| 1817 | 1823 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
| 1818 | 1824 | |
| 1819 | −endif # ifeq ($(config-targets),1) | |
| 1820 | −endif # ifeq ($(mixed-targets),1) | |
| 1821 | −endif # need-sub-make | |
| 1825 | +endif # config-targets | |
| 1826 | +endif # mixed-build | |
| 1827 | +endif # need-sub-make | |
| 1822 | 1828 | |
| 1823 | 1829 | PHONY += FORCE |
| 1824 | 1830 | FORCE: |
| @@ -292,6 +292,13 @@ config ARCH_32BIT_OFF_T · 291 unmodified lines | ||
| 292 | 292 | still support 32-bit off_t. This option is enabled for all such |
| 293 | 293 | architectures explicitly. |
| 294 | 294 | |
| 295 | +config HAVE_ASM_MODVERSIONS | |
| 296 | + bool | |
| 297 | + help | |
| 298 | + This symbol should be selected by an architecure if it provides | |
| 299 | + <asm/asm-prototypes.h> to support the module versioning for symbols | |
| 300 | + exported from assembly code. | |
| 301 | + | |
| 295 | 302 | config HAVE_REGS_AND_STACK_ACCESS_API |
| 296 | 303 | bool |
| 297 | 304 | help |
| @@ -11,6 +11,7 @@ config ALPHA · 10 unmodified lines | ||
| 11 | 11 | select PCI_DOMAINS if PCI |
| 12 | 12 | select PCI_SYSCALL if PCI |
| 13 | 13 | select HAVE_AOUT |
| 14 | + select HAVE_ASM_MODVERSIONS | |
| 14 | 15 | select HAVE_IDE |
| 15 | 16 | select HAVE_OPROFILE |
| 16 | 17 | select HAVE_PCSPKR_PLATFORM |
| @@ -48,14 +48,6 @@ endif · 47 unmodified lines | ||
| 48 | 48 | cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI) |
| 49 | 49 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) |
| 50 | 50 | |
| 51 | −ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE | |
| 52 | −# Generic build system uses -O2, we want -O3 | |
| 53 | −# Note: No need to add to cflags-y as that happens anyways | |
| 54 | −# | |
| 55 | −# Disable the false maybe-uninitialized warings gcc spits out at -O3 | |
| 56 | −ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,) | |
| 57 | −endif | |
| 58 | − | |
| 59 | 51 | # small data is default for elf32 tool-chain. If not usable, disable it |
| 60 | 52 | # This also allows repurposing GP as scratch reg to gcc reg allocator |
| 61 | 53 | disable_small_data := y |
| @@ -9,6 +9,7 @@ CONFIG_NAMESPACES=y · 8 unmodified lines | ||
| 9 | 9 | # CONFIG_UTS_NS is not set |
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | CONFIG_BLK_DEV_INITRD=y |
| 12 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 12 | 13 | CONFIG_EMBEDDED=y |
| 13 | 14 | CONFIG_PERF_EVENTS=y |
| 14 | 15 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -9,6 +9,7 @@ CONFIG_NAMESPACES=y · 8 unmodified lines | ||
| 9 | 9 | # CONFIG_UTS_NS is not set |
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | CONFIG_BLK_DEV_INITRD=y |
| 12 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 12 | 13 | CONFIG_EMBEDDED=y |
| 13 | 14 | CONFIG_PERF_EVENTS=y |
| 14 | 15 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -9,6 +9,7 @@ CONFIG_NAMESPACES=y · 8 unmodified lines | ||
| 9 | 9 | # CONFIG_UTS_NS is not set |
| 10 | 10 | # CONFIG_PID_NS is not set |
| 11 | 11 | CONFIG_BLK_DEV_INITRD=y |
| 12 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 12 | 13 | CONFIG_EMBEDDED=y |
| 13 | 14 | CONFIG_PERF_EVENTS=y |
| 14 | 15 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_EXPERT=y |
| 14 | 15 | CONFIG_PERF_EVENTS=y |
| 15 | 16 | # CONFIG_COMPAT_BRK is not set |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_EMBEDDED=y |
| 14 | 15 | CONFIG_PERF_EVENTS=y |
| 15 | 16 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -9,6 +9,7 @@ CONFIG_NAMESPACES=y · 8 unmodified lines | ||
| 9 | 9 | # CONFIG_PID_NS is not set |
| 10 | 10 | CONFIG_BLK_DEV_INITRD=y |
| 11 | 11 | CONFIG_BLK_DEV_RAM=y |
| 12 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 12 | 13 | CONFIG_EMBEDDED=y |
| 13 | 14 | CONFIG_PERF_EVENTS=y |
| 14 | 15 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -6,6 +6,7 @@ CONFIG_HIGH_RES_TIMERS=y · 5 unmodified lines | ||
| 6 | 6 | CONFIG_IKCONFIG=y |
| 7 | 7 | CONFIG_IKCONFIG_PROC=y |
| 8 | 8 | CONFIG_BLK_DEV_INITRD=y |
| 9 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 9 | 10 | CONFIG_SYSCTL_SYSCALL=y |
| 10 | 11 | # CONFIG_EPOLL is not set |
| 11 | 12 | # CONFIG_SIGNALFD is not set |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_KALLSYMS_ALL=y |
| 14 | 15 | CONFIG_EMBEDDED=y |
| 15 | 16 | CONFIG_PERF_EVENTS=y |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_KALLSYMS_ALL=y |
| 14 | 15 | CONFIG_EMBEDDED=y |
| 15 | 16 | CONFIG_PERF_EVENTS=y |
| @@ -8,6 +8,7 @@ CONFIG_NAMESPACES=y · 7 unmodified lines | ||
| 8 | 8 | # CONFIG_UTS_NS is not set |
| 9 | 9 | # CONFIG_PID_NS is not set |
| 10 | 10 | CONFIG_BLK_DEV_INITRD=y |
| 11 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 11 | 12 | CONFIG_KALLSYMS_ALL=y |
| 12 | 13 | CONFIG_EMBEDDED=y |
| 13 | 14 | CONFIG_PERF_EVENTS=y |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_KALLSYMS_ALL=y |
| 14 | 15 | CONFIG_EMBEDDED=y |
| 15 | 16 | CONFIG_PERF_EVENTS=y |
| @@ -10,6 +10,7 @@ CONFIG_NAMESPACES=y · 9 unmodified lines | ||
| 10 | 10 | # CONFIG_UTS_NS is not set |
| 11 | 11 | # CONFIG_PID_NS is not set |
| 12 | 12 | CONFIG_BLK_DEV_INITRD=y |
| 13 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 13 | 14 | CONFIG_KALLSYMS_ALL=y |
| 14 | 15 | CONFIG_EMBEDDED=y |
| 15 | 16 | CONFIG_PERF_EVENTS=y |
| @@ -8,6 +8,7 @@ CONFIG_IKCONFIG_PROC=y · 7 unmodified lines | ||
| 8 | 8 | # CONFIG_UTS_NS is not set |
| 9 | 9 | # CONFIG_PID_NS is not set |
| 10 | 10 | CONFIG_BLK_DEV_INITRD=y |
| 11 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 11 | 12 | CONFIG_PERF_EVENTS=y |
| 12 | 13 | # CONFIG_COMPAT_BRK is not set |
| 13 | 14 | CONFIG_KPROBES=y |
| @@ -14,6 +14,7 @@ CONFIG_INITRAMFS_SOURCE="../tb10x-rootfs.cpio" · 13 unmodified lines | ||
| 14 | 14 | CONFIG_INITRAMFS_ROOT_UID=2100 |
| 15 | 15 | CONFIG_INITRAMFS_ROOT_GID=501 |
| 16 | 16 | # CONFIG_RD_GZIP is not set |
| 17 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 17 | 18 | CONFIG_SYSCTL_SYSCALL=y |
| 18 | 19 | CONFIG_KALLSYMS_ALL=y |
| 19 | 20 | # CONFIG_AIO is not set |
| @@ -4,6 +4,7 @@ CONFIG_HIGH_RES_TIMERS=y · 3 unmodified lines | ||
| 4 | 4 | CONFIG_IKCONFIG=y |
| 5 | 5 | CONFIG_IKCONFIG_PROC=y |
| 6 | 6 | CONFIG_BLK_DEV_INITRD=y |
| 7 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 7 | 8 | CONFIG_EMBEDDED=y |
| 8 | 9 | CONFIG_PERF_EVENTS=y |
| 9 | 10 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -4,6 +4,7 @@ CONFIG_HIGH_RES_TIMERS=y · 3 unmodified lines | ||
| 4 | 4 | CONFIG_IKCONFIG=y |
| 5 | 5 | CONFIG_IKCONFIG_PROC=y |
| 6 | 6 | CONFIG_BLK_DEV_INITRD=y |
| 7 | +CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=y | |
| 7 | 8 | CONFIG_EMBEDDED=y |
| 8 | 9 | CONFIG_PERF_EVENTS=y |
| 9 | 10 | # CONFIG_VM_EVENT_COUNTERS is not set |
| @@ -17,7 +17,7 @@ KBUILD_LDFLAGS_MODULE += --be8 · 16 unmodified lines | ||
| 17 | 17 | endif |
| 18 | 18 | |
| 19 | 19 | ifeq ($(CONFIG_ARM_MODULE_PLTS),y) |
| 20 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm/kernel/module.lds | |
| 20 | +KBUILD_LDS_MODULE += $(srctree)/arch/arm/kernel/module.lds | |
| 21 | 21 | endif |
| 22 | 22 | |
| 23 | 23 | GZFLAGS :=-9 |
| @@ -8,13 +8,14 @@ ifeq ($(plus_virt),+virt) · 7 unmodified lines | ||
| 8 | 8 | plus_virt_def := -DREQUIRES_VIRT=1 |
| 9 | 9 | endif |
| 10 | 10 | |
| 11 | +KVM := ../../../virt/kvm | |
| 12 | + | |
| 11 | 13 | ccflags-y += -I $(srctree)/$(src) -I $(srctree)/virt/kvm/arm/vgic |
| 12 | −CFLAGS_arm.o := $(plus_virt_def) | |
| 14 | +CFLAGS_$(KVM)/arm/arm.o := $(plus_virt_def) | |
| 13 | 15 | |
| 14 | 16 | AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt) |
| 15 | 17 | AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt) |
| 16 | 18 | |
| 17 | −KVM := ../../../virt/kvm | |
| 18 | 19 | kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o $(KVM)/vfio.o |
| 19 | 20 | |
| 20 | 21 | obj-$(CONFIG_KVM_ARM_HOST) += hyp/ |
| @@ -134,6 +134,7 @@ config ARM64 · 133 unmodified lines | ||
| 134 | 134 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE |
| 135 | 135 | select HAVE_ARCH_VMAP_STACK |
| 136 | 136 | select HAVE_ARM_SMCCC |
| 137 | + select HAVE_ASM_MODVERSIONS | |
| 137 | 138 | select HAVE_EBPF_JIT |
| 138 | 139 | select HAVE_C_RECORDMCOUNT |
| 139 | 140 | select HAVE_CMPXCHG_DOUBLE |
| @@ -108,7 +108,7 @@ endif · 107 unmodified lines | ||
| 108 | 108 | CHECKFLAGS += -D__aarch64__ |
| 109 | 109 | |
| 110 | 110 | ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) |
| 111 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds | |
| 111 | +KBUILD_LDS_MODULE += $(srctree)/arch/arm64/kernel/module.lds | |
| 112 | 112 | endif |
| 113 | 113 | |
| 114 | 114 | # Default value |
| @@ -19,6 +19,7 @@ config IA64 · 18 unmodified lines | ||
| 19 | 19 | select PCI_DOMAINS if PCI |
| 20 | 20 | select PCI_MSI |
| 21 | 21 | select PCI_SYSCALL if PCI |
| 22 | + select HAVE_ASM_MODVERSIONS | |
| 22 | 23 | select HAVE_UNSTABLE_SCHED_CLOCK |
| 23 | 24 | select HAVE_EXIT_THREAD |
| 24 | 25 | select HAVE_IDE |
| @@ -20,7 +20,7 @@ CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | OBJCOPYFLAGS := --strip-all |
| 22 | 22 | LDFLAGS_vmlinux := -static |
| 23 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds | |
| 23 | +KBUILD_LDS_MODULE += $(srctree)/arch/ia64/module.lds | |
| 24 | 24 | KBUILD_AFLAGS_KERNEL := -mconstant-gp |
| 25 | 25 | EXTRA := |
| 26 | 26 | |
| @@ -12,6 +12,7 @@ config M68K · 11 unmodified lines | ||
| 12 | 12 | select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE |
| 13 | 13 | select HAVE_IDE |
| 14 | 14 | select HAVE_AOUT if MMU |
| 15 | + select HAVE_ASM_MODVERSIONS | |
| 15 | 16 | select HAVE_DEBUG_BUGVERBOSE |
| 16 | 17 | select GENERIC_IRQ_SHOW |
| 17 | 18 | select GENERIC_ATOMIC64 |
| @@ -73,7 +73,7 @@ KBUILD_AFLAGS += -D__uClinux__ · 72 unmodified lines | ||
| 73 | 73 | endif |
| 74 | 74 | |
| 75 | 75 | KBUILD_LDFLAGS := -m m68kelf |
| 76 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds | |
| 76 | +KBUILD_LDS_MODULE += $(srctree)/arch/m68k/kernel/module.lds | |
| 77 | 77 | |
| 78 | 78 | ifdef CONFIG_SUN3 |
| 79 | 79 | LDFLAGS_vmlinux = -N |
| @@ -44,6 +44,7 @@ config MIPS · 43 unmodified lines | ||
| 44 | 44 | select HAVE_ARCH_SECCOMP_FILTER |
| 45 | 45 | select HAVE_ARCH_TRACEHOOK |
| 46 | 46 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT |
| 47 | + select HAVE_ASM_MODVERSIONS | |
| 47 | 48 | select HAVE_EBPF_JIT if (!CPU_MICROMIPS) |
| 48 | 49 | select HAVE_CONTEXT_TRACKING |
| 49 | 50 | select HAVE_COPY_THREAD_TLS |
| @@ -160,7 +160,7 @@ targets += vmlinux.lzo.itb · 159 unmodified lines | ||
| 160 | 160 | quiet_cmd_itb-image = ITB $@ |
| 161 | 161 | cmd_itb-image = \ |
| 162 | 162 | env PATH="$(objtree)/scripts/dtc:$(PATH)" \ |
| 163 | − $(CONFIG_SHELL) $(MKIMAGE) \ | |
| 163 | + $(BASH) $(MKIMAGE) \ | |
| 164 | 164 | -D "-I dts -O dtb -p 500 \ |
| 165 | 165 | --include $(objtree)/arch/mips \ |
| 166 | 166 | --warning no-unit_address_vs_reg" \ |
| @@ -60,7 +60,7 @@ KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \ · 59 unmodified lines | ||
| 60 | 60 | -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT) |
| 61 | 61 | |
| 62 | 62 | CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1))) |
| 63 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/parisc/kernel/module.lds | |
| 63 | +KBUILD_LDS_MODULE += $(srctree)/arch/parisc/kernel/module.lds | |
| 64 | 64 | endif |
| 65 | 65 | |
| 66 | 66 | OBJCOPY_FLAGS =-O binary -R .note -R .comment -S |
| @@ -177,6 +177,7 @@ config PPC · 176 unmodified lines | ||
| 177 | 177 | select HAVE_ARCH_NVRAM_OPS |
| 178 | 178 | select HAVE_ARCH_SECCOMP_FILTER |
| 179 | 179 | select HAVE_ARCH_TRACEHOOK |
| 180 | + select HAVE_ASM_MODVERSIONS | |
| 180 | 181 | select HAVE_C_RECORDMCOUNT |
| 181 | 182 | select HAVE_CBPF_JIT if !PPC64 |
| 182 | 183 | select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13) |
| @@ -65,7 +65,7 @@ UTS_MACHINE := $(subst $(space),,$(machine-y)) · 64 unmodified lines | ||
| 65 | 65 | ifdef CONFIG_PPC32 |
| 66 | 66 | KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o |
| 67 | 67 | else |
| 68 | −KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds | |
| 68 | +KBUILD_LDS_MODULE += $(srctree)/arch/powerpc/kernel/module.lds | |
| 69 | 69 | ifeq ($(call ld-ifversion, -ge, 225000000, y),y) |
| 70 | 70 | # Have the linker provide sfpr if possible. |
| 71 | 71 | # There is a corresponding test in arch/powerpc/lib/Makefile |
| @@ -18,7 +18,7 @@ quiet_cmd_relocs_check = CHKREL $@ · 17 unmodified lines | ||
| 18 | 18 | ifdef CONFIG_PPC_BOOK3S_64 |
| 19 | 19 | cmd_relocs_check = \ |
| 20 | 20 | $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$@" ; \ |
| 21 | − $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$@" | |
| 21 | + $(BASH) $(srctree)/arch/powerpc/tools/unrel_branch_check.sh "$(OBJDUMP)" "$@" | |
| 22 | 22 | else |
| 23 | 23 | cmd_relocs_check = \ |
| 24 | 24 | $(CONFIG_SHELL) $(srctree)/arch/powerpc/tools/relocs_check.sh "$(OBJDUMP)" "$@" |
| @@ -33,7 +33,7 @@ OBJ="$2" · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | ERROR=0 |
| 35 | 35 | |
| 36 | −function check_section() | |
| 36 | +check_section() | |
| 37 | 37 | { |
| 38 | 38 | file=$1 |
| 39 | 39 | section=$2 |
| @@ -31,6 +31,7 @@ config RISCV · 30 unmodified lines | ||
| 31 | 31 | select GENERIC_SMP_IDLE_THREAD |
| 32 | 32 | select GENERIC_ATOMIC64 if !64BIT |
| 33 | 33 | select HAVE_ARCH_AUDITSYSCALL |
| 34 | + select HAVE_ASM_MODVERSIONS | |
| 34 | 35 | select HAVE_MEMBLOCK_NODE_MAP |
| 35 | 36 | select HAVE_DMA_CONTIGUOUS |
| 36 | 37 | select HAVE_FUTEX_CMPXCHG if FUTEX |
| @@ -52,7 +52,7 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) · 51 unmodified lines | ||
| 52 | 52 | KBUILD_CFLAGS += -mcmodel=medany |
| 53 | 53 | endif |
| 54 | 54 | ifeq ($(CONFIG_MODULE_SECTIONS),y) |
| 55 | − KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/riscv/kernel/module.lds | |
| 55 | + KBUILD_LDS_MODULE += $(srctree)/arch/riscv/kernel/module.lds | |
| 56 | 56 | endif |
| 57 | 57 | ifeq ($(CONFIG_PERF_EVENTS),y) |
| 58 | 58 | KBUILD_CFLAGS += -fno-omit-frame-pointer |
| @@ -132,6 +132,7 @@ config S390 · 131 unmodified lines | ||
| 132 | 132 | select HAVE_ARCH_TRACEHOOK |
| 133 | 133 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE |
| 134 | 134 | select HAVE_ARCH_VMAP_STACK |
| 135 | + select HAVE_ASM_MODVERSIONS | |
| 135 | 136 | select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES |
| 136 | 137 | select HAVE_CMPXCHG_DOUBLE |
| 137 | 138 | select HAVE_CMPXCHG_LOCAL |
| @@ -17,6 +17,7 @@ config SPARC · 16 unmodified lines | ||
| 17 | 17 | select ARCH_MIGHT_HAVE_PC_SERIO |
| 18 | 18 | select OF |
| 19 | 19 | select OF_PROMTREE |
| 20 | + select HAVE_ASM_MODVERSIONS | |
| 20 | 21 | select HAVE_IDE |
| 21 | 22 | select HAVE_OPROFILE |
| 22 | 23 | select HAVE_ARCH_KGDB if !SMP || SPARC64 |
| @@ -9,6 +9,7 @@ config UML · 8 unmodified lines | ||
| 9 | 9 | select ARCH_NO_PREEMPT |
| 10 | 10 | select HAVE_ARCH_AUDITSYSCALL |
| 11 | 11 | select HAVE_ARCH_SECCOMP_FILTER |
| 12 | + select HAVE_ASM_MODVERSIONS | |
| 12 | 13 | select HAVE_UID16 |
| 13 | 14 | select HAVE_FUTEX_CMPXCHG if FUTEX |
| 14 | 15 | select HAVE_DEBUG_KMEMLEAK |
| @@ -147,6 +147,7 @@ config X86 · 146 unmodified lines | ||
| 147 | 147 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64 |
| 148 | 148 | select HAVE_ARCH_VMAP_STACK if X86_64 |
| 149 | 149 | select HAVE_ARCH_WITHIN_STACK_FRAMES |
| 150 | + select HAVE_ASM_MODVERSIONS | |
| 150 | 151 | select HAVE_CMPXCHG_DOUBLE |
| 151 | 152 | select HAVE_CMPXCHG_LOCAL |
| 152 | 153 | select HAVE_CONTEXT_TRACKING if X86_64 |
| @@ -89,6 +89,7 @@ $(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS · 88 unmodified lines | ||
| 89 | 89 | # |
| 90 | 90 | CFLAGS_REMOVE_vdso-note.o = -pg |
| 91 | 91 | CFLAGS_REMOVE_vclock_gettime.o = -pg |
| 92 | +CFLAGS_REMOVE_vdso32/vclock_gettime.o = -pg | |
| 92 | 93 | CFLAGS_REMOVE_vgetcpu.o = -pg |
| 93 | 94 | CFLAGS_REMOVE_vvar.o = -pg |
| 94 | 95 | |
| @@ -128,7 +129,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE · 33 unmodified lines | ||
| 128 | 129 | $(obj)/vdsox32.so.dbg: $(obj)/vdsox32.lds $(vobjx32s) FORCE |
| 129 | 130 | $(call if_changed,vdso_and_check) |
| 130 | 131 | |
| 131 | −CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) | |
| 132 | +CPPFLAGS_vdso32/vdso32.lds = $(CPPFLAGS_vdso.lds) | |
| 132 | 133 | VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -soname linux-gate.so.1 |
| 133 | 134 | |
| 134 | 135 | targets += vdso32/vdso32.lds |
| @@ -36,9 +36,9 @@ ifdef CONFIG_CC_IS_CLANG · 35 unmodified lines | ||
| 36 | 36 | calcs_ccflags += -msse2 |
| 37 | 37 | endif |
| 38 | 38 | |
| 39 | −CFLAGS_dcn_calcs.o := $(calcs_ccflags) | |
| 40 | −CFLAGS_dcn_calc_auto.o := $(calcs_ccflags) | |
| 41 | −CFLAGS_dcn_calc_math.o := $(calcs_ccflags) -Wno-tautological-compare | |
| 39 | +CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags) | |
| 40 | +CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags) | |
| 41 | +CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_math.o := $(calcs_ccflags) -Wno-tautological-compare | |
| 42 | 42 | |
| 43 | 43 | BW_CALCS = dce_calcs.o bw_fixed.o custom_float.o |
| 44 | 44 | |
| @@ -16,10 +16,10 @@ else ifneq ($(call cc-option, -mstack-alignment=16),) · 15 unmodified lines | ||
| 16 | 16 | cc_stack_align := -mstack-alignment=16 |
| 17 | 17 | endif |
| 18 | 18 | |
| 19 | −CFLAGS_dcn20_resource.o := -mhard-float -msse $(cc_stack_align) | |
| 19 | +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse $(cc_stack_align) | |
| 20 | 20 | |
| 21 | 21 | ifdef CONFIG_CC_IS_CLANG |
| 22 | −CFLAGS_dcn20_resource.o += -msse2 | |
| 22 | +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 | |
| 23 | 23 | endif |
| 24 | 24 | |
| 25 | 25 | AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20)) |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | DCN21 = dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o |
| 5 | 5 | |
| 6 | −CFLAGS_dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 | |
| 6 | +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 | |
| 7 | 7 | |
| 8 | 8 | AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21)) |
| 9 | 9 | |
| @@ -36,25 +36,22 @@ ifdef CONFIG_CC_IS_CLANG · 35 unmodified lines | ||
| 36 | 36 | dml_ccflags += -msse2 |
| 37 | 37 | endif |
| 38 | 38 | |
| 39 | −CFLAGS_display_mode_lib.o := $(dml_ccflags) | |
| 39 | +CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) | |
| 40 | 40 | |
| 41 | 41 | ifdef CONFIG_DRM_AMD_DC_DCN2_0 |
| 42 | −CFLAGS_display_mode_vba.o := $(dml_ccflags) | |
| 43 | −CFLAGS_display_mode_vba_20.o := $(dml_ccflags) | |
| 44 | −CFLAGS_display_rq_dlg_calc_20.o := $(dml_ccflags) | |
| 45 | −CFLAGS_display_mode_vba_20v2.o := $(dml_ccflags) | |
| 46 | −CFLAGS_display_rq_dlg_calc_20v2.o := $(dml_ccflags) | |
| 42 | +CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags) | |
| 43 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) | |
| 44 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags) | |
| 45 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags) | |
| 46 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20v2.o := $(dml_ccflags) | |
| 47 | 47 | endif |
| 48 | 48 | ifdef CONFIG_DRM_AMD_DC_DCN2_1 |
| 49 | −CFLAGS_display_mode_vba_21.o := $(dml_ccflags) | |
| 50 | −CFLAGS_display_rq_dlg_calc_21.o := $(dml_ccflags) | |
| 49 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags) | |
| 50 | +CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_rq_dlg_calc_21.o := $(dml_ccflags) | |
| 51 | 51 | endif |
| 52 | −ifdef CONFIG_DRM_AMD_DCN3AG | |
| 53 | −CFLAGS_display_mode_vba_3ag.o := $(dml_ccflags) | |
| 54 | −endif | |
| 55 | −CFLAGS_dml1_display_rq_dlg_calc.o := $(dml_ccflags) | |
| 56 | −CFLAGS_display_rq_dlg_helpers.o := $(dml_ccflags) | |
| 57 | −CFLAGS_dml_common_defs.o := $(dml_ccflags) | |
| 52 | +CFLAGS_$(AMDDALPATH)/dc/dml/dml1_display_rq_dlg_calc.o := $(dml_ccflags) | |
| 53 | +CFLAGS_$(AMDDALPATH)/dc/dml/display_rq_dlg_helpers.o := $(dml_ccflags) | |
| 54 | +CFLAGS_$(AMDDALPATH)/dc/dml/dml_common_defs.o := $(dml_ccflags) | |
| 58 | 55 | |
| 59 | 56 | DML = display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \ |
| 60 | 57 | dml_common_defs.o |
| @@ -13,10 +13,9 @@ ifdef CONFIG_CC_IS_CLANG · 12 unmodified lines | ||
| 13 | 13 | dsc_ccflags += -msse2 |
| 14 | 14 | endif |
| 15 | 15 | |
| 16 | −CFLAGS_rc_calc.o := $(dsc_ccflags) | |
| 17 | −CFLAGS_rc_calc_dpi.o := $(dsc_ccflags) | |
| 18 | −CFLAGS_codec_main_amd.o := $(dsc_ccflags) | |
| 19 | −CFLAGS_dc_dsc.o := $(dsc_ccflags) | |
| 16 | +CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags) | |
| 17 | +CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc_dpi.o := $(dsc_ccflags) | |
| 18 | +CFLAGS_$(AMDDALPATH)/dc/dsc/dc_dsc.o := $(dsc_ccflags) | |
| 20 | 19 | |
| 21 | 20 | DSC = dc_dsc.o rc_calc.o rc_calc_dpi.o |
| 22 | 21 | |
| @@ -26,7 +26,7 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | # Fine grained warnings disable |
| 28 | 28 | CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init) |
| 29 | −CFLAGS_intel_fbdev.o = $(call cc-disable-warning, override-init) | |
| 29 | +CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) | |
| 30 | 30 | |
| 31 | 31 | subdir-ccflags-y += \ |
| 32 | 32 | $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA) |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1 +0,0 @@ | ||
| 1 | −subdir-ccflags-y += -I$(src)/../.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −subdir-ccflags-y += -I$(src)/.. | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -1,2 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0 | |
| 2 | −# kbuild requires Makefile in a directory to build individual objects | |
| @@ -130,10 +130,6 @@ struct ftrace_likely_data { · 129 unmodified lines | ||
| 130 | 130 | |
| 131 | 131 | /* |
| 132 | 132 | * Force always-inline if the user requests it so via the .config. |
| 133 | − * GCC does not warn about unused static inline functions for | |
| 134 | − * -Wunused-function. This turns out to avoid the need for complex #ifdef | |
| 135 | − * directives. Suppress the warning in clang as well by using "unused" | |
| 136 | − * function attribute, which is redundant but not harmful for gcc. | |
| 137 | 133 | * Prefer gnu_inline, so that extern inline functions do not emit an |
| 138 | 134 | * externally visible function. This makes extern inline behave as per gnu89 |
| 139 | 135 | * semantics rather than c99. This prevents multiple symbol definition errors |
| @@ -144,15 +140,27 @@ struct ftrace_likely_data { · 4 unmodified lines | ||
| 144 | 140 | */ |
| 145 | 141 | #if !defined(CONFIG_OPTIMIZE_INLINING) |
| 146 | 142 | #define inline inline __attribute__((__always_inline__)) __gnu_inline \ |
| 147 | − __maybe_unused notrace | |
| 143 | + __inline_maybe_unused notrace | |
| 148 | 144 | #else |
| 149 | 145 | #define inline inline __gnu_inline \ |
| 150 | − __maybe_unused notrace | |
| 146 | + __inline_maybe_unused notrace | |
| 151 | 147 | #endif |
| 152 | 148 | |
| 153 | 149 | #define __inline__ inline |
| 154 | 150 | #define __inline inline |
| 155 | 151 | |
| 152 | +/* | |
| 153 | + * GCC does not warn about unused static inline functions for -Wunused-function. | |
| 154 | + * Suppress the warning in clang as well by using __maybe_unused, but enable it | |
| 155 | + * for W=1 build. This will allow clang to find unused functions. Remove the | |
| 156 | + * __inline_maybe_unused entirely after fixing most of -Wunused-function warnings. | |
| 157 | + */ | |
| 158 | +#ifdef KBUILD_EXTRA_WARN1 | |
| 159 | +#define __inline_maybe_unused | |
| 160 | +#else | |
| 161 | +#define __inline_maybe_unused __maybe_unused | |
| 162 | +#endif | |
| 163 | + | |
| 156 | 164 | /* |
| 157 | 165 | * Rather then using noinline to prevent stack consumption, use |
| 158 | 166 | * noinline_for_stack instead. For documentation reasons. |
| @@ -18,9 +18,6 @@ extern struct module __this_module; · 17 unmodified lines | ||
| 18 | 18 | #define THIS_MODULE ((struct module *)0) |
| 19 | 19 | #endif |
| 20 | 20 | |
| 21 | −#ifdef CONFIG_MODULES | |
| 22 | − | |
| 23 | −#if defined(__KERNEL__) && !defined(__GENKSYMS__) | |
| 24 | 21 | #ifdef CONFIG_MODVERSIONS |
| 25 | 22 | /* Mark the CRC weak since genksyms apparently decides not to |
| 26 | 23 | * generate a checksums for some symbols */ |
| @@ -74,6 +71,12 @@ struct kernel_symbol { · 47 unmodified lines | ||
| 74 | 71 | }; |
| 75 | 72 | #endif |
| 76 | 73 | |
| 74 | +#ifdef __GENKSYMS__ | |
| 75 | + | |
| 76 | +#define ___EXPORT_SYMBOL(sym, sec) __GENKSYMS_EXPORT_SYMBOL(sym) | |
| 77 | + | |
| 78 | +#else | |
| 79 | + | |
| 77 | 80 | /* For every exported symbol, place a struct in the __ksymtab section */ |
| 78 | 81 | #define ___EXPORT_SYMBOL(sym, sec) \ |
| 79 | 82 | extern typeof(sym) sym; \ |
| @@ -83,7 +86,9 @@ struct kernel_symbol { · 3 unmodified lines | ||
| 83 | 86 | = #sym; \ |
| 84 | 87 | __KSYMTAB_ENTRY(sym, sec) |
| 85 | 88 | |
| 86 | −#if defined(__DISABLE_EXPORTS) | |
| 89 | +#endif | |
| 90 | + | |
| 91 | +#if !defined(CONFIG_MODULES) || defined(__DISABLE_EXPORTS) | |
| 87 | 92 | |
| 88 | 93 | /* |
| 89 | 94 | * Allow symbol exports to be disabled completely so that C code may |
| @@ -117,37 +122,22 @@ struct kernel_symbol { · 27 unmodified lines | ||
| 117 | 122 | #define __cond_export_sym_0(sym, sec) /* nothing */ |
| 118 | 123 | |
| 119 | 124 | #else |
| 120 | −#define __EXPORT_SYMBOL ___EXPORT_SYMBOL | |
| 121 | −#endif | |
| 122 | 125 | |
| 123 | −#define EXPORT_SYMBOL(sym) \ | |
| 124 | − __EXPORT_SYMBOL(sym, "") | |
| 126 | +#define __EXPORT_SYMBOL(sym, sec) ___EXPORT_SYMBOL(sym, sec) | |
| 125 | 127 | |
| 126 | −#define EXPORT_SYMBOL_GPL(sym) \ | |
| 127 | − __EXPORT_SYMBOL(sym, "_gpl") | |
| 128 | − | |
| 129 | −#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ | |
| 130 | − __EXPORT_SYMBOL(sym, "_gpl_future") | |
| 128 | +#endif /* CONFIG_MODULES */ | |
| 131 | 129 | |
| 130 | +#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "") | |
| 131 | +#define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_gpl") | |
| 132 | +#define EXPORT_SYMBOL_GPL_FUTURE(sym) __EXPORT_SYMBOL(sym, "_gpl_future") | |
| 132 | 133 | #ifdef CONFIG_UNUSED_SYMBOLS |
| 133 | −#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") | |
| 134 | −#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") | |
| 134 | +#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") | |
| 135 | +#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") | |
| 135 | 136 | #else |
| 136 | 137 | #define EXPORT_UNUSED_SYMBOL(sym) |
| 137 | 138 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
| 138 | 139 | #endif |
| 139 | 140 | |
| 140 | −#endif /* __GENKSYMS__ */ | |
| 141 | − | |
| 142 | −#else /* !CONFIG_MODULES... */ | |
| 143 | − | |
| 144 | −#define EXPORT_SYMBOL(sym) | |
| 145 | −#define EXPORT_SYMBOL_GPL(sym) | |
| 146 | −#define EXPORT_SYMBOL_GPL_FUTURE(sym) | |
| 147 | −#define EXPORT_UNUSED_SYMBOL(sym) | |
| 148 | −#define EXPORT_UNUSED_SYMBOL_GPL(sym) | |
| 149 | − | |
| 150 | −#endif /* CONFIG_MODULES */ | |
| 151 | 141 | #endif /* !__ASSEMBLY__ */ |
| 152 | 142 | |
| 153 | 143 | #endif /* _LINUX_EXPORT_H */ |
| @@ -9,6 +9,8 @@ · 8 unmodified lines | ||
| 9 | 9 | #endif |
| 10 | 10 | #ifdef CONFIG_PREEMPT |
| 11 | 11 | #define MODULE_VERMAGIC_PREEMPT "preempt " |
| 12 | +#elif defined(CONFIG_PREEMPT_RT) | |
| 13 | +#define MODULE_VERMAGIC_PREEMPT "preempt_rt " | |
| 12 | 14 | #else |
| 13 | 15 | #define MODULE_VERMAGIC_PREEMPT "" |
| 14 | 16 | #endif |
| @@ -1234,20 +1234,26 @@ choice · 1233 unmodified lines | ||
| 1234 | 1234 | default CC_OPTIMIZE_FOR_PERFORMANCE |
| 1235 | 1235 | |
| 1236 | 1236 | config CC_OPTIMIZE_FOR_PERFORMANCE |
| 1237 | − bool "Optimize for performance" | |
| 1237 | + bool "Optimize for performance (-O2)" | |
| 1238 | 1238 | help |
| 1239 | 1239 | This is the default optimization level for the kernel, building |
| 1240 | 1240 | with the "-O2" compiler flag for best performance and most |
| 1241 | 1241 | helpful compile-time warnings. |
| 1242 | 1242 | |
| 1243 | −config CC_OPTIMIZE_FOR_SIZE | |
| 1244 | − bool "Optimize for size" | |
| 1243 | +config CC_OPTIMIZE_FOR_PERFORMANCE_O3 | |
| 1244 | + bool "Optimize more for performance (-O3)" | |
| 1245 | + depends on ARC | |
| 1245 | 1246 | imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives |
| 1246 | 1247 | help |
| 1247 | − Enabling this option will pass "-Os" instead of "-O2" to | |
| 1248 | − your compiler resulting in a smaller kernel. | |
| 1248 | + Choosing this option will pass "-O3" to your compiler to optimize | |
| 1249 | + the kernel yet more for performance. | |
| 1249 | 1250 | |
| 1250 | − If unsure, say N. | |
| 1251 | +config CC_OPTIMIZE_FOR_SIZE | |
| 1252 | + bool "Optimize for size (-Os)" | |
| 1253 | + imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives | |
| 1254 | + help | |
| 1255 | + Choosing this option will pass "-Os" to your compiler resulting | |
| 1256 | + in a smaller kernel. | |
| 1251 | 1257 | |
| 1252 | 1258 | endchoice |
| 1253 | 1259 | |
| @@ -2014,6 +2020,14 @@ config MODVERSIONS · 760 unmodified lines | ||
| 2014 | 2020 | make them incompatible with the kernel you are running. If |
| 2015 | 2021 | unsure, say N. |
| 2016 | 2022 | |
| 2023 | +config ASM_MODVERSIONS | |
| 2024 | + bool | |
| 2025 | + default HAVE_ASM_MODVERSIONS && MODVERSIONS | |
| 2026 | + help | |
| 2027 | + This enables module versioning for exported symbols also from | |
| 2028 | + assembly. This can be enabled only when the target architecture | |
| 2029 | + supports it. | |
| 2030 | + | |
| 2017 | 2031 | config MODULE_REL_CRCS |
| 2018 | 2032 | bool |
| 2019 | 2033 | depends on MODVERSIONS |
| @@ -33,5 +33,6 @@ $(obj)/version.o: include/generated/compile.h · 32 unmodified lines | ||
| 33 | 33 | silent_chk_compile.h = : |
| 34 | 34 | include/generated/compile.h: FORCE |
| 35 | 35 | @$($(quiet)chk_compile.h) |
| 36 | − $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ | |
| 37 | − "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)" | |
| 36 | + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ | |
| 37 | + "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" \ | |
| 38 | + "$(CONFIG_PREEMPT_RT)" "$(CC) $(KBUILD_CFLAGS)" | |
| @@ -127,7 +127,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE · 126 unmodified lines | ||
| 127 | 127 | $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz |
| 128 | 128 | |
| 129 | 129 | quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz |
| 130 | −cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@ | |
| 130 | + cmd_genikh = $(BASH) $(srctree)/kernel/gen_kheaders.sh $@ | |
| 131 | 131 | $(obj)/kheaders_data.tar.xz: FORCE |
| 132 | 132 | $(call cmd,genikh) |
| 133 | 133 | |
| @@ -35,5 +35,8 @@ ld-option = $(success,$(LD) -v $(1)) · 34 unmodified lines | ||
| 35 | 35 | $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) |
| 36 | 36 | $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) |
| 37 | 37 | |
| 38 | +# Fail if the linker is gold as it's not capable of linking the kernel proper | |
| 39 | +$(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supported) | |
| 40 | + | |
| 38 | 41 | # gcc version including patch level |
| 39 | 42 | gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) |
| @@ -36,4 +36,4 @@ subdir-$(CONFIG_MODVERSIONS) += genksyms · 35 unmodified lines | ||
| 36 | 36 | subdir-$(CONFIG_SECURITY_SELINUX) += selinux |
| 37 | 37 | |
| 38 | 38 | # Let clean descend into subdirs |
| 39 | −subdir- += basic dtc gdb kconfig mod package | |
| 39 | +subdir- += basic dtc gdb kconfig mod | |
| @@ -52,7 +52,7 @@ ifndef obj · 51 unmodified lines | ||
| 52 | 52 | $(warning kbuild: Makefile.build is included improperly) |
| 53 | 53 | endif |
| 54 | 54 | |
| 55 | −ifeq ($(MAKECMDGOALS)$(need-modorder),) | |
| 55 | +ifeq ($(need-modorder),) | |
| 56 | 56 | ifneq ($(obj-m),) |
| 57 | 57 | $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.) |
| 58 | 58 | $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.) |
| @@ -76,11 +76,6 @@ endif · 17 unmodified lines | ||
| 76 | 76 | |
| 77 | 77 | mod-targets := $(patsubst %.o, %.mod, $(obj-m)) |
| 78 | 78 | |
| 79 | −__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ | |
| 80 | − $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ | |
| 81 | − $(subdir-ym) $(always) | |
| 82 | − @: | |
| 83 | − | |
| 84 | 79 | # Linus' kernel sanity checking tool |
| 85 | 80 | ifeq ($(KBUILD_CHECKSRC),1) |
| 86 | 81 | quiet_cmd_checksrc = CHECK $< |
| @@ -90,23 +85,13 @@ else ifeq ($(KBUILD_CHECKSRC),2) · 3 unmodified lines | ||
| 90 | 85 | cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< |
| 91 | 86 | endif |
| 92 | 87 | |
| 93 | −ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) | |
| 88 | +ifneq ($(KBUILD_EXTRA_WARN),) | |
| 94 | 89 | cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< |
| 95 | 90 | endif |
| 96 | 91 | |
| 97 | 92 | # Compile C sources (.c) |
| 98 | 93 | # --------------------------------------------------------------------------- |
| 99 | 94 | |
| 100 | −# Default is built-in, unless we know otherwise | |
| 101 | −$(foreach x, i ll lst o s symtypes, $(patsubst %.o,%.$(x),$(real-obj-m))): \ | |
| 102 | − part-of-module := y | |
| 103 | − | |
| 104 | −modkern_cflags = \ | |
| 105 | − $(if $(part-of-module), \ | |
| 106 | − $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ | |
| 107 | − $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | |
| 108 | −quiet_modtag = $(if $(part-of-module),[M], ) | |
| 109 | − | |
| 110 | 95 | quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ |
| 111 | 96 | cmd_cc_s_c = $(CC) $(filter-out $(DEBUG_CFLAGS), $(c_flags)) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< |
| 112 | 97 | |
| @@ -310,11 +295,6 @@ $(obj)/%.h.s: $(src)/%.h FORCE · 197 unmodified lines | ||
| 310 | 295 | # Compile assembler sources (.S) |
| 311 | 296 | # --------------------------------------------------------------------------- |
| 312 | 297 | |
| 313 | −modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL) | |
| 314 | − | |
| 315 | −$(real-obj-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) | |
| 316 | −$(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) | |
| 317 | − | |
| 318 | 298 | # .S file exports must have their C prototypes defined in asm/asm-prototypes.h |
| 319 | 299 | # or a file that it includes, in order to get versioned symbols. We build a |
| 320 | 300 | # dummy C file that includes asm-prototypes and the EXPORT_SYMBOL lines from |
| @@ -356,11 +336,7 @@ $(obj)/%.s: $(src)/%.S FORCE · 35 unmodified lines | ||
| 356 | 336 | quiet_cmd_as_o_S = AS $(quiet_modtag) $@ |
| 357 | 337 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< |
| 358 | 338 | |
| 359 | −ifdef CONFIG_MODVERSIONS | |
| 360 | − | |
| 361 | −ASM_PROTOTYPES := $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/asm-prototypes.h) | |
| 362 | − | |
| 363 | −ifneq ($(ASM_PROTOTYPES),) | |
| 339 | +ifdef CONFIG_ASM_MODVERSIONS | |
| 364 | 340 | |
| 365 | 341 | # versioning matches the C process described above, with difference that |
| 366 | 342 | # we parse asm-prototypes.h C header to get function definitions. |
| @@ -376,7 +352,6 @@ cmd_modversions_S = \ · 9 unmodified lines | ||
| 376 | 352 | rm -f $(@D)/.tmp_$(@F:.o=.ver); \ |
| 377 | 353 | fi |
| 378 | 354 | endif |
| 379 | −endif | |
| 380 | 355 | |
| 381 | 356 | $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE |
| 382 | 357 | $(call if_changed_rule,as_o_S) |
| @@ -395,9 +370,9 @@ $(obj)/%.lds: $(src)/%.lds.S FORCE · 12 unmodified lines | ||
| 395 | 370 | |
| 396 | 371 | # ASN.1 grammar |
| 397 | 372 | # --------------------------------------------------------------------------- |
| 398 | −quiet_cmd_asn1_compiler = ASN.1 $@ | |
| 373 | +quiet_cmd_asn1_compiler = ASN.1 $(basename $@).[ch] | |
| 399 | 374 | cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \ |
| 400 | − $(subst .h,.c,$@) $(subst .c,.h,$@) | |
| 375 | + $(basename $@).c $(basename $@).h | |
| 401 | 376 | |
| 402 | 377 | $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler |
| 403 | 378 | $(call cmd,asn1_compiler) |
| @@ -489,12 +464,50 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \ · 85 unmodified lines | ||
| 489 | 464 | $(call intermediate_targets, .lex.o, .lex.c) \ |
| 490 | 465 | $(call intermediate_targets, .tab.o, .tab.c .tab.h) |
| 491 | 466 | |
| 467 | +# Build | |
| 468 | +# --------------------------------------------------------------------------- | |
| 469 | + | |
| 470 | +ifdef single-build | |
| 471 | + | |
| 472 | +curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \ | |
| 473 | + $(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x)))) | |
| 474 | + | |
| 475 | +# Handle single targets without any rule: show "Nothing to be done for ..." or | |
| 476 | +# "No rule to make target ..." depending on whether the target exists. | |
| 477 | +unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \ | |
| 478 | + $(filter $(obj)/%, \ | |
| 479 | + $(filter-out $(curdir-single), \ | |
| 480 | + $(KBUILD_SINGLE_TARGETS)))) | |
| 481 | + | |
| 482 | +__build: $(curdir-single) $(subdir-ym) | |
| 483 | +ifneq ($(unknown-single),) | |
| 484 | + $(Q)$(MAKE) -f /dev/null $(unknown-single) | |
| 485 | +endif | |
| 486 | + @: | |
| 487 | + | |
| 488 | +ifeq ($(curdir-single),) | |
| 489 | +# Nothing to do in this directory. Do not include any .*.cmd file for speed-up | |
| 490 | +targets := | |
| 491 | +else | |
| 492 | +targets += $(curdir-single) | |
| 493 | +endif | |
| 494 | + | |
| 495 | +else | |
| 496 | + | |
| 497 | +__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ | |
| 498 | + $(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ | |
| 499 | + $(subdir-ym) $(always) | |
| 500 | + @: | |
| 501 | + | |
| 502 | +endif | |
| 503 | + | |
| 492 | 504 | # Descending |
| 493 | 505 | # --------------------------------------------------------------------------- |
| 494 | 506 | |
| 495 | 507 | PHONY += $(subdir-ym) |
| 496 | 508 | $(subdir-ym): |
| 497 | 509 | $(Q)$(MAKE) $(build)=$@ \ |
| 510 | + $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ | |
| 498 | 511 | need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \ |
| 499 | 512 | need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) |
| 500 | 513 | |
| @@ -17,17 +17,8 @@ include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-di · 16 unmodified lines | ||
| 17 | 17 | # Figure out what we need to build from the various variables |
| 18 | 18 | # ========================================================================== |
| 19 | 19 | |
| 20 | −__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) | |
| 21 | −subdir-y += $(__subdir-y) | |
| 22 | −__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) | |
| 23 | −subdir-m += $(__subdir-m) | |
| 24 | −__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) | |
| 25 | −subdir- += $(__subdir-) | |
| 26 | − | |
| 27 | −# Subdirectories we need to descend into | |
| 28 | − | |
| 29 | −subdir-ym := $(sort $(subdir-y) $(subdir-m)) | |
| 30 | −subdir-ymn := $(sort $(subdir-ym) $(subdir-)) | |
| 20 | +subdir-ymn := $(sort $(subdir-y) $(subdir-m) $(subdir-) \ | |
| 21 | + $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-m) $(obj-)))) | |
| 31 | 22 | |
| 32 | 23 | # Add subdir path |
| 33 | 24 | |
| @@ -52,26 +43,14 @@ __clean-files := $(wildcard \ · 18 unmodified lines | ||
| 52 | 43 | $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \ |
| 53 | 44 | $(filter $(objtree)/%, $(__clean-files))) |
| 54 | 45 | |
| 55 | −# same as clean-files | |
| 56 | − | |
| 57 | −__clean-dirs := $(wildcard \ | |
| 58 | − $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \ | |
| 59 | − $(filter $(objtree)/%, $(clean-dirs))) | |
| 60 | − | |
| 61 | 46 | # ========================================================================== |
| 62 | 47 | |
| 63 | −quiet_cmd_clean = CLEAN $(obj) | |
| 64 | − cmd_clean = rm -f $(__clean-files) | |
| 65 | −quiet_cmd_cleandir = CLEAN $(__clean-dirs) | |
| 66 | − cmd_cleandir = rm -rf $(__clean-dirs) | |
| 67 | − | |
| 48 | +quiet_cmd_clean = CLEAN $(obj) | |
| 49 | + cmd_clean = rm -rf $(__clean-files) | |
| 68 | 50 | |
| 69 | 51 | __clean: $(subdir-ymn) |
| 70 | 52 | ifneq ($(strip $(__clean-files)),) |
| 71 | − +$(call cmd,clean) | |
| 72 | −endif | |
| 73 | −ifneq ($(strip $(__clean-dirs)),) | |
| 74 | − +$(call cmd,cleandir) | |
| 53 | + $(call cmd,clean) | |
| 75 | 54 | endif |
| 76 | 55 | @: |
| 77 | 56 | |
| @@ -1,74 +1,91 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | # ========================================================================== |
| 3 | −# | |
| 4 | 3 | # make W=... settings |
| 5 | 4 | # |
| 6 | −# W=1 - warnings that may be relevant and does not occur too often | |
| 7 | −# W=2 - warnings that occur quite often but may still be relevant | |
| 8 | −# W=3 - the more obscure warnings, can most likely be ignored | |
| 9 | −# | |
| 10 | −# $(call cc-option, -W...) handles gcc -W.. options which | |
| 11 | −# are not supported by all versions of the compiler | |
| 5 | +# There are three warning groups enabled by W=1, W=2, W=3. | |
| 6 | +# They are independent, and can be combined like W=12 or W=123. | |
| 12 | 7 | # ========================================================================== |
| 13 | 8 | |
| 14 | 9 | KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) |
| 15 | 10 | |
| 11 | +# backward compatibility | |
| 12 | +KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) | |
| 13 | + | |
| 16 | 14 | ifeq ("$(origin W)", "command line") |
| 17 | − export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) | |
| 15 | + KBUILD_EXTRA_WARN := $(W) | |
| 18 | 16 | endif |
| 19 | 17 | |
| 20 | −ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS | |
| 21 | −warning- := $(empty) | |
| 22 | − | |
| 23 | −warning-1 := -Wextra -Wunused -Wno-unused-parameter | |
| 24 | −warning-1 += -Wmissing-declarations | |
| 25 | −warning-1 += -Wmissing-format-attribute | |
| 26 | −warning-1 += -Wmissing-prototypes | |
| 27 | −warning-1 += -Wold-style-definition | |
| 28 | −warning-1 += -Wmissing-include-dirs | |
| 29 | −warning-1 += $(call cc-option, -Wunused-but-set-variable) | |
| 30 | −warning-1 += $(call cc-option, -Wunused-const-variable) | |
| 31 | −warning-1 += $(call cc-option, -Wpacked-not-aligned) | |
| 32 | −warning-1 += $(call cc-option, -Wstringop-truncation) | |
| 18 | +export KBUILD_EXTRA_WARN | |
| 19 | + | |
| 20 | +# | |
| 21 | +# W=1 - warnings which may be relevant and do not occur too often | |
| 22 | +# | |
| 23 | +ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) | |
| 24 | + | |
| 25 | +KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter | |
| 26 | +KBUILD_CFLAGS += -Wmissing-declarations | |
| 27 | +KBUILD_CFLAGS += -Wmissing-format-attribute | |
| 28 | +KBUILD_CFLAGS += -Wmissing-prototypes | |
| 29 | +KBUILD_CFLAGS += -Wold-style-definition | |
| 30 | +KBUILD_CFLAGS += -Wmissing-include-dirs | |
| 31 | +KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable) | |
| 32 | +KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable) | |
| 33 | +KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) | |
| 34 | +KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) | |
| 33 | 35 | # The following turn off the warnings enabled by -Wextra |
| 34 | −warning-1 += -Wno-missing-field-initializers | |
| 35 | −warning-1 += -Wno-sign-compare | |
| 36 | − | |
| 37 | −warning-2 += -Wcast-align | |
| 38 | −warning-2 += -Wdisabled-optimization | |
| 39 | −warning-2 += -Wnested-externs | |
| 40 | −warning-2 += -Wshadow | |
| 41 | −warning-2 += $(call cc-option, -Wlogical-op) | |
| 42 | −warning-2 += -Wmissing-field-initializers | |
| 43 | −warning-2 += -Wsign-compare | |
| 44 | −warning-2 += $(call cc-option, -Wmaybe-uninitialized) | |
| 45 | −warning-2 += $(call cc-option, -Wunused-macros) | |
| 46 | − | |
| 47 | −warning-3 := -Wbad-function-cast | |
| 48 | −warning-3 += -Wcast-qual | |
| 49 | −warning-3 += -Wconversion | |
| 50 | −warning-3 += -Wpacked | |
| 51 | −warning-3 += -Wpadded | |
| 52 | −warning-3 += -Wpointer-arith | |
| 53 | −warning-3 += -Wredundant-decls | |
| 54 | −warning-3 += -Wswitch-default | |
| 55 | −warning-3 += $(call cc-option, -Wpacked-bitfield-compat) | |
| 56 | − | |
| 57 | −warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) | |
| 58 | −warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) | |
| 59 | −warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) | |
| 60 | − | |
| 61 | −ifeq ("$(strip $(warning))","") | |
| 62 | − $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown) | |
| 63 | −endif | |
| 36 | +KBUILD_CFLAGS += -Wno-missing-field-initializers | |
| 37 | +KBUILD_CFLAGS += -Wno-sign-compare | |
| 38 | + | |
| 39 | +KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1 | |
| 64 | 40 | |
| 65 | −KBUILD_CFLAGS += $(warning) | |
| 66 | 41 | else |
| 67 | 42 | |
| 43 | +# Some diagnostics enabled by default are noisy. | |
| 44 | +# Suppress them by using -Wno... except for W=1. | |
| 45 | + | |
| 68 | 46 | ifdef CONFIG_CC_IS_CLANG |
| 69 | 47 | KBUILD_CFLAGS += -Wno-initializer-overrides |
| 70 | 48 | KBUILD_CFLAGS += -Wno-format |
| 71 | 49 | KBUILD_CFLAGS += -Wno-sign-compare |
| 72 | 50 | KBUILD_CFLAGS += -Wno-format-zero-length |
| 73 | 51 | endif |
| 52 | + | |
| 53 | +endif | |
| 54 | + | |
| 55 | +# | |
| 56 | +# W=2 - warnings which occur quite often but may still be relevant | |
| 57 | +# | |
| 58 | +ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) | |
| 59 | + | |
| 60 | +KBUILD_CFLAGS += -Wcast-align | |
| 61 | +KBUILD_CFLAGS += -Wdisabled-optimization | |
| 62 | +KBUILD_CFLAGS += -Wnested-externs | |
| 63 | +KBUILD_CFLAGS += -Wshadow | |
| 64 | +KBUILD_CFLAGS += $(call cc-option, -Wlogical-op) | |
| 65 | +KBUILD_CFLAGS += -Wmissing-field-initializers | |
| 66 | +KBUILD_CFLAGS += -Wsign-compare | |
| 67 | +KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) | |
| 68 | +KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) | |
| 69 | + | |
| 70 | +KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 | |
| 71 | + | |
| 72 | +endif | |
| 73 | + | |
| 74 | +# | |
| 75 | +# W=3 - more obscure warnings, can most likely be ignored | |
| 76 | +# | |
| 77 | +ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) | |
| 78 | + | |
| 79 | +KBUILD_CFLAGS += -Wbad-function-cast | |
| 80 | +KBUILD_CFLAGS += -Wcast-qual | |
| 81 | +KBUILD_CFLAGS += -Wconversion | |
| 82 | +KBUILD_CFLAGS += -Wpacked | |
| 83 | +KBUILD_CFLAGS += -Wpadded | |
| 84 | +KBUILD_CFLAGS += -Wpointer-arith | |
| 85 | +KBUILD_CFLAGS += -Wredundant-decls | |
| 86 | +KBUILD_CFLAGS += -Wswitch-default | |
| 87 | +KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat) | |
| 88 | + | |
| 89 | +KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3 | |
| 90 | + | |
| 74 | 91 | endif |
| @@ -1,4 +1,21 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | + | |
| 3 | +# LEX | |
| 4 | +# --------------------------------------------------------------------------- | |
| 5 | +quiet_cmd_flex = LEX $@ | |
| 6 | + cmd_flex = $(LEX) -o$@ -L $< | |
| 7 | + | |
| 8 | +$(obj)/%.lex.c: $(src)/%.l FORCE | |
| 9 | + $(call if_changed,flex) | |
| 10 | + | |
| 11 | +# YACC | |
| 12 | +# --------------------------------------------------------------------------- | |
| 13 | +quiet_cmd_bison = YACC $(basename $@).[ch] | |
| 14 | + cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $< | |
| 15 | + | |
| 16 | +$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE | |
| 17 | + $(call if_changed,bison) | |
| 18 | + | |
| 2 | 19 | # ========================================================================== |
| 3 | 20 | # Building binaries on the host system |
| 4 | 21 | # Binaries are used during the compilation of the kernel, for example |
| @@ -63,9 +80,9 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) · 58 unmodified lines | ||
| 63 | 80 | # Handle options to gcc. Support building with separate output directory |
| 64 | 81 | |
| 65 | 82 | _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ |
| 66 | − $(HOSTCFLAGS_$(basetarget).o) | |
| 83 | + $(HOSTCFLAGS_$(target-stem).o) | |
| 67 | 84 | _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ |
| 68 | − $(HOSTCXXFLAGS_$(basetarget).o) | |
| 85 | + $(HOSTCXXFLAGS_$(target-stem).o) | |
| 69 | 86 | |
| 70 | 87 | # $(objtree)/$(obj) for including generated headers from checkin source files |
| 71 | 88 | ifeq ($(KBUILD_EXTMOD),) |
| @@ -85,7 +102,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(_hostcxx_flags) · 13 unmodified lines | ||
| 85 | 102 | # host-csingle -> Executable |
| 86 | 103 | quiet_cmd_host-csingle = HOSTCC $@ |
| 87 | 104 | cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ |
| 88 | − $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) | |
| 105 | + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) | |
| 89 | 106 | $(host-csingle): $(obj)/%: $(src)/%.c FORCE |
| 90 | 107 | $(call if_changed_dep,host-csingle) |
| 91 | 108 | |
| @@ -93,8 +110,8 @@ $(host-csingle): $(obj)/%: $(src)/%.c FORCE · 1 unmodified line | ||
| 93 | 110 | # host-cmulti -> executable |
| 94 | 111 | quiet_cmd_host-cmulti = HOSTLD $@ |
| 95 | 112 | cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \ |
| 96 | − $(addprefix $(obj)/,$($(@F)-objs)) \ | |
| 97 | − $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) | |
| 113 | + $(addprefix $(obj)/, $($(target-stem)-objs)) \ | |
| 114 | + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) | |
| 98 | 115 | $(host-cmulti): FORCE |
| 99 | 116 | $(call if_changed,host-cmulti) |
| 100 | 117 | $(call multi_depend, $(host-cmulti), , -objs) |
| @@ -111,8 +128,8 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE · 10 unmodified lines | ||
| 111 | 128 | quiet_cmd_host-cxxmulti = HOSTLD $@ |
| 112 | 129 | cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \ |
| 113 | 130 | $(foreach o,objs cxxobjs,\ |
| 114 | − $(addprefix $(obj)/,$($(@F)-$(o)))) \ | |
| 115 | − $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) | |
| 131 | + $(addprefix $(obj)/, $($(target-stem)-$(o)))) \ | |
| 132 | + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) | |
| 116 | 133 | $(host-cxxmulti): FORCE |
| 117 | 134 | $(call if_changed,host-cxxmulti) |
| 118 | 135 | $(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) |
| @@ -144,8 +161,8 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE · 25 unmodified lines | ||
| 144 | 161 | # *.o -> .so shared library (host-cshlib) |
| 145 | 162 | quiet_cmd_host-cshlib = HOSTLLD -shared $@ |
| 146 | 163 | cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ |
| 147 | − $(addprefix $(obj)/,$($(@F:.so=-objs))) \ | |
| 148 | − $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) | |
| 164 | + $(addprefix $(obj)/, $($(target-stem)-objs)) \ | |
| 165 | + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so) | |
| 149 | 166 | $(host-cshlib): FORCE |
| 150 | 167 | $(call if_changed,host-cshlib) |
| 151 | 168 | $(call multi_depend, $(host-cshlib), .so, -objs) |
| @@ -154,8 +171,8 @@ $(call multi_depend, $(host-cshlib), .so, -objs) · 2 unmodified lines | ||
| 154 | 171 | # *.o -> .so shared library (host-cxxshlib) |
| 155 | 172 | quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ |
| 156 | 173 | cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ |
| 157 | − $(addprefix $(obj)/,$($(@F:.so=-objs))) \ | |
| 158 | − $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) | |
| 174 | + $(addprefix $(obj)/, $($(target-stem)-objs)) \ | |
| 175 | + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so) | |
| 159 | 176 | $(host-cxxshlib): FORCE |
| 160 | 177 | $(call if_changed,host-cxxshlib) |
| 161 | 178 | $(call multi_depend, $(host-cxxshlib), .so, -objs) |
| @@ -41,9 +41,9 @@ obj-m := $(filter-out %/, $(obj-m)) · 40 unmodified lines | ||
| 41 | 41 | # Subdirectories we need to descend into |
| 42 | 42 | subdir-ym := $(sort $(subdir-y) $(subdir-m)) |
| 43 | 43 | |
| 44 | −# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object | |
| 45 | −multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | |
| 46 | −multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) | |
| 44 | +# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite object | |
| 45 | +multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))), $(m)))) | |
| 46 | +multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m)))) | |
| 47 | 47 | multi-used := $(multi-used-y) $(multi-used-m) |
| 48 | 48 | |
| 49 | 49 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to |
| @@ -52,8 +52,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y)) · 2 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | # Replace multi-part objects by their individual parts, |
| 54 | 54 | # including built-in.a from subdirectories |
| 55 | −real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | |
| 56 | −real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) | |
| 55 | +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) | |
| 56 | +real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) | |
| 57 | 57 | |
| 58 | 58 | # DTB |
| 59 | 59 | # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built |
| @@ -101,6 +101,9 @@ modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ · 41 unmodified lines | ||
| 101 | 101 | |
| 102 | 102 | modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) |
| 103 | 103 | |
| 104 | +# target with $(obj)/ and its suffix stripped | |
| 105 | +target-stem = $(basename $(patsubst $(obj)/%,%,$@)) | |
| 106 | + | |
| 104 | 107 | # These flags are needed for modversions and compiling, so we define them here |
| 105 | 108 | # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will |
| 106 | 109 | # end up in (or would, if it gets compiled in) |
| @@ -109,12 +112,12 @@ basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) · 2 unmodified lines | ||
| 109 | 112 | modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) |
| 110 | 113 | |
| 111 | 114 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ |
| 112 | − $(ccflags-y) $(CFLAGS_$(basetarget).o) | |
| 113 | −_c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | |
| 115 | + $(ccflags-y) $(CFLAGS_$(target-stem).o) | |
| 116 | +_c_flags = $(filter-out $(CFLAGS_REMOVE_$(target-stem).o), $(orig_c_flags)) | |
| 114 | 117 | orig_a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) \ |
| 115 | − $(asflags-y) $(AFLAGS_$(basetarget).o) | |
| 116 | −_a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags)) | |
| 117 | −_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | |
| 118 | + $(asflags-y) $(AFLAGS_$(target-stem).o) | |
| 119 | +_a_flags = $(filter-out $(AFLAGS_REMOVE_$(target-stem).o), $(orig_a_flags)) | |
| 120 | +_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds) | |
| 118 | 121 | |
| 119 | 122 | # |
| 120 | 123 | # Enable gcov profiling flags for a file, directory or for all files depending |
| @@ -159,6 +162,18 @@ _cpp_flags += -I $(srctree)/$(src) -I $(objtree)/$(obj) · 38 unmodified lines | ||
| 159 | 162 | endif |
| 160 | 163 | endif |
| 161 | 164 | |
| 165 | +part-of-module = $(if $(filter $(basename $@).o, $(real-obj-m)),y) | |
| 166 | +quiet_modtag = $(if $(part-of-module),[M], ) | |
| 167 | + | |
| 168 | +modkern_cflags = \ | |
| 169 | + $(if $(part-of-module), \ | |
| 170 | + $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ | |
| 171 | + $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | |
| 172 | + | |
| 173 | +modkern_aflags = $(if $(part-of-module), \ | |
| 174 | + $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \ | |
| 175 | + $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)) | |
| 176 | + | |
| 162 | 177 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
| 163 | 178 | -include $(srctree)/include/linux/compiler_types.h \ |
| 164 | 179 | $(_c_flags) $(modkern_cflags) \ |
| @@ -187,28 +202,6 @@ $(foreach m, $(notdir $1), \ · 22 unmodified lines | ||
| 187 | 202 | $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) |
| 188 | 203 | endef |
| 189 | 204 | |
| 190 | −# LEX | |
| 191 | −# --------------------------------------------------------------------------- | |
| 192 | −quiet_cmd_flex = LEX $@ | |
| 193 | − cmd_flex = $(LEX) -o$@ -L $< | |
| 194 | − | |
| 195 | −$(obj)/%.lex.c: $(src)/%.l FORCE | |
| 196 | − $(call if_changed,flex) | |
| 197 | − | |
| 198 | −# YACC | |
| 199 | −# --------------------------------------------------------------------------- | |
| 200 | −quiet_cmd_bison = YACC $@ | |
| 201 | − cmd_bison = $(YACC) -o$@ -t -l $< | |
| 202 | − | |
| 203 | −$(obj)/%.tab.c: $(src)/%.y FORCE | |
| 204 | − $(call if_changed,bison) | |
| 205 | − | |
| 206 | −quiet_cmd_bison_h = YACC $@ | |
| 207 | − cmd_bison_h = $(YACC) -o/dev/null --defines=$@ -t -l $< | |
| 208 | − | |
| 209 | −$(obj)/%.tab.h: $(src)/%.y FORCE | |
| 210 | − $(call if_changed,bison_h) | |
| 211 | − | |
| 212 | 205 | # Shipped files |
| 213 | 206 | # =========================================================================== |
| 214 | 207 | |
| @@ -258,7 +251,7 @@ quiet_cmd_gzip = GZIP $@ · 43 unmodified lines | ||
| 258 | 251 | DTC ?= $(objtree)/scripts/dtc/dtc |
| 259 | 252 | |
| 260 | 253 | # Disable noisy checks by default |
| 261 | −ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) | |
| 254 | +ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) | |
| 262 | 255 | DTC_FLAGS += -Wno-unit_address_vs_reg \ |
| 263 | 256 | -Wno-unit_address_format \ |
| 264 | 257 | -Wno-avoid_unnecessary_addr_size \ |
| @@ -269,7 +262,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \ · 4 unmodified lines | ||
| 269 | 262 | -Wno-pci_device_reg |
| 270 | 263 | endif |
| 271 | 264 | |
| 272 | −ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) | |
| 265 | +ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),) | |
| 273 | 266 | DTC_FLAGS += -Wnode_name_chars_strict \ |
| 274 | 267 | -Wproperty_name_chars_strict |
| 275 | 268 | endif |
| @@ -374,7 +367,7 @@ UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) · 98 unmodified lines | ||
| 374 | 367 | UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)' |
| 375 | 368 | |
| 376 | 369 | quiet_cmd_uimage = UIMAGE $@ |
| 377 | − cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ | |
| 370 | + cmd_uimage = $(BASH) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \ | |
| 378 | 371 | -C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \ |
| 379 | 372 | -T $(UIMAGE_TYPE) \ |
| 380 | 373 | -a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \ |
| @@ -0,0 +1,60 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +# =========================================================================== | |
| 3 | +# Module final link | |
| 4 | +# =========================================================================== | |
| 5 | + | |
| 6 | +PHONY := __modfinal | |
| 7 | +__modfinal: | |
| 8 | + | |
| 9 | +include $(srctree)/scripts/Kbuild.include | |
| 10 | + | |
| 11 | +# for c_flags | |
| 12 | +include $(srctree)/scripts/Makefile.lib | |
| 13 | + | |
| 14 | +# find all modules listed in modules.order | |
| 15 | +modules := $(sort $(shell cat $(MODORDER))) | |
| 16 | + | |
| 17 | +__modfinal: $(modules) | |
| 18 | + @: | |
| 19 | + | |
| 20 | +# modname and part-of-module are set to make c_flags define proper module flags | |
| 21 | +modname = $(notdir $(@:.mod.o=)) | |
| 22 | +part-of-module = y | |
| 23 | + | |
| 24 | +quiet_cmd_cc_o_c = CC [M] $@ | |
| 25 | + cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | |
| 26 | + | |
| 27 | +%.mod.o: %.mod.c FORCE | |
| 28 | + $(call if_changed_dep,cc_o_c) | |
| 29 | + | |
| 30 | +ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) | |
| 31 | + | |
| 32 | +quiet_cmd_ld_ko_o = LD [M] $@ | |
| 33 | + cmd_ld_ko_o = \ | |
| 34 | + $(LD) -r $(KBUILD_LDFLAGS) \ | |
| 35 | + $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ | |
| 36 | + $(addprefix -T , $(KBUILD_LDS_MODULE)) \ | |
| 37 | + -o $@ $(filter %.o, $^); \ | |
| 38 | + $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) | |
| 39 | + | |
| 40 | +$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) FORCE | |
| 41 | + +$(call if_changed,ld_ko_o) | |
| 42 | + | |
| 43 | +targets += $(modules) $(modules:.ko=.mod.o) | |
| 44 | + | |
| 45 | +# Add FORCE to the prequisites of a target to force it to be always rebuilt. | |
| 46 | +# --------------------------------------------------------------------------- | |
| 47 | + | |
| 48 | +PHONY += FORCE | |
| 49 | +FORCE: | |
| 50 | + | |
| 51 | +# Read all saved command lines and dependencies for the $(targets) we | |
| 52 | +# may be building above, using $(if_changed{,_dep}). As an | |
| 53 | +# optimization, we don't need to read them if the target does not | |
| 54 | +# exist, we will rebuild anyway in that case. | |
| 55 | + | |
| 56 | +existing-targets := $(wildcard $(sort $(targets))) | |
| 57 | + | |
| 58 | +-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) | |
| 59 | + | |
| 60 | +.PHONY: $(PHONY) | |
| @@ -15,15 +15,13 @@ · 14 unmodified lines | ||
| 15 | 15 | # 2) modpost is then used to |
| 16 | 16 | # 3) create one <module>.mod.c file pr. module |
| 17 | 17 | # 4) create one Module.symvers file with CRC for all exported symbols |
| 18 | −# 5) compile all <module>.mod.c files | |
| 19 | −# 6) final link of the module to a <module.ko> file | |
| 20 | 18 | |
| 21 | 19 | # Step 3 is used to place certain information in the module's ELF |
| 22 | 20 | # section, including information such as: |
| 23 | 21 | # Version magic (see include/linux/vermagic.h for full details) |
| 24 | 22 | # - Kernel release |
| 25 | 23 | # - SMP is CONFIG_SMP |
| 26 | −# - PREEMPT is CONFIG_PREEMPT | |
| 24 | +# - PREEMPT is CONFIG_PREEMPT[_RT] | |
| 27 | 25 | # - GCC Version |
| 28 | 26 | # Module info |
| 29 | 27 | # - Module version (MODULE_VERSION) |
| @@ -60,13 +58,10 @@ MODPOST = scripts/mod/modpost \ · 30 unmodified lines | ||
| 60 | 58 | |
| 61 | 59 | ifdef MODPOST_VMLINUX |
| 62 | 60 | |
| 63 | −__modpost: vmlinux.o | |
| 61 | +quiet_cmd_modpost = MODPOST vmlinux.o | |
| 62 | + cmd_modpost = $(MODPOST) vmlinux.o | |
| 64 | 63 | |
| 65 | −quiet_cmd_modpost = MODPOST $@ | |
| 66 | − cmd_modpost = $(MODPOST) $@ | |
| 67 | − | |
| 68 | −PHONY += vmlinux.o | |
| 69 | −vmlinux.o: | |
| 64 | +__modpost: | |
| 70 | 65 | $(call cmd,modpost) |
| 71 | 66 | |
| 72 | 67 | else |
| @@ -83,73 +78,22 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ · 10 unmodified lines | ||
| 83 | 78 | $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) |
| 84 | 79 | endif |
| 85 | 80 | |
| 86 | −include scripts/Makefile.lib | |
| 81 | +MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - $(wildcard vmlinux) | |
| 87 | 82 | |
| 88 | 83 | # find all modules listed in modules.order |
| 89 | 84 | modules := $(sort $(shell cat $(MODORDER))) |
| 90 | 85 | |
| 91 | −# Stop after building .o files if NOFINAL is set. Makes compile tests quicker | |
| 92 | −__modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) | |
| 93 | − @: | |
| 94 | − | |
| 95 | −MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - $(wildcard vmlinux) | |
| 96 | − | |
| 97 | −# We can go over command line length here, so be careful. | |
| 86 | +# Read out modules.order instead of expanding $(modules) to pass in modpost. | |
| 87 | +# Otherwise, allmodconfig would fail with "Argument list too long". | |
| 98 | 88 | quiet_cmd_modpost = MODPOST $(words $(modules)) modules |
| 99 | 89 | cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) |
| 100 | 90 | |
| 101 | −PHONY += modules-modpost | |
| 102 | −modules-modpost: | |
| 91 | +__modpost: | |
| 92 | + @$(kecho) ' Building modules, stage 2.' | |
| 103 | 93 | $(call cmd,modpost) |
| 104 | − | |
| 105 | −# Declare generated files as targets for modpost | |
| 106 | −$(modules:.ko=.mod.c): modules-modpost | |
| 107 | − | |
| 108 | −# Step 5), compile all *.mod.c files | |
| 109 | − | |
| 110 | −# modname is set to make c_flags define KBUILD_MODNAME | |
| 111 | −modname = $(notdir $(@:.mod.o=)) | |
| 112 | − | |
| 113 | −quiet_cmd_cc_o_c = CC $@ | |
| 114 | − cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \ | |
| 115 | − -c -o $@ $< | |
| 116 | − | |
| 117 | −$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE | |
| 118 | − $(call if_changed_dep,cc_o_c) | |
| 119 | − | |
| 120 | −targets += $(modules:.ko=.mod.o) | |
| 121 | − | |
| 122 | −ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) | |
| 123 | − | |
| 124 | −# Step 6), final link of the modules with optional arch pass after final link | |
| 125 | −quiet_cmd_ld_ko_o = LD [M] $@ | |
| 126 | − cmd_ld_ko_o = \ | |
| 127 | − $(LD) -r $(KBUILD_LDFLAGS) \ | |
| 128 | − $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ | |
| 129 | − -o $@ $(real-prereqs) ; \ | |
| 130 | − $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) | |
| 131 | − | |
| 132 | −$(modules): %.ko :%.o %.mod.o FORCE | |
| 133 | − +$(call if_changed,ld_ko_o) | |
| 134 | − | |
| 135 | −targets += $(modules) | |
| 136 | − | |
| 137 | − | |
| 138 | −# Add FORCE to the prequisites of a target to force it to be always rebuilt. | |
| 139 | −# --------------------------------------------------------------------------- | |
| 140 | − | |
| 141 | −PHONY += FORCE | |
| 142 | − | |
| 143 | −FORCE: | |
| 144 | − | |
| 145 | −# Read all saved command lines and dependencies for the $(targets) we | |
| 146 | −# may be building above, using $(if_changed{,_dep}). As an | |
| 147 | −# optimization, we don't need to read them if the target does not | |
| 148 | −# exist, we will rebuild anyway in that case. | |
| 149 | − | |
| 150 | −existing-targets := $(wildcard $(sort $(targets))) | |
| 151 | − | |
| 152 | −-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) | |
| 94 | +ifneq ($(KBUILD_MODPOST_NOFINAL),1) | |
| 95 | + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal | |
| 96 | +endif | |
| 153 | 97 | |
| 154 | 98 | endif |
| 155 | 99 | |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | # Makefile for the different targets used to generate full packages of a kernel |
| 3 | −# It uses the generic clean infrastructure of kbuild | |
| 3 | + | |
| 4 | +include $(srctree)/scripts/Kbuild.include | |
| 4 | 5 | |
| 5 | 6 | # RPM target |
| 6 | 7 | # --------------------------------------------------------------------------- |
| @@ -50,7 +51,8 @@ rm -f $(objtree)/.scmversion · 43 unmodified lines | ||
| 50 | 51 | |
| 51 | 52 | # rpm-pkg |
| 52 | 53 | # --------------------------------------------------------------------------- |
| 53 | −rpm-pkg: FORCE | |
| 54 | +PHONY += rpm-pkg | |
| 55 | +rpm-pkg: | |
| 54 | 56 | $(MAKE) clean |
| 55 | 57 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec |
| 56 | 58 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) |
| @@ -59,15 +61,15 @@ rpm-pkg: FORCE · 2 unmodified lines | ||
| 59 | 61 | |
| 60 | 62 | # binrpm-pkg |
| 61 | 63 | # --------------------------------------------------------------------------- |
| 62 | −binrpm-pkg: FORCE | |
| 64 | +PHONY += binrpm-pkg | |
| 65 | +binrpm-pkg: | |
| 63 | 66 | $(MAKE) -f $(srctree)/Makefile |
| 64 | 67 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec |
| 65 | 68 | +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
| 66 | 69 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
| 67 | 70 | |
| 68 | −clean-files += $(objtree)/*.spec | |
| 69 | − | |
| 70 | −deb-pkg: FORCE | |
| 71 | +PHONY += deb-pkg | |
| 72 | +deb-pkg: | |
| 71 | 73 | $(MAKE) clean |
| 72 | 74 | $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian |
| 73 | 75 | $(call cmd,src_tar,$(KDEB_SOURCENAME)) |
| @@ -75,18 +77,19 @@ deb-pkg: FORCE · 1 unmodified line | ||
| 75 | 77 | mv $(KDEB_SOURCENAME).tar.gz ../$(KDEB_SOURCENAME)_$${origversion}.orig.tar.gz |
| 76 | 78 | +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -i.git -us -uc |
| 77 | 79 | |
| 78 | −bindeb-pkg: FORCE | |
| 80 | +PHONY += bindeb-pkg | |
| 81 | +bindeb-pkg: | |
| 79 | 82 | $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian |
| 80 | 83 | +dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc |
| 81 | 84 | |
| 82 | −intdeb-pkg: FORCE | |
| 85 | +PHONY += intdeb-pkg | |
| 86 | +intdeb-pkg: | |
| 83 | 87 | +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb |
| 84 | 88 | |
| 85 | −clean-dirs += $(objtree)/debian/ | |
| 86 | − | |
| 87 | 89 | # snap-pkg |
| 88 | 90 | # --------------------------------------------------------------------------- |
| 89 | −snap-pkg: FORCE | |
| 91 | +PHONY += snap-pkg | |
| 92 | +snap-pkg: | |
| 90 | 93 | rm -rf $(objtree)/snap |
| 91 | 94 | mkdir $(objtree)/snap |
| 92 | 95 | $(MAKE) clean |
| @@ -98,17 +101,14 @@ snap-pkg: FORCE · 5 unmodified lines | ||
| 98 | 101 | cd $(objtree)/snap && \ |
| 99 | 102 | snapcraft --target-arch=$(UTS_MACHINE) |
| 100 | 103 | |
| 101 | −clean-dirs += $(objtree)/snap/ | |
| 102 | − | |
| 103 | 104 | # tarball targets |
| 104 | 105 | # --------------------------------------------------------------------------- |
| 105 | −tar%pkg: FORCE | |
| 106 | +tar-pkgs := tar-pkg targz-pkg tarbz2-pkg tarxz-pkg | |
| 107 | +PHONY += $(tar-pkgs) | |
| 108 | +$(tar-pkgs): | |
| 106 | 109 | $(MAKE) -f $(srctree)/Makefile |
| 107 | 110 | +$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ |
| 108 | 111 | |
| 109 | −clean-dirs += $(objtree)/tar-install/ | |
| 110 | − | |
| 111 | − | |
| 112 | 112 | # perf-pkg - generate a source tarball with perf source |
| 113 | 113 | # --------------------------------------------------------------------------- |
| 114 | 114 | |
| @@ -133,12 +133,15 @@ $(if $(findstring xz,$@),xz, \ · 18 unmodified lines | ||
| 133 | 133 | $(error unknown target $@)))) \ |
| 134 | 134 | -f -9 $(perf-tar).tar) |
| 135 | 135 | |
| 136 | −perf-%pkg: FORCE | |
| 136 | +perf-tar-pkgs := perf-tar-src-pkg perf-targz-src-pkg perf-tarbz2-src-pkg perf-tarxz-src-pkg | |
| 137 | +PHONY += $(perf-tar-pkgs) | |
| 138 | +$(perf-tar-pkgs): | |
| 137 | 139 | $(call cmd,perf_tar) |
| 138 | 140 | |
| 139 | 141 | # Help text displayed when executing 'make help' |
| 140 | 142 | # --------------------------------------------------------------------------- |
| 141 | −help: FORCE | |
| 143 | +PHONY += help | |
| 144 | +help: | |
| 142 | 145 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' |
| 143 | 146 | @echo ' binrpm-pkg - Build only the binary kernel RPM package' |
| 144 | 147 | @echo ' deb-pkg - Build both source and binary deb kernel packages' |
| @@ -152,3 +155,5 @@ help: FORCE · 7 unmodified lines | ||
| 152 | 155 | @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball' |
| 153 | 156 | @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball' |
| 154 | 157 | @echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball' |
| 158 | + | |
| 159 | +.PHONY: $(PHONY) | |
| @@ -1,16 +1,6 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | −### | |
| 3 | −# This Makefile lists the most basic programs used during the build process. | |
| 4 | −# The programs listed herein are what are needed to do the basic stuff, | |
| 5 | −# such as fix file dependencies. | |
| 6 | −# This initial step is needed to avoid files to be recompiled | |
| 7 | −# when kernel configuration changes (which is what happens when | |
| 8 | −# .config is included by main Makefile. | |
| 9 | −# --------------------------------------------------------------------------- | |
| 10 | −# fixdep: Used to generate dependency information during build process | |
| 2 | +# | |
| 3 | +# fixdep: used to generate dependency information during build process | |
| 11 | 4 | |
| 12 | 5 | hostprogs-y := fixdep |
| 13 | 6 | always := $(hostprogs-y) |
| 14 | − | |
| 15 | −# fixdep is needed to compile other host programs | |
| 16 | −$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep | |
| @@ -12,22 +12,15 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o · 11 unmodified lines | ||
| 12 | 12 | # |
| 13 | 13 | # Just in case, run "$(YACC) --version" without suppressing stderr |
| 14 | 14 | # so that 'bison: not found' will be displayed if it is missing. |
| 15 | −ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) | |
| 15 | +ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) | |
| 16 | 16 | |
| 17 | 17 | quiet_cmd_bison_no_warn = $(quiet_cmd_bison) |
| 18 | 18 | cmd_bison_no_warn = $(YACC) --version >/dev/null; \ |
| 19 | 19 | $(cmd_bison) 2>/dev/null |
| 20 | 20 | |
| 21 | −$(obj)/parse.tab.c: $(src)/parse.y FORCE | |
| 21 | +$(obj)/pars%.tab.c $(obj)/pars%.tab.h: $(src)/pars%.y FORCE | |
| 22 | 22 | $(call if_changed,bison_no_warn) |
| 23 | 23 | |
| 24 | −quiet_cmd_bison_h_no_warn = $(quiet_cmd_bison_h) | |
| 25 | − cmd_bison_h_no_warn = $(YACC) --version >/dev/null; \ | |
| 26 | − $(cmd_bison_h) 2>/dev/null | |
| 27 | − | |
| 28 | −$(obj)/parse.tab.h: $(src)/parse.y FORCE | |
| 29 | − $(call if_changed,bison_h_no_warn) | |
| 30 | − | |
| 31 | 24 | endif |
| 32 | 25 | |
| 33 | 26 | # -I needed for generated C source (shipped source) |
| @@ -3,11 +3,7 @@ static struct resword { · 2 unmodified lines | ||
| 3 | 3 | const char *name; |
| 4 | 4 | int token; |
| 5 | 5 | } keywords[] = { |
| 6 | − { "EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW }, | |
| 7 | − { "EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW }, | |
| 8 | − { "EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW }, | |
| 9 | − { "EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW }, | |
| 10 | − { "EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW }, | |
| 6 | + { "__GENKSYMS_EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW }, | |
| 11 | 7 | { "__asm", ASM_KEYW }, |
| 12 | 8 | { "__asm__", ASM_KEYW }, |
| 13 | 9 | { "__attribute", ATTRIBUTE_KEYW }, |
| @@ -1,25 +1,13 @@ | ||
| 1 | −/* Lexical analysis for genksyms. | |
| 2 | − Copyright 1996, 1997 Linux International. | |
| 3 | − | |
| 4 | − New implementation contributed by Richard Henderson <rth@tamu.edu> | |
| 5 | − Based on original work by Bjorn Ekwall <bj0rn@blox.se> | |
| 6 | − | |
| 7 | − Taken from Linux modutils 2.4.22. | |
| 8 | − | |
| 9 | − This program is free software; you can redistribute it and/or modify it | |
| 10 | − under the terms of the GNU General Public License as published by the | |
| 11 | − Free Software Foundation; either version 2 of the License, or (at your | |
| 12 | − option) any later version. | |
| 13 | − | |
| 14 | − This program is distributed in the hope that it will be useful, but | |
| 15 | − WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | − MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | − General Public License for more details. | |
| 18 | − | |
| 19 | − You should have received a copy of the GNU General Public License | |
| 20 | − along with this program; if not, write to the Free Software Foundation, | |
| 21 | − Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
| 22 | − | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | +/* | |
| 3 | + * Lexical analysis for genksyms. | |
| 4 | + * Copyright 1996, 1997 Linux International. | |
| 5 | + * | |
| 6 | + * New implementation contributed by Richard Henderson <rth@tamu.edu> | |
| 7 | + * Based on original work by Bjorn Ekwall <bj0rn@blox.se> | |
| 8 | + * | |
| 9 | + * Taken from Linux modutils 2.4.22. | |
| 10 | + */ | |
| 23 | 11 | |
| 24 | 12 | %{ |
| 25 | 13 | |
| @@ -1,25 +1,13 @@ | ||
| 1 | −/* C global declaration parser for genksyms. | |
| 2 | − Copyright 1996, 1997 Linux International. | |
| 3 | − | |
| 4 | − New implementation contributed by Richard Henderson <rth@tamu.edu> | |
| 5 | − Based on original work by Bjorn Ekwall <bj0rn@blox.se> | |
| 6 | − | |
| 7 | − This file is part of the Linux modutils. | |
| 8 | − | |
| 9 | − This program is free software; you can redistribute it and/or modify it | |
| 10 | − under the terms of the GNU General Public License as published by the | |
| 11 | − Free Software Foundation; either version 2 of the License, or (at your | |
| 12 | − option) any later version. | |
| 13 | − | |
| 14 | − This program is distributed in the hope that it will be useful, but | |
| 15 | − WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | − MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | − General Public License for more details. | |
| 18 | − | |
| 19 | − You should have received a copy of the GNU General Public License | |
| 20 | − along with this program; if not, write to the Free Software Foundation, | |
| 21 | − Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
| 22 | − | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | +/* | |
| 3 | + * C global declaration parser for genksyms. | |
| 4 | + * Copyright 1996, 1997 Linux International. | |
| 5 | + * | |
| 6 | + * New implementation contributed by Richard Henderson <rth@tamu.edu> | |
| 7 | + * Based on original work by Bjorn Ekwall <bj0rn@blox.se> | |
| 8 | + * | |
| 9 | + * This file is part of the Linux modutils. | |
| 10 | + */ | |
| 23 | 11 | |
| 24 | 12 | %{ |
| 25 | 13 | |
| @@ -41,5 +41,77 @@ sed -E -e ' · 40 unmodified lines | ||
| 41 | 41 | scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE |
| 42 | 42 | [ $? -gt 1 ] && exit 1 |
| 43 | 43 | |
| 44 | +# Remove /* ... */ style comments, and find CONFIG_ references in code | |
| 45 | +configs=$(sed -e ' | |
| 46 | +:comment | |
| 47 | + s:/\*[^*][^*]*:/*: | |
| 48 | + s:/\*\*\**\([^/]\):/*\1: | |
| 49 | + t comment | |
| 50 | + s:/\*\*/: : | |
| 51 | + t comment | |
| 52 | + /\/\*/! b check | |
| 53 | + N | |
| 54 | + b comment | |
| 55 | ||
| 56 | + P | |
| 57 | + D | |
| 58 | +:check | |
| 59 | + s:^\(CONFIG_[[:alnum:]_]*\):\1\n: | |
| 60 | + t print | |
| 61 | + s:^[[:alnum:]_][[:alnum:]_]*:: | |
| 62 | + s:^[^[:alnum:]_][^[:alnum:]_]*:: | |
| 63 | + t check | |
| 64 | + d | |
| 65 | +' $OUTFILE) | |
| 66 | + | |
| 67 | +# The entries in the following list are not warned. | |
| 68 | +# Please do not add a new entry. This list is only for existing ones. | |
| 69 | +# The list will be reduced gradually, and deleted eventually. (hopefully) | |
| 70 | +# | |
| 71 | +# The format is <file-name>:<CONFIG-option> in each line. | |
| 72 | +config_leak_ignores=" | |
| 73 | +arch/alpha/include/uapi/asm/setup.h:CONFIG_ALPHA_LEGACY_START_ADDRESS | |
| 74 | +arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K | |
| 75 | +arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K | |
| 76 | +arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE | |
| 77 | +arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ENDIAN_BE8 | |
| 78 | +arch/hexagon/include/uapi/asm/ptrace.h:CONFIG_HEXAGON_ARCH_VERSION | |
| 79 | +arch/hexagon/include/uapi/asm/user.h:CONFIG_HEXAGON_ARCH_VERSION | |
| 80 | +arch/ia64/include/uapi/asm/cmpxchg.h:CONFIG_IA64_DEBUG_CMPXCHG | |
| 81 | +arch/m68k/include/uapi/asm/ptrace.h:CONFIG_COLDFIRE | |
| 82 | +arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_NO | |
| 83 | +arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT | |
| 84 | +arch/sh/include/uapi/asm/ptrace.h:CONFIG_CPU_SH5 | |
| 85 | +arch/sh/include/uapi/asm/sigcontext.h:CONFIG_CPU_SH5 | |
| 86 | +arch/sh/include/uapi/asm/stat.h:CONFIG_CPU_SH5 | |
| 87 | +arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32_EMULATION | |
| 88 | +arch/x86/include/uapi/asm/auxvec.h:CONFIG_X86_64 | |
| 89 | +arch/x86/include/uapi/asm/mman.h:CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS | |
| 90 | +include/uapi/asm-generic/fcntl.h:CONFIG_64BIT | |
| 91 | +include/uapi/linux/atmdev.h:CONFIG_COMPAT | |
| 92 | +include/uapi/linux/elfcore.h:CONFIG_BINFMT_ELF_FDPIC | |
| 93 | +include/uapi/linux/eventpoll.h:CONFIG_PM_SLEEP | |
| 94 | +include/uapi/linux/hw_breakpoint.h:CONFIG_HAVE_MIXED_BREAKPOINTS_REGS | |
| 95 | +include/uapi/linux/pktcdvd.h:CONFIG_CDROM_PKTCDVD_WCACHE | |
| 96 | +include/uapi/linux/raw.h:CONFIG_MAX_RAW_DEVS | |
| 97 | +" | |
| 98 | + | |
| 99 | +for c in $configs | |
| 100 | +do | |
| 101 | + warn=1 | |
| 102 | + | |
| 103 | + for ignore in $config_leak_ignores | |
| 104 | + do | |
| 105 | + if echo "$INFILE:$c" | grep -q "$ignore$"; then | |
| 106 | + warn= | |
| 107 | + break | |
| 108 | + fi | |
| 109 | + done | |
| 110 | + | |
| 111 | + if [ "$warn" = 1 ]; then | |
| 112 | + echo "warning: $INFILE: leak $c to user-space" >&2 | |
| 113 | + fi | |
| 114 | +done | |
| 115 | + | |
| 44 | 116 | rm -f $TMPFILE |
| 45 | 117 | trap - EXIT |
| @@ -114,7 +114,7 @@ testconfig: $(obj)/conf · 113 unmodified lines | ||
| 114 | 114 | $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ |
| 115 | 115 | -o cache_dir=$(abspath $(obj)/tests/.cache) \ |
| 116 | 116 | $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) |
| 117 | −clean-dirs += tests/.cache | |
| 117 | +clean-files += tests/.cache | |
| 118 | 118 | |
| 119 | 119 | # Help text used by make help |
| 120 | 120 | help: |
| @@ -166,15 +166,15 @@ $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg · 45 unmodified lines | ||
| 166 | 166 | |
| 167 | 167 | # mconf: Used for the menuconfig target based on lxdialog |
| 168 | 168 | hostprogs-y += mconf |
| 169 | −lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o | |
| 170 | −mconf-objs := mconf.o $(addprefix lxdialog/, $(lxdialog)) $(common-objs) | |
| 169 | +lxdialog := $(addprefix lxdialog/, \ | |
| 170 | + checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) | |
| 171 | +mconf-objs := mconf.o $(lxdialog) $(common-objs) | |
| 171 | 172 | |
| 172 | 173 | HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs) |
| 173 | 174 | $(foreach f, mconf.o $(lxdialog), \ |
| 174 | 175 | $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/mconf-cfg && echo $$$$cflags))) |
| 175 | 176 | |
| 176 | −$(obj)/mconf.o: $(obj)/mconf-cfg | |
| 177 | −$(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/mconf-cfg | |
| 177 | +$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg | |
| 178 | 178 | |
| 179 | 179 | # qconf: Used for the xconfig target based on Qt |
| 180 | 180 | hostprogs-y += qconf |
| @@ -13,12 +13,12 @@ · 12 unmodified lines | ||
| 13 | 13 | # Copyright (c) 2009-2010 Wind River Systems, Inc. |
| 14 | 14 | # Copyright 2011 Linaro |
| 15 | 15 | |
| 16 | +set -e | |
| 17 | + | |
| 16 | 18 | clean_up() { |
| 17 | 19 | rm -f $TMP_FILE |
| 18 | 20 | rm -f $MERGE_FILE |
| 19 | − exit | |
| 20 | 21 | } |
| 21 | −trap clean_up HUP INT TERM | |
| 22 | 22 | |
| 23 | 23 | usage() { |
| 24 | 24 | echo "Usage: $0 [OPTIONS] [CONFIG [...]]" |
| @@ -110,6 +110,9 @@ TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) · 85 unmodified lines | ||
| 110 | 110 | MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX) |
| 111 | 111 | |
| 112 | 112 | echo "Using $INITFILE as base" |
| 113 | + | |
| 114 | +trap clean_up EXIT | |
| 115 | + | |
| 113 | 116 | cat $INITFILE > $TMP_FILE |
| 114 | 117 | |
| 115 | 118 | # Merge files, printing warnings on overridden values |
| @@ -155,7 +158,6 @@ if [ "$RUNMAKE" = "false" ]; then · 39 unmodified lines | ||
| 155 | 158 | echo "#" |
| 156 | 159 | echo "# merged configuration written to $KCONFIG_CONFIG (needs make)" |
| 157 | 160 | echo "#" |
| 158 | − clean_up | |
| 159 | 161 | exit |
| 160 | 162 | fi |
| 161 | 163 | |
| @@ -177,7 +179,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET · 15 unmodified lines | ||
| 177 | 179 | for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do |
| 178 | 180 | |
| 179 | 181 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) |
| 180 | − ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") | |
| 182 | + ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG" || true) | |
| 181 | 183 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then |
| 182 | 184 | echo "Value requested for $CFG not in final .config" |
| 183 | 185 | echo "Requested value: $REQUESTED_VAL" |
| @@ -185,5 +187,3 @@ for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do · 1 unmodified line | ||
| 185 | 187 | echo "" |
| 186 | 188 | fi |
| 187 | 189 | done |
| 188 | − | |
| 189 | −clean_up | |
| @@ -64,6 +64,8 @@ vmlinux_link() · 63 unmodified lines | ||
| 64 | 64 | local output=${1} |
| 65 | 65 | local objects |
| 66 | 66 | |
| 67 | + info LD ${output} | |
| 68 | + | |
| 67 | 69 | # skip output file argument |
| 68 | 70 | shift |
| 69 | 71 | |
| @@ -157,6 +159,18 @@ kallsyms() · 87 unmodified lines | ||
| 157 | 159 | ${CC} ${aflags} -c -o ${2} ${afile} |
| 158 | 160 | } |
| 159 | 161 | |
| 162 | +# Perform one step in kallsyms generation, including temporary linking of | |
| 163 | +# vmlinux. | |
| 164 | +kallsyms_step() | |
| 165 | +{ | |
| 166 | + kallsymso_prev=${kallsymso} | |
| 167 | + kallsymso=.tmp_kallsyms${1}.o | |
| 168 | + kallsyms_vmlinux=.tmp_vmlinux${1} | |
| 169 | + | |
| 170 | + vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} | |
| 171 | + kallsyms ${kallsyms_vmlinux} ${kallsymso} | |
| 172 | +} | |
| 173 | + | |
| 160 | 174 | # Create map file with all symbols from ${1} |
| 161 | 175 | # See mksymap for additional details |
| 162 | 176 | mksysmap() |
| @@ -243,6 +257,7 @@ if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then · 80 unmodified lines | ||
| 243 | 257 | fi |
| 244 | 258 | |
| 245 | 259 | kallsymso="" |
| 260 | +kallsymso_prev="" | |
| 246 | 261 | kallsyms_vmlinux="" |
| 247 | 262 | if [ -n "${CONFIG_KALLSYMS}" ]; then |
| 248 | 263 | |
| @@ -269,32 +284,19 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then · 20 unmodified lines | ||
| 269 | 284 | # a) Verify that the System.map from vmlinux matches the map from |
| 270 | 285 | # ${kallsymso}. |
| 271 | 286 | |
| 272 | − kallsymso=.tmp_kallsyms2.o | |
| 273 | − kallsyms_vmlinux=.tmp_vmlinux2 | |
| 274 | − | |
| 275 | − # step 1 | |
| 276 | − vmlinux_link .tmp_vmlinux1 ${btf_vmlinux_bin_o} | |
| 277 | − kallsyms .tmp_vmlinux1 .tmp_kallsyms1.o | |
| 278 | − | |
| 279 | − # step 2 | |
| 280 | − vmlinux_link .tmp_vmlinux2 .tmp_kallsyms1.o ${btf_vmlinux_bin_o} | |
| 281 | − kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o | |
| 287 | + kallsyms_step 1 | |
| 288 | + kallsyms_step 2 | |
| 282 | 289 | |
| 283 | 290 | # step 3 |
| 284 | − size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms1.o) | |
| 285 | − size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" .tmp_kallsyms2.o) | |
| 291 | + size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev}) | |
| 292 | + size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) | |
| 286 | 293 | |
| 287 | 294 | if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then |
| 288 | − kallsymso=.tmp_kallsyms3.o | |
| 289 | − kallsyms_vmlinux=.tmp_vmlinux3 | |
| 290 | − | |
| 291 | − vmlinux_link .tmp_vmlinux3 .tmp_kallsyms2.o ${btf_vmlinux_bin_o} | |
| 292 | − kallsyms .tmp_vmlinux3 .tmp_kallsyms3.o | |
| 295 | + kallsyms_step 3 | |
| 293 | 296 | fi |
| 294 | 297 | fi |
| 295 | 298 | |
| 296 | −info LD vmlinux | |
| 297 | −vmlinux_link vmlinux "${kallsymso}" "${btf_vmlinux_bin_o}" | |
| 299 | +vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o} | |
| 298 | 300 | |
| 299 | 301 | if [ -n "${CONFIG_BUILDTIME_EXTABLE_SORT}" ]; then |
| 300 | 302 | info SORTEX vmlinux |
| @@ -5,7 +5,8 @@ TARGET=$1 · 4 unmodified lines | ||
| 5 | 5 | ARCH=$2 |
| 6 | 6 | SMP=$3 |
| 7 | 7 | PREEMPT=$4 |
| 8 | −CC=$5 | |
| 8 | +PREEMPT_RT=$5 | |
| 9 | +CC=$6 | |
| 9 | 10 | |
| 10 | 11 | vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } |
| 11 | 12 | |
| @@ -53,6 +54,7 @@ UTS_VERSION="#$VERSION" · 41 unmodified lines | ||
| 53 | 54 | CONFIG_FLAGS="" |
| 54 | 55 | if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi |
| 55 | 56 | if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi |
| 57 | +if [ -n "$PREEMPT_RT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT_RT"; fi | |
| 56 | 58 | UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" |
| 57 | 59 | |
| 58 | 60 | # Truncate to maximum length |
| @@ -12,6 +12,6 @@ if [ "${quiet}" != "silent_" ]; then · 11 unmodified lines | ||
| 12 | 12 | fi |
| 13 | 13 | |
| 14 | 14 | cat << EOF > Makefile |
| 15 | −# Automatically generated by $(realpath $0): don't edit | |
| 16 | −include $(realpath $1/Makefile) | |
| 15 | +# Automatically generated by $0: don't edit | |
| 16 | +include $1/Makefile | |
| 17 | 17 | EOF |
| @@ -34,6 +34,11 @@ typedef Elf64_Addr kernel_ulong_t; · 33 unmodified lines | ||
| 34 | 34 | typedef uint32_t __u32; |
| 35 | 35 | typedef uint16_t __u16; |
| 36 | 36 | typedef unsigned char __u8; |
| 37 | +typedef struct { | |
| 38 | + __u8 b[16]; | |
| 39 | +} guid_t; | |
| 40 | + | |
| 41 | +/* backwards compatibility, don't use in new code */ | |
| 37 | 42 | typedef struct { |
| 38 | 43 | __u8 b[16]; |
| 39 | 44 | } uuid_le; |
| @@ -169,6 +169,7 @@ struct symbol { · 168 unmodified lines | ||
| 169 | 169 | unsigned int kernel:1; /* 1 if symbol is from kernel |
| 170 | 170 | * (only for external modules) **/ |
| 171 | 171 | unsigned int preloaded:1; /* 1 if symbol from Module.symvers, or crc */ |
| 172 | + unsigned int is_static:1; /* 1 if symbol is not global */ | |
| 172 | 173 | enum export export; /* Type of export */ |
| 173 | 174 | char name[0]; |
| 174 | 175 | }; |
| @@ -201,6 +202,7 @@ static struct symbol *alloc_symbol(const char *name, unsigned int weak, · 26 unmodified lines | ||
| 201 | 202 | strcpy(s->name, name); |
| 202 | 203 | s->weak = weak; |
| 203 | 204 | s->next = next; |
| 205 | + s->is_static = 1; | |
| 204 | 206 | return s; |
| 205 | 207 | } |
| 206 | 208 | |
| @@ -795,9 +797,9 @@ static int match(const char *sym, const char * const pat[]) · 588 unmodified lines | ||
| 795 | 797 | |
| 796 | 798 | /* "*foo*" */ |
| 797 | 799 | if (*p == '*' && *endp == '*') { |
| 798 | − char *here, *bare = strndup(p + 1, strlen(p) - 2); | |
| 800 | + char *bare = NOFAIL(strndup(p + 1, strlen(p) - 2)); | |
| 801 | + char *here = strstr(sym, bare); | |
| 799 | 802 | |
| 800 | − here = strstr(sym, bare); | |
| 801 | 803 | free(bare); |
| 802 | 804 | if (here != NULL) |
| 803 | 805 | return 1; |
| @@ -1980,6 +1982,21 @@ static void read_symbols(const char *modname) · 1176 unmodified lines | ||
| 1980 | 1982 | handle_modversions(mod, &info, sym, symname); |
| 1981 | 1983 | handle_moddevtable(mod, &info, sym, symname); |
| 1982 | 1984 | } |
| 1985 | + | |
| 1986 | + // check for static EXPORT_SYMBOL_* functions && global vars | |
| 1987 | + for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { | |
| 1988 | + unsigned char bind = ELF_ST_BIND(sym->st_info); | |
| 1989 | + | |
| 1990 | + if (bind == STB_GLOBAL || bind == STB_WEAK) { | |
| 1991 | + struct symbol *s = | |
| 1992 | + find_symbol(remove_dot(info.strtab + | |
| 1993 | + sym->st_name)); | |
| 1994 | + | |
| 1995 | + if (s) | |
| 1996 | + s->is_static = 0; | |
| 1997 | + } | |
| 1998 | + } | |
| 1999 | + | |
| 1983 | 2000 | if (!is_vmlinux(modname) || vmlinux_section_warnings) |
| 1984 | 2001 | check_sec_ref(mod, modname, &info); |
| 1985 | 2002 | |
| @@ -2159,7 +2176,7 @@ static void add_header(struct buffer *b, struct module *mod) · 173 unmodified lines | ||
| 2159 | 2176 | buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); |
| 2160 | 2177 | buf_printf(b, "\n"); |
| 2161 | 2178 | buf_printf(b, "__visible struct module __this_module\n"); |
| 2162 | − buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); | |
| 2179 | + buf_printf(b, "__section(.gnu.linkonce.this_module) = {\n"); | |
| 2163 | 2180 | buf_printf(b, "\t.name = KBUILD_MODNAME,\n"); |
| 2164 | 2181 | if (mod->has_init) |
| 2165 | 2182 | buf_printf(b, "\t.init = init_module,\n"); |
| @@ -2213,8 +2230,7 @@ static int add_versions(struct buffer *b, struct module *mod) · 47 unmodified lines | ||
| 2213 | 2230 | |
| 2214 | 2231 | buf_printf(b, "\n"); |
| 2215 | 2232 | buf_printf(b, "static const struct modversion_info ____versions[]\n"); |
| 2216 | − buf_printf(b, "__used\n"); | |
| 2217 | − buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n"); | |
| 2233 | + buf_printf(b, "__used __section(__versions) = {\n"); | |
| 2218 | 2234 | |
| 2219 | 2235 | for (s = mod->unres; s; s = s->next) { |
| 2220 | 2236 | if (!s->module) |
| @@ -2250,10 +2266,7 @@ static void add_depends(struct buffer *b, struct module *mod) · 29 unmodified lines | ||
| 2250 | 2266 | s->module->seen = is_vmlinux(s->module->name); |
| 2251 | 2267 | |
| 2252 | 2268 | buf_printf(b, "\n"); |
| 2253 | − buf_printf(b, "static const char __module_depends[]\n"); | |
| 2254 | − buf_printf(b, "__used\n"); | |
| 2255 | − buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n"); | |
| 2256 | − buf_printf(b, "\"depends="); | |
| 2269 | + buf_printf(b, "MODULE_INFO(depends, \""); | |
| 2257 | 2270 | for (s = mod->unres; s; s = s->next) { |
| 2258 | 2271 | const char *p; |
| 2259 | 2272 | if (!s->module) |
| @@ -2271,7 +2284,7 @@ static void add_depends(struct buffer *b, struct module *mod) · 11 unmodified lines | ||
| 2271 | 2284 | buf_printf(b, "%s%s", first ? "" : ",", p); |
| 2272 | 2285 | first = 0; |
| 2273 | 2286 | } |
| 2274 | − buf_printf(b, "\";\n"); | |
| 2287 | + buf_printf(b, "\");\n"); | |
| 2275 | 2288 | } |
| 2276 | 2289 | |
| 2277 | 2290 | static void add_srcversion(struct buffer *b, struct module *mod) |
| @@ -2369,6 +2382,7 @@ static void read_dump(const char *fname, unsigned int kernel) · 91 unmodified lines | ||
| 2369 | 2382 | s = sym_add_exported(symname, mod, export_no(export)); |
| 2370 | 2383 | s->kernel = kernel; |
| 2371 | 2384 | s->preloaded = 1; |
| 2385 | + s->is_static = 0; | |
| 2372 | 2386 | sym_update_crc(symname, mod, crc, export_no(export)); |
| 2373 | 2387 | } |
| 2374 | 2388 | release_file(file, size); |
| @@ -2425,6 +2439,7 @@ int main(int argc, char **argv) · 50 unmodified lines | ||
| 2425 | 2439 | char *dump_write = NULL, *files_source = NULL; |
| 2426 | 2440 | int opt; |
| 2427 | 2441 | int err; |
| 2442 | + int n; | |
| 2428 | 2443 | struct ext_sym_list *extsym_iter; |
| 2429 | 2444 | struct ext_sym_list *extsym_start = NULL; |
| 2430 | 2445 | |
| @@ -2520,6 +2535,19 @@ int main(int argc, char **argv) · 89 unmodified lines | ||
| 2520 | 2535 | if (sec_mismatch_count && sec_mismatch_fatal) |
| 2521 | 2536 | fatal("modpost: Section mismatches detected.\n" |
| 2522 | 2537 | "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); |
| 2538 | + for (n = 0; n < SYMBOL_HASH_SIZE; n++) { | |
| 2539 | + struct symbol *s = symbolhash[n]; | |
| 2540 | + | |
| 2541 | + while (s) { | |
| 2542 | + if (s->is_static) | |
| 2543 | + warn("\"%s\" [%s] is a static %s\n", | |
| 2544 | + s->name, s->module->name, | |
| 2545 | + export_str(s->export)); | |
| 2546 | + | |
| 2547 | + s = s->next; | |
| 2548 | + } | |
| 2549 | + } | |
| 2550 | + | |
| 2523 | 2551 | free(buf.p); |
| 2524 | 2552 | |
| 2525 | 2553 | return err; |
| @@ -115,6 +115,4 @@ header-test-y += $(filter-out $(header-test-), \ · 114 unmodified lines | ||
| 115 | 115 | $(patsubst $(obj)/%,%, $(wildcard \ |
| 116 | 116 | $(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h)))) |
| 117 | 117 | |
| 118 | −# For GNU Make <= 4.2.1, $(wildcard $(obj)/*/) matches to not only directories | |
| 119 | −# but also regular files. Use $(filter %/, ...) just in case. | |
| 120 | −clean-dirs += $(patsubst $(obj)/%/,%,$(filter %/, $(wildcard $(obj)/*/))) | |
| 118 | +clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*))) | |