Commit 207f75c4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'kbuild-fixes-v5.6-3' of...

Merge tag 'kbuild-fixes-v5.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

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
parents 5d892919 7883a143
...@@ -237,7 +237,7 @@ This is solely useful to speed up test compiles. ...@@ -237,7 +237,7 @@ This is solely useful to speed up test compiles.
KBUILD_EXTRA_SYMBOLS KBUILD_EXTRA_SYMBOLS
-------------------- --------------------
For modules that use symbols from other modules. For modules that use symbols from other modules.
See more details in modules.txt. See more details in modules.rst.
ALLSOURCE_ARCHS ALLSOURCE_ARCHS
--------------- ---------------
......
...@@ -44,7 +44,7 @@ intermediate:: ...@@ -44,7 +44,7 @@ intermediate::
def_bool y def_bool y
Then, Kconfig moves onto the evaluation stage to resolve inter-symbol Then, Kconfig moves onto the evaluation stage to resolve inter-symbol
dependency as explained in kconfig-language.txt. dependency as explained in kconfig-language.rst.
Variables Variables
......
...@@ -924,7 +924,7 @@ When kbuild executes, the following steps are followed (roughly): ...@@ -924,7 +924,7 @@ When kbuild executes, the following steps are followed (roughly):
$(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
are used for assembler. are used for assembler.
From commandline AFLAGS_MODULE shall be used (see kbuild.txt). From commandline AFLAGS_MODULE shall be used (see kbuild.rst).
KBUILD_CFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
$(CC) options specific for built-in $(CC) options specific for built-in
...@@ -937,7 +937,7 @@ When kbuild executes, the following steps are followed (roughly): ...@@ -937,7 +937,7 @@ When kbuild executes, the following steps are followed (roughly):
$(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
are used for $(CC). are used for $(CC).
From commandline CFLAGS_MODULE shall be used (see kbuild.txt). From commandline CFLAGS_MODULE shall be used (see kbuild.rst).
KBUILD_LDFLAGS_MODULE KBUILD_LDFLAGS_MODULE
Options for $(LD) when linking modules Options for $(LD) when linking modules
...@@ -945,7 +945,7 @@ When kbuild executes, the following steps are followed (roughly): ...@@ -945,7 +945,7 @@ When kbuild executes, the following steps are followed (roughly):
$(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
used when linking modules. This is often a linker script. used when linking modules. This is often a linker script.
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). From commandline LDFLAGS_MODULE shall be used (see kbuild.rst).
KBUILD_LDS KBUILD_LDS
......
...@@ -470,9 +470,9 @@ build. ...@@ -470,9 +470,9 @@ build.
The syntax of the Module.symvers file is:: The syntax of the Module.symvers file is::
<CRC> <Symbol> <Namespace> <Module> <Export Type> <CRC> <Symbol> <Module> <Export Type> <Namespace>
0xe1cc2a05 usb_stor_suspend USB_STORAGE drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE
The fields are separated by tabs and values may be empty (e.g. The fields are separated by tabs and values may be empty (e.g.
if no namespace is defined for an exported symbol). if no namespace is defined for an exported symbol).
......
...@@ -1804,7 +1804,7 @@ existing-targets := $(wildcard $(sort $(targets))) ...@@ -1804,7 +1804,7 @@ existing-targets := $(wildcard $(sort $(targets)))
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
endif # config-targets endif # config-build
endif # mixed-build endif # mixed-build
endif # need-sub-make endif # need-sub-make
......
...@@ -767,8 +767,7 @@ config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH ...@@ -767,8 +767,7 @@ config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
bool bool
config CC_HAS_INT128 config CC_HAS_INT128
def_bool y def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT
depends on !$(cc-option,-D__SIZEOF_INT128__=0)
# #
# For architectures that know their GCC __int128 support is sound # 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 ...@@ -44,3 +44,10 @@ $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supporte
# gcc version including patch level # gcc version including patch level
gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC)) gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
# machine bit flags
# $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise.
# $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise.
cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
m32-flag := $(cc-option-bit,-m32)
m64-flag := $(cc-option-bit,-m64)
...@@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides ...@@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides
KBUILD_CFLAGS += -Wno-format KBUILD_CFLAGS += -Wno-format
KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-sign-compare
KBUILD_CFLAGS += -Wno-format-zero-length KBUILD_CFLAGS += -Wno-format-zero-length
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
endif endif
endif endif
......
...@@ -94,7 +94,7 @@ if (defined $opt{'o'}) { ...@@ -94,7 +94,7 @@ if (defined $opt{'o'}) {
# #
while ( <$module_symvers> ) { while ( <$module_symvers> ) {
chomp; chomp;
my (undef, $symbol, $namespace, $module, $gpl) = split('\t'); my (undef, $symbol, $module, $gpl, $namespace) = split('\t');
$SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
} }
close($module_symvers); close($module_symvers);
......
...@@ -195,13 +195,13 @@ static struct sym_entry *read_symbol(FILE *in) ...@@ -195,13 +195,13 @@ static struct sym_entry *read_symbol(FILE *in)
return NULL; return NULL;
} }
if (is_ignored_symbol(name, type))
return NULL;
/* Ignore most absolute/undefined (?) symbols. */
if (strcmp(name, "_text") == 0) if (strcmp(name, "_text") == 0)
_text = addr; _text = addr;
/* Ignore most absolute/undefined (?) symbols. */
if (is_ignored_symbol(name, type))
return NULL;
check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges)); check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges));
check_symbol_range(name, addr, &percpu_range, 1); check_symbol_range(name, addr, &percpu_range, 1);
......
...@@ -308,7 +308,8 @@ static const char *sec_name(struct elf_info *elf, int secindex) ...@@ -308,7 +308,8 @@ static const char *sec_name(struct elf_info *elf, int secindex)
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym) static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
{ {
Elf_Shdr *sechdr = &info->sechdrs[sym->st_shndx]; unsigned int secindex = get_secindex(info, sym);
Elf_Shdr *sechdr = &info->sechdrs[secindex];
unsigned long offset; unsigned long offset;
offset = sym->st_value; offset = sym->st_value;
...@@ -2427,7 +2428,7 @@ static void write_if_changed(struct buffer *b, const char *fname) ...@@ -2427,7 +2428,7 @@ static void write_if_changed(struct buffer *b, const char *fname)
} }
/* parse Module.symvers file. line format: /* parse Module.symvers file. line format:
* 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something] * 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace
**/ **/
static void read_dump(const char *fname, unsigned int kernel) static void read_dump(const char *fname, unsigned int kernel)
{ {
...@@ -2440,7 +2441,7 @@ static void read_dump(const char *fname, unsigned int kernel) ...@@ -2440,7 +2441,7 @@ static void read_dump(const char *fname, unsigned int kernel)
return; return;
while ((line = get_next_line(&pos, file, size))) { while ((line = get_next_line(&pos, file, size))) {
char *symname, *namespace, *modname, *d, *export, *end; char *symname, *namespace, *modname, *d, *export;
unsigned int crc; unsigned int crc;
struct module *mod; struct module *mod;
struct symbol *s; struct symbol *s;
...@@ -2448,16 +2449,16 @@ static void read_dump(const char *fname, unsigned int kernel) ...@@ -2448,16 +2449,16 @@ static void read_dump(const char *fname, unsigned int kernel)
if (!(symname = strchr(line, '\t'))) if (!(symname = strchr(line, '\t')))
goto fail; goto fail;
*symname++ = '\0'; *symname++ = '\0';
if (!(namespace = strchr(symname, '\t'))) if (!(modname = strchr(symname, '\t')))
goto fail;
*namespace++ = '\0';
if (!(modname = strchr(namespace, '\t')))
goto fail; goto fail;
*modname++ = '\0'; *modname++ = '\0';
if ((export = strchr(modname, '\t')) != NULL) if (!(export = strchr(modname, '\t')))
*export++ = '\0'; goto fail;
if (export && ((end = strchr(export, '\t')) != NULL)) *export++ = '\0';
*end = '\0'; if (!(namespace = strchr(export, '\t')))
goto fail;
*namespace++ = '\0';
crc = strtoul(line, &d, 16); crc = strtoul(line, &d, 16);
if (*symname == '\0' || *modname == '\0' || *d != '\0') if (*symname == '\0' || *modname == '\0' || *d != '\0')
goto fail; goto fail;
...@@ -2508,9 +2509,9 @@ static void write_dump(const char *fname) ...@@ -2508,9 +2509,9 @@ static void write_dump(const char *fname)
namespace = symbol->namespace; namespace = symbol->namespace;
buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n", buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n",
symbol->crc, symbol->name, symbol->crc, symbol->name,
namespace ? namespace : "",
symbol->module->name, symbol->module->name,
export_str(symbol->export)); export_str(symbol->export),
namespace ? namespace : "");
} }
symbol = symbol->next; symbol = symbol->next;
} }
......
...@@ -124,17 +124,6 @@ choice ...@@ -124,17 +124,6 @@ choice
If in doubt, select 'None' If in doubt, select 'None'
config INITRAMFS_COMPRESSION_NONE
bool "None"
help
Do not compress the built-in initramfs at all. This may sound wasteful
in space, but, you should be aware that the built-in initramfs will be
compressed at a later stage anyways along with the rest of the kernel,
on those architectures that support this. However, not compressing the
initramfs may lead to slightly higher memory consumption during a
short time at boot, while both the cpio image and the unpacked
filesystem image will be present in memory simultaneously
config INITRAMFS_COMPRESSION_GZIP config INITRAMFS_COMPRESSION_GZIP
bool "Gzip" bool "Gzip"
depends on RD_GZIP depends on RD_GZIP
...@@ -207,4 +196,15 @@ config INITRAMFS_COMPRESSION_LZ4 ...@@ -207,4 +196,15 @@ config INITRAMFS_COMPRESSION_LZ4
If you choose this, keep in mind that most distros don't provide lz4 If you choose this, keep in mind that most distros don't provide lz4
by default which could cause a build failure. by default which could cause a build failure.
config INITRAMFS_COMPRESSION_NONE
bool "None"
help
Do not compress the built-in initramfs at all. This may sound wasteful
in space, but, you should be aware that the built-in initramfs will be
compressed at a later stage anyways along with the rest of the kernel,
on those architectures that support this. However, not compressing the
initramfs may lead to slightly higher memory consumption during a
short time at boot, while both the cpio image and the unpacked
filesystem image will be present in memory simultaneously
endchoice endchoice
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment