1. 24 Feb, 2021 7 commits
  2. 21 Feb, 2021 6 commits
    • Masahiro Yamada's avatar
      kbuild: check the minimum linker version in Kconfig · 02aff859
      Masahiro Yamada authored
      Unify the two scripts/ld-version.sh and scripts/lld-version.sh, and
      check the minimum linker version like scripts/cc-version.sh did.
      
      I tested this script for some corner cases reported in the past:
      
       - GNU ld version 2.25-15.fc23
         as reported by commit 8083013f ("ld-version: Fix it on Fedora")
      
       - GNU ld (GNU Binutils) 2.20.1.20100303
         as reported by commit 0d61ed17 ("ld-version: Drop the 4th and
         5th version components")
      
      This script show an error message if the linker is too old:
      
        $ make LD=ld.lld-9
          SYNC    include/config/auto.conf
        ***
        *** Linker is too old.
        ***   Your LLD version:    9.0.1
        ***   Minimum LLD version: 10.0.1
        ***
        scripts/Kconfig.include:50: Sorry, this linker is not supported.
        make[2]: *** [scripts/kconfig/Makefile:71: syncconfig] Error 1
        make[1]: *** [Makefile:600: syncconfig] Error 2
        make: *** [Makefile:708: include/config/auto.conf] Error 2
      
      I also moved the check for gold to this script, so gold is still rejected:
      
        $ make LD=gold
          SYNC    include/config/auto.conf
        gold linker is not supported as it is not capable of linking the kernel proper.
        scripts/Kconfig.include:50: Sorry, this linker is not supported.
        make[2]: *** [scripts/kconfig/Makefile:71: syncconfig] Error 1
        make[1]: *** [Makefile:600: syncconfig] Error 2
        make: *** [Makefile:708: include/config/auto.conf] Error 2
      
      Thanks to David Laight for suggesting shell script improvements.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
      02aff859
    • Masahiro Yamada's avatar
      kbuild: remove ld-version macro · 05f6bbf2
      Masahiro Yamada authored
      There is no direct user of ld-version; you can use CONFIG_LD_VERSION
      if needed.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      05f6bbf2
    • Masahiro Yamada's avatar
      scripts: add generic syscallhdr.sh · b9da928a
      Masahiro Yamada authored
      Most of architectures generate syscall headers at the compile time
      in a similar way.
      
      As of v5.11-rc1, 12 architectures duplicate similar shell scripts:
      
        $ find arch -name syscallhdr.sh | sort
        arch/alpha/kernel/syscalls/syscallhdr.sh
        arch/arm/tools/syscallhdr.sh
        arch/ia64/kernel/syscalls/syscallhdr.sh
        arch/m68k/kernel/syscalls/syscallhdr.sh
        arch/microblaze/kernel/syscalls/syscallhdr.sh
        arch/mips/kernel/syscalls/syscallhdr.sh
        arch/parisc/kernel/syscalls/syscallhdr.sh
        arch/powerpc/kernel/syscalls/syscallhdr.sh
        arch/sh/kernel/syscalls/syscallhdr.sh
        arch/sparc/kernel/syscalls/syscallhdr.sh
        arch/x86/entry/syscalls/syscallhdr.sh
        arch/xtensa/kernel/syscalls/syscallhdr.sh
      
      My goal is to unify them into scripts/syscallhdr.sh.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b9da928a
    • Masahiro Yamada's avatar
      scripts: add generic syscalltbl.sh · 9df526b0
      Masahiro Yamada authored
      Most of architectures generate syscall headers at the compile time
      in a similar way.
      
      The syscall table has the same format for all architectures. Each line
      has up to 5 fields; syscall number, ABI, syscall name, native entry
      point, and compat entry point. The syscall table is processed by
      syscalltbl.sh script into header files.
      
      Despite the same pattern, scripts are maintained per architecture,
      which results in code duplication and bad maintainability.
      
      As of v5.11-rc1, 12 architectures duplicate similar shell scripts:
      
        $ find arch -name syscalltbl.sh | sort
        arch/alpha/kernel/syscalls/syscalltbl.sh
        arch/arm/tools/syscalltbl.sh
        arch/ia64/kernel/syscalls/syscalltbl.sh
        arch/m68k/kernel/syscalls/syscalltbl.sh
        arch/microblaze/kernel/syscalls/syscalltbl.sh
        arch/mips/kernel/syscalls/syscalltbl.sh
        arch/parisc/kernel/syscalls/syscalltbl.sh
        arch/powerpc/kernel/syscalls/syscalltbl.sh
        arch/sh/kernel/syscalls/syscalltbl.sh
        arch/sparc/kernel/syscalls/syscalltbl.sh
        arch/x86/entry/syscalls/syscalltbl.sh
        arch/xtensa/kernel/syscalls/syscalltbl.sh
      
      My goal is to unify them into scripts/syscalltbl.sh.
      
      __SYSCALL_WITH_COMPAT should be defined as follows:
      
      32-bit kernel:
        #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)
      
      64-bit kernel:
      
        #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      9df526b0
    • Masahiro Yamada's avatar
      arch: syscalls: remove $(srctree)/ prefix from syscall tables · 29c5c3ac
      Masahiro Yamada authored
      The 'syscall' variables are not directly used in the commands.
      Remove the $(srctree)/ prefix because we can rely on VPATH.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      29c5c3ac
    • Masahiro Yamada's avatar
      arch: syscalls: add missing FORCE and fix 'targets' to make if_changed work · 865fa29f
      Masahiro Yamada authored
      The rules in these Makefiles cannot detect the command line change
      because the prerequisite 'FORCE' is missing.
      
      Adding 'FORCE' will result in the headers being rebuilt every time
      because the 'targets' additions are also wrong; the file paths in
      'targets' must be relative to the current Makefile.
      
      Fix all of them so the if_changed rules work correctly.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      865fa29f
  3. 16 Feb, 2021 14 commits
  4. 11 Feb, 2021 6 commits
    • Masahiro Yamada's avatar
      kbuild: LD_VERSION redenomination · 052c805a
      Masahiro Yamada authored
      Commit ccbef167 ("Kbuild, lto: add ld-version and ld-ifversion
      macros") introduced scripts/ld-version.sh for GCC LTO.
      
      At that time, this script handled 5 version fields because GCC LTO
      needed the downstream binutils. (https://lkml.org/lkml/2014/4/8/272)
      
      The code snippet from the submitted patch was as follows:
      
          # We need HJ Lu's Linux binutils because mainline binutils does not
          # support mixing assembler and LTO code in the same ld -r object.
          # XXX check if the gcc plugin ld is the expected one too
          # XXX some Fedora binutils should also support it. How to check for that?
          ifeq ($(call ld-ifversion,-ge,22710001,y),y)
              ...
      
      However, GCC LTO was not merged into the mainline after all.
      (https://lkml.org/lkml/2014/4/8/272)
      
      So, the 4th and 5th fields were never used, and finally removed by
      commit 0d61ed17 ("ld-version: Drop the 4th and 5th version
      components").
      
      Since then, the last 4-digits returned by this script is always zeros.
      
      Remove the meaningless last 4-digits. This makes the version format
      consistent with GCC_VERSION, CLANG_VERSION, LLD_VERSION.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Acked-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      052c805a
    • Masahiro Yamada's avatar
      kbuild: Remove $(cc-option,-gdwarf-4) dependency from DEBUG_INFO_DWARF4 · 83272e6d
      Masahiro Yamada authored
      The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
      
      You can see it at https://godbolt.org/z/6ed1oW
      
        For gcc 4.5.3 pane,    line 37:    .value 0x4
        For clang 10.0.1 pane, line 117:   .short 4
      
      Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
      version, this cc-option is unneeded.
      
      Note
      ----
      
      CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
      
      As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
      
        ifdef CONFIG_DEBUG_INFO_DWARF4
        DEBUG_CFLAGS    += -gdwarf-4
        endif
      
      This flag is used when compiling *.c files.
      
      On the other hand, the assembler is always given -gdwarf-2.
      
        KBUILD_AFLAGS   += -Wa,-gdwarf-2
      
      Hence, the debug info that comes from *.S files is always DWARF v2.
      This is simply because GAS supported only -gdwarf-2 for a long time.
      
      Recently, GAS gained the support for --gdwarf-[345] options. [1]
      And, also we have Clang integrated assembler. So, the debug info
      for *.S files might be improved in the future.
      
      In my understanding, the current code is intentional, not a bug.
      
      [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67dSigned-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      83272e6d
    • Tor Vic's avatar
      Makefile: use smaller dictionary size for xz module compression · db4632c6
      Tor Vic authored
      By default, xz without parameters uses a dictionary size of 8 MB.
      However, most modules are much smaller than that.
      The xz manpage states that 'increasing dictionary size usually improves
      compression ratio, but a dictionary bigger than the uncompressed file
      is waste of memory'.
      Use a dictionary size of 2 MB for module compression, resulting in
      slightly higher compression speed while still maintaining a good
      compression ratio.
      Signed-off-by: default avatarTor Vic <torvic9@mailbox.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      db4632c6
    • Masahiro Yamada's avatar
      ia64: remove generated/nr-irqs.h generation to fix build warning · fa1e160b
      Masahiro Yamada authored
      Randy reports the following warning when building ARCH=ia64 with
      CONFIG_IA64_PALINFO=m:
      
      ../scripts/Makefile.build:68: 'arch/ia64/kernel/palinfo.ko' will not be built even though obj-m is specified.
      ../scripts/Makefile.build:69: You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.
      
      This message is actually false-positive, and you can get palinfo.ko
      correctly built. It is emitted in the archprepare stage, where Kbuild
      descends into arch/ia64/kernel to generate include/generated/nr-irqs.h
      instead of any kind of kernel objects.
      
      arch/ia64/kernel/nr-irqs.c was introduced by commit 213060a4
      ("[IA64] pvops: paravirtualize NR_IRQS") to pre-calculate:
      
         NR_IRQS = max(IA64_NATIVE_NR_IRQS, XEN_NR_IRQS, FOO_NR_IRQS...)
      
      Since commit d52eefb4 ("ia64/xen: Remove Xen support for ia64"), this
      union contains just one field, making NR_IRQS and IA64_NATIVE_NR_IRQS
      always match.
      
      So, the following hard-coding now works:
      
        #define NR_IRQS                IA64_NATIVE_NR_IRQS
      
      If you need to re-introduce NR_IRQS = max(...) gimmick in the future,
      please try to implement it in asm-offsets.c instead of a separate file.
      It will be possible because the header inclusion has been consolidated
      to make asm-offsets.c independent of <asm/irqs.h>.
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      fa1e160b
    • Masahiro Yamada's avatar
      ia64: remove unneeded header includes from <asm/mca.h> · a5b7c61e
      Masahiro Yamada authored
      <asm/mca.h> includes too many unneeded headers.
      
      This commit cuts off a lot of header includes.
      
      What we need to include are:
      
       - <linux/percpu.h> for DECLARE_PER_CPU(u64, ia64_mca_pal_base)
       - <linux/threads.h> for NR_CPUS
       - <linux/types.h> for u8, u64, size_t, etc.
       - <asm/ptrace.h> for KERNEL_STACK_SIZE
      
      The other header includes are actually unneeded.
      
      <asm/mca.h> previously included 436 headers, and now it includes
      only 138. I confirmed <asm/mca.h> is still self-contained.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      a5b7c61e
    • Masahiro Yamada's avatar
      ia64: do not typedef struct pal_min_state_area_s · 2770ef7c
      Masahiro Yamada authored
      Documentation/process/coding-style.rst says:
      
        Please don't use things like ``vps_t``.
        It's a **mistake** to use typedef for structures and pointers.
      
      This commit converts as follows:
      
        struct pal_min_state_area_s  ->  struct pal_min_state_area
               pal_min_state_area_t  ->  struct pal_min_state_area
      
      My main motivation for this is to slim down the include directives
      of <asm/mca.h> in the next commit.
      
      Currently, <asm/mca.h> is required to include <asm/pal.h> directly
      or indirectly due to (pal_min_state_area_t *). Otherwise, it would
      have no idea what pal_min_state_area_t is.
      
      Replacing it with (struct pal_min_state_area *) will relax the header
      dependency since it is enough to tell it is a pointer to a structure,
      and to resolve the size of struct pal_min_state_area. It will make
      <asm/mca.h> independent of <asm/pal.h>.
      
      <asm/pal.h> typedef's a lot of structures, but it is trivial to
      convert the others in the same way.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      2770ef7c
  5. 07 Feb, 2021 7 commits