Pull Kbuild fixes from Masahiro Yamada: - fix __uint128_t capability test in Kconfig when GCC that defaults to 32-bit is used to build the 64-bit kernel - suppress new noisy Clang warnings -Wpointer-to-enum-cast - move the namespace field in Module.symvers for the backward compatibility reason for the depmod tool - use available compression for initramdisk when INTRAMFS_SOURCE is defined, which was the original behavior - fix modpost to handle correct large section numbers when it refers to modversion CRCs and module namespaces - fix comments and documents * tag 'kbuild-fixes-v5.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: scripts/kallsyms: fix wrong kallsyms_relative_base modpost: Get proper section index by get_secindex() instead of st_shndx initramfs: restore default compression behavior modpost: move the namespace field in Module.symvers last kbuild: Disable -Wpointer-to-enum-cast kbuild: doc: fix references to other documents int128: fix __uint128_t compiler test in Kconfig kconfig: introduce m32-flag and m64-flag kbuild: Fix inconsistent comment
Unified · Split
| @@ -237,7 +237,7 @@ This is solely useful to speed up test compiles. · 236 unmodified lines | |||
| 237 | KBUILD_EXTRA_SYMBOLS | 237 | KBUILD_EXTRA_SYMBOLS |
| 238 | -------------------- | 238 | -------------------- |
| 239 | For modules that use symbols from other modules. | 239 | For modules that use symbols from other modules. |
| 240 | See more details in modules.txt. | 240 | See more details in modules.rst. |
| 241 | 241 | ||
| 242 | ALLSOURCE_ARCHS | 242 | ALLSOURCE_ARCHS |
| 243 | --------------- | 243 | --------------- |
| @@ -44,7 +44,7 @@ intermediate:: · 43 unmodified lines | |||
| 44 | def_bool y | 44 | def_bool y |
| 45 | 45 | ||
| 46 | Then, Kconfig moves onto the evaluation stage to resolve inter-symbol | 46 | Then, Kconfig moves onto the evaluation stage to resolve inter-symbol |
| 47 | dependency as explained in kconfig-language.txt. | 47 | dependency as explained in kconfig-language.rst. |
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | Variables | 50 | Variables |
| @@ -924,7 +924,7 @@ When kbuild executes, the following steps are followed (roughly): · 923 unmodified lines | |||
| 924 | $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that | 924 | $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that |
| 925 | are used for assembler. | 925 | are used for assembler. |
| 926 | 926 | ||
| 927 | From commandline AFLAGS_MODULE shall be used (see kbuild.txt). | 927 | From commandline AFLAGS_MODULE shall be used (see kbuild.rst). |
| 928 | 928 | ||
| 929 | KBUILD_CFLAGS_KERNEL | 929 | KBUILD_CFLAGS_KERNEL |
| 930 | $(CC) options specific for built-in | 930 | $(CC) options specific for built-in |
| @@ -937,7 +937,7 @@ When kbuild executes, the following steps are followed (roughly): · 6 unmodified lines | |||
| 937 | 937 | ||
| 938 | $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that | 938 | $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that |
| 939 | are used for $(CC). | 939 | are used for $(CC). |
| 940 | From commandline CFLAGS_MODULE shall be used (see kbuild.txt). | 940 | From commandline CFLAGS_MODULE shall be used (see kbuild.rst). |
| 941 | 941 | ||
| 942 | KBUILD_LDFLAGS_MODULE | 942 | KBUILD_LDFLAGS_MODULE |
| 943 | Options for $(LD) when linking modules | 943 | Options for $(LD) when linking modules |
| @@ -945,7 +945,7 @@ When kbuild executes, the following steps are followed (roughly): · 1 unmodified line | |||
| 945 | $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options | 945 | $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options |
| 946 | used when linking modules. This is often a linker script. | 946 | used when linking modules. This is often a linker script. |
| 947 | 947 | ||
| 948 | From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). | 948 | From commandline LDFLAGS_MODULE shall be used (see kbuild.rst). |
| 949 | 949 | ||
| 950 | KBUILD_LDS | 950 | KBUILD_LDS |
| 951 | 951 | ||
| @@ -470,9 +470,9 @@ build. · 469 unmodified lines | |||
| 470 | 470 | ||
| 471 | The syntax of the Module.symvers file is:: | 471 | The syntax of the Module.symvers file is:: |
| 472 | 472 | ||
| 473 | <CRC> <Symbol> <Namespace> <Module> <Export Type> | 473 | <CRC> <Symbol> <Module> <Export Type> <Namespace> |
| 474 | 474 | ||
| 475 | 0xe1cc2a05 usb_stor_suspend USB_STORAGE drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL | 475 | 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE |
| 476 | 476 | ||
| 477 | The fields are separated by tabs and values may be empty (e.g. | 477 | The fields are separated by tabs and values may be empty (e.g. |
| 478 | if no namespace is defined for an exported symbol). | 478 | if no namespace is defined for an exported symbol). |
| @@ -1804,7 +1804,7 @@ existing-targets := $(wildcard $(sort $(targets))) · 1803 unmodified lines | |||
| 1804 | 1804 | ||
| 1805 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) | 1805 | -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) |
| 1806 | 1806 | ||
| 1807 | endif # config-targets | 1807 | endif # config-build |
| 1808 | endif # mixed-build | 1808 | endif # mixed-build |
| 1809 | endif # need-sub-make | 1809 | endif # need-sub-make |
| 1810 | 1810 | ||
| @@ -767,8 +767,7 @@ config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH · 766 unmodified lines | |||
| 767 | bool | 767 | bool |
| 768 | 768 | ||
| 769 | config CC_HAS_INT128 | 769 | config CC_HAS_INT128 |
| 770 | def_bool y | 770 | def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT |
| 771 | depends on !$(cc-option,-D__SIZEOF_INT128__=0) | ||
| 772 | 771 | ||
| 773 | # | 772 | # |
| 774 | # For architectures that know their GCC __int128 support is sound | 773 | # For architectures that know their GCC __int128 support is sound |
| @@ -44,3 +44,10 @@ $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supporte · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | # gcc version including patch level | 45 | # gcc version including patch level |
| 46 | gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) | 46 | gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) |
| 47 | |||
| 48 | # machine bit flags | ||
| 49 | # $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise. | ||
| 50 | # $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise. | ||
| 51 | cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1)) | ||
| 52 | m32-flag := $(cc-option-bit,-m32) | ||
| 53 | m64-flag := $(cc-option-bit,-m64) | ||
| @@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides · 47 unmodified lines | |||
| 48 | KBUILD_CFLAGS += -Wno-format | 48 | KBUILD_CFLAGS += -Wno-format |
| 49 | KBUILD_CFLAGS += -Wno-sign-compare | 49 | KBUILD_CFLAGS += -Wno-sign-compare |
| 50 | KBUILD_CFLAGS += -Wno-format-zero-length | 50 | KBUILD_CFLAGS += -Wno-format-zero-length |
| 51 | KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) | ||
| 51 | endif | 52 | endif |
| 52 | 53 | ||
| 53 | endif | 54 | endif |
| @@ -94,7 +94,7 @@ if (defined $opt{'o'}) { · 93 unmodified lines | |||
| 94 | # | 94 | # |
| 95 | while ( <$module_symvers> ) { | 95 | while ( <$module_symvers> ) { |
| 96 | chomp; | 96 | chomp; |
| 97 | my (undef, $symbol, $namespace, $module, $gpl) = split('\t'); | 97 | my (undef, $symbol, $module, $gpl, $namespace) = split('\t'); |
| 98 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; | 98 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; |
| 99 | } | 99 | } |
| 100 | close($module_symvers); | 100 | close($module_symvers); |
| @@ -195,13 +195,13 @@ static struct sym_entry *read_symbol(FILE *in) · 194 unmodified lines | |||
| 195 | return NULL; | 195 | return NULL; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | if (is_ignored_symbol(name, type)) | ||
| 199 | return NULL; | ||
| 200 | |||
| 201 | /* Ignore most absolute/undefined (?) symbols. */ | ||
| 202 | if (strcmp(name, "_text") == 0) | 198 | if (strcmp(name, "_text") == 0) |
| 203 | _text = addr; | 199 | _text = addr; |
| 204 | 200 | ||
| 201 | /* Ignore most absolute/undefined (?) symbols. */ | ||
| 202 | if (is_ignored_symbol(name, type)) | ||
| 203 | return NULL; | ||
| 204 | |||
| 205 | check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges)); | 205 | check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges)); |
| 206 | check_symbol_range(name, addr, &percpu_range, 1); | 206 | check_symbol_range(name, addr, &percpu_range, 1); |
| 207 | 207 | ||
| @@ -308,7 +308,8 @@ static const char *sec_name(struct elf_info *elf, int secindex) · 307 unmodified lines | |||
| 308 | 308 | ||
| 309 | static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym) | 309 | static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym) |
| 310 | { | 310 | { |
| 311 | Elf_Shdr *sechdr = &info->sechdrs[sym->st_shndx]; | 311 | unsigned int secindex = get_secindex(info, sym); |
| 312 | Elf_Shdr *sechdr = &info->sechdrs[secindex]; | ||
| 312 | unsigned long offset; | 313 | unsigned long offset; |
| 313 | 314 | ||
| 314 | offset = sym->st_value; | 315 | offset = sym->st_value; |
| @@ -2427,7 +2428,7 @@ static void write_if_changed(struct buffer *b, const char *fname) · 2112 unmodified lines | |||
| 2427 | } | 2428 | } |
| 2428 | 2429 | ||
| 2429 | /* parse Module.symvers file. line format: | 2430 | /* parse Module.symvers file. line format: |
| 2430 | * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something] | 2431 | * 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace |
| 2431 | **/ | 2432 | **/ |
| 2432 | static void read_dump(const char *fname, unsigned int kernel) | 2433 | static void read_dump(const char *fname, unsigned int kernel) |
| 2433 | { | 2434 | { |
| @@ -2440,7 +2441,7 @@ static void read_dump(const char *fname, unsigned int kernel) · 6 unmodified lines | |||
| 2440 | return; | 2441 | return; |
| 2441 | 2442 | ||
| 2442 | while ((line = get_next_line(&pos, file, size))) { | 2443 | while ((line = get_next_line(&pos, file, size))) { |
| 2443 | char *symname, *namespace, *modname, *d, *export, *end; | 2444 | char *symname, *namespace, *modname, *d, *export; |
| 2444 | unsigned int crc; | 2445 | unsigned int crc; |
| 2445 | struct module *mod; | 2446 | struct module *mod; |
| 2446 | struct symbol *s; | 2447 | struct symbol *s; |
| @@ -2448,16 +2449,16 @@ static void read_dump(const char *fname, unsigned int kernel) · 1 unmodified line | |||
| 2448 | if (!(symname = strchr(line, '\t'))) | 2449 | if (!(symname = strchr(line, '\t'))) |
| 2449 | goto fail; | 2450 | goto fail; |
| 2450 | *symname++ = '\0'; | 2451 | *symname++ = '\0'; |
| 2451 | if (!(namespace = strchr(symname, '\t'))) | 2452 | if (!(modname = strchr(symname, '\t'))) |
| 2452 | goto fail; | ||
| 2453 | *namespace++ = '\0'; | ||
| 2454 | if (!(modname = strchr(namespace, '\t'))) | ||
| 2455 | goto fail; | 2453 | goto fail; |
| 2456 | *modname++ = '\0'; | 2454 | *modname++ = '\0'; |
| 2457 | if ((export = strchr(modname, '\t')) != NULL) | 2455 | if (!(export = strchr(modname, '\t'))) |
| 2458 | *export++ = '\0'; | 2456 | goto fail; |
| 2459 | if (export && ((end = strchr(export, '\t')) != NULL)) | 2457 | *export++ = '\0'; |
| 2460 | *end = '\0'; | 2458 | if (!(namespace = strchr(export, '\t'))) |
| 2459 | goto fail; | ||
| 2460 | *namespace++ = '\0'; | ||
| 2461 | |||
| 2461 | crc = strtoul(line, &d, 16); | 2462 | crc = strtoul(line, &d, 16); |
| 2462 | if (*symname == '\0' || *modname == '\0' || *d != '\0') | 2463 | if (*symname == '\0' || *modname == '\0' || *d != '\0') |
| 2463 | goto fail; | 2464 | goto fail; |
| @@ -2508,9 +2509,9 @@ static void write_dump(const char *fname) · 44 unmodified lines | |||
| 2508 | namespace = symbol->namespace; | 2509 | namespace = symbol->namespace; |
| 2509 | buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n", | 2510 | buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n", |
| 2510 | symbol->crc, symbol->name, | 2511 | symbol->crc, symbol->name, |
| 2511 | namespace ? namespace : "", | ||
| 2512 | symbol->module->name, | 2512 | symbol->module->name, |
| 2513 | export_str(symbol->export)); | 2513 | export_str(symbol->export), |
| 2514 | namespace ? namespace : ""); | ||
| 2514 | } | 2515 | } |
| 2515 | symbol = symbol->next; | 2516 | symbol = symbol->next; |
| 2516 | } | 2517 | } |
| @@ -124,17 +124,6 @@ choice · 123 unmodified lines | |||
| 124 | 124 | ||
| 125 | If in doubt, select 'None' | 125 | If in doubt, select 'None' |
| 126 | 126 | ||
| 127 | config INITRAMFS_COMPRESSION_NONE | ||
| 128 | bool "None" | ||
| 129 | help | ||
| 130 | Do not compress the built-in initramfs at all. This may sound wasteful | ||
| 131 | in space, but, you should be aware that the built-in initramfs will be | ||
| 132 | compressed at a later stage anyways along with the rest of the kernel, | ||
| 133 | on those architectures that support this. However, not compressing the | ||
| 134 | initramfs may lead to slightly higher memory consumption during a | ||
| 135 | short time at boot, while both the cpio image and the unpacked | ||
| 136 | filesystem image will be present in memory simultaneously | ||
| 137 | |||
| 138 | config INITRAMFS_COMPRESSION_GZIP | 127 | config INITRAMFS_COMPRESSION_GZIP |
| 139 | bool "Gzip" | 128 | bool "Gzip" |
| 140 | depends on RD_GZIP | 129 | depends on RD_GZIP |
| @@ -207,4 +196,15 @@ config INITRAMFS_COMPRESSION_LZ4 · 66 unmodified lines | |||
| 207 | If you choose this, keep in mind that most distros don't provide lz4 | 196 | If you choose this, keep in mind that most distros don't provide lz4 |
| 208 | by default which could cause a build failure. | 197 | by default which could cause a build failure. |
| 209 | 198 | ||
| 199 | config INITRAMFS_COMPRESSION_NONE | ||
| 200 | bool "None" | ||
| 201 | help | ||
| 202 | Do not compress the built-in initramfs at all. This may sound wasteful | ||
| 203 | in space, but, you should be aware that the built-in initramfs will be | ||
| 204 | compressed at a later stage anyways along with the rest of the kernel, | ||
| 205 | on those architectures that support this. However, not compressing the | ||
| 206 | initramfs may lead to slightly higher memory consumption during a | ||
| 207 | short time at boot, while both the cpio image and the unpacked | ||
| 208 | filesystem image will be present in memory simultaneously | ||
| 209 | |||
| 210 | endchoice | 210 | endchoice |