]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Sep 2020 09:06:35 +0000 (11:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Sep 2020 09:06:35 +0000 (11:06 +0200)
added patches:
documentation-llvm-add-documentation-on-building-w-clang-llvm.patch
documentation-llvm-fix-the-name-of-llvm-size.patch
kbuild-add-objsize-variable-for-the-size-tool.patch
kbuild-remove-as-variable.patch
kbuild-replace-as-clang-with-llvm_ias-1.patch
kbuild-support-llvm-1-to-switch-the-default-tools-to-clang-llvm.patch
maintainers-add-clang-llvm-build-support-info.patch
net-wan-wanxl-use-allow-to-pass-cross_compile_m68k-for-rebuilding-firmware.patch
net-wan-wanxl-use-m68kcc-instead-of-m68kas-for-rebuilding-firmware.patch
x86-boot-kbuild-allow-readelf-executable-to-be-specified.patch

queue-4.19/documentation-llvm-add-documentation-on-building-w-clang-llvm.patch [new file with mode: 0644]
queue-4.19/documentation-llvm-fix-the-name-of-llvm-size.patch [new file with mode: 0644]
queue-4.19/kbuild-add-objsize-variable-for-the-size-tool.patch [new file with mode: 0644]
queue-4.19/kbuild-remove-as-variable.patch [new file with mode: 0644]
queue-4.19/kbuild-replace-as-clang-with-llvm_ias-1.patch [new file with mode: 0644]
queue-4.19/kbuild-support-llvm-1-to-switch-the-default-tools-to-clang-llvm.patch [new file with mode: 0644]
queue-4.19/maintainers-add-clang-llvm-build-support-info.patch [new file with mode: 0644]
queue-4.19/net-wan-wanxl-use-allow-to-pass-cross_compile_m68k-for-rebuilding-firmware.patch [new file with mode: 0644]
queue-4.19/net-wan-wanxl-use-m68kcc-instead-of-m68kas-for-rebuilding-firmware.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/x86-boot-kbuild-allow-readelf-executable-to-be-specified.patch [new file with mode: 0644]

diff --git a/queue-4.19/documentation-llvm-add-documentation-on-building-w-clang-llvm.patch b/queue-4.19/documentation-llvm-add-documentation-on-building-w-clang-llvm.patch
new file mode 100644 (file)
index 0000000..553a220
--- /dev/null
@@ -0,0 +1,120 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Nick Desaulniers <ndesaulniers@google.com>
+Date: Wed, 26 Feb 2020 15:23:36 -0800
+Subject: Documentation/llvm: add documentation on building w/ Clang/LLVM
+
+From: Nick Desaulniers <ndesaulniers@google.com>
+
+commit fcf1b6a35c16ac500fa908a4022238e5d666eabf upstream.
+
+added to kbuild documentation. Provides more official info on building
+kernels with Clang and LLVM than our wiki.
+
+Suggested-by: Kees Cook <keescook@chromium.org>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+[nd: hunk against Documentation/kbuild/index.rst dropped due to not backporting
+ commit cd238effefa2 ("docs: kbuild: convert docs to ReST and rename to *.rst")]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/kbuild/llvm.rst |   80 ++++++++++++++++++++++++++++++++++++++++++
+ MAINTAINERS                   |    1 
+ 2 files changed, 81 insertions(+)
+ create mode 100644 Documentation/kbuild/llvm.rst
+
+--- /dev/null
++++ b/Documentation/kbuild/llvm.rst
+@@ -0,0 +1,80 @@
++==============================
++Building Linux with Clang/LLVM
++==============================
++
++This document covers how to build the Linux kernel with Clang and LLVM
++utilities.
++
++About
++-----
++
++The Linux kernel has always traditionally been compiled with GNU toolchains
++such as GCC and binutils. Ongoing work has allowed for `Clang
++<https://clang.llvm.org/>`_ and `LLVM <https://llvm.org/>`_ utilities to be
++used as viable substitutes. Distributions such as `Android
++<https://www.android.com/>`_, `ChromeOS
++<https://www.chromium.org/chromium-os>`_, and `OpenMandriva
++<https://www.openmandriva.org/>`_ use Clang built kernels.  `LLVM is a
++collection of toolchain components implemented in terms of C++ objects
++<https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that
++supports C and the GNU C extensions required by the kernel, and is pronounced
++"klang," not "see-lang."
++
++Clang
++-----
++
++The compiler used can be swapped out via `CC=` command line argument to `make`.
++`CC=` should be set when selecting a config and during a build.
++
++      make CC=clang defconfig
++
++      make CC=clang
++
++Cross Compiling
++---------------
++
++A single Clang compiler binary will typically contain all supported backends,
++which can help simplify cross compiling.
++
++      ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
++
++`CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead
++`CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For
++example:
++
++      clang --target aarch64-linux-gnu foo.c
++
++LLVM Utilities
++--------------
++
++LLVM has substitutes for GNU binutils utilities. These can be invoked as
++additional parameters to `make`.
++
++      make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
++        OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
++        READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
++        HOSTLD=ld.lld
++
++Getting Help
++------------
++
++- `Website <https://clangbuiltlinux.github.io/>`_
++- `Mailing List <https://groups.google.com/forum/#!forum/clang-built-linux>`_: <clang-built-linux@googlegroups.com>
++- `Issue Tracker <https://github.com/ClangBuiltLinux/linux/issues>`_
++- IRC: #clangbuiltlinux on chat.freenode.net
++- `Telegram <https://t.me/ClangBuiltLinux>`_: @ClangBuiltLinux
++- `Wiki <https://github.com/ClangBuiltLinux/linux/wiki>`_
++- `Beginner Bugs <https://github.com/ClangBuiltLinux/linux/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_
++
++Getting LLVM
++-------------
++
++- http://releases.llvm.org/download.html
++- https://github.com/llvm/llvm-project
++- https://llvm.org/docs/GettingStarted.html
++- https://llvm.org/docs/CMake.html
++- https://apt.llvm.org/
++- https://www.archlinux.org/packages/extra/x86_64/llvm/
++- https://github.com/ClangBuiltLinux/tc-build
++- https://github.com/ClangBuiltLinux/linux/wiki/Building-Clang-from-source
++- https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -3620,6 +3620,7 @@ B:       https://github.com/ClangBuiltLinux/li
+ C:    irc://chat.freenode.net/clangbuiltlinux
+ S:    Supported
+ K:    \b(?i:clang|llvm)\b
++F:    Documentation/kbuild/llvm.rst
+ CLEANCACHE API
+ M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff --git a/queue-4.19/documentation-llvm-fix-the-name-of-llvm-size.patch b/queue-4.19/documentation-llvm-fix-the-name-of-llvm-size.patch
new file mode 100644 (file)
index 0000000..6aef0c6
--- /dev/null
@@ -0,0 +1,33 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Fangrui Song <maskray@google.com>
+Date: Thu, 2 Apr 2020 10:38:42 -0700
+Subject: Documentation/llvm: fix the name of llvm-size
+
+From: Fangrui Song <maskray@google.com>
+
+commit 0f44fbc162b737ff6251ae248184390ae2279fee upstream.
+
+The tool is called llvm-size, not llvm-objsize.
+
+Fixes: fcf1b6a35c16 ("Documentation/llvm: add documentation on building w/ Clang/LLVM")
+Signed-off-by: Fangrui Song <maskray@google.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/kbuild/llvm.rst |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/kbuild/llvm.rst
++++ b/Documentation/kbuild/llvm.rst
+@@ -51,7 +51,7 @@ LLVM has substitutes for GNU binutils ut
+ additional parameters to `make`.
+       make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+-        OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
++        OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
+         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+         HOSTLD=ld.lld
diff --git a/queue-4.19/kbuild-add-objsize-variable-for-the-size-tool.patch b/queue-4.19/kbuild-add-objsize-variable-for-the-size-tool.patch
new file mode 100644 (file)
index 0000000..6c418bd
--- /dev/null
@@ -0,0 +1,45 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Vasily Gorbik <gor@linux.ibm.com>
+Date: Mon, 21 Jan 2019 13:54:39 +0100
+Subject: kbuild: add OBJSIZE variable for the size tool
+
+From: Vasily Gorbik <gor@linux.ibm.com>
+
+commit 7bac98707f65b93bf994ef4e99b1eb9e7dbb9c32 upstream.
+
+Define and export OBJSIZE variable for "size" tool from binutils to be
+used in architecture specific Makefiles (naming the variable just "SIZE"
+would be too risky). In particular this tool is useful to perform checks
+that early boot code is not using bss section (which might have not been
+zeroed yet or intersects with initrd or other files boot loader might
+have put right after the linux kernel).
+
+Link: http://lkml.kernel.org/r/patch-1.thread-2257a1.git-188f5a3d81d5.your-ad-here.call-01565088755-ext-5120@work.hours
+Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+[nd: conflict in exported vars list from not backporting commit
+ e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -377,6 +377,7 @@ NM         = $(CROSS_COMPILE)nm
+ STRIP         = $(CROSS_COMPILE)strip
+ OBJCOPY               = $(CROSS_COMPILE)objcopy
+ OBJDUMP               = $(CROSS_COMPILE)objdump
++OBJSIZE               = $(CROSS_COMPILE)size
+ LEX           = flex
+ YACC          = bison
+ AWK           = awk
+@@ -433,7 +434,7 @@ GCC_PLUGINS_CFLAGS :=
+ CLANG_FLAGS :=
+ export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
+-export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
++export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
+ export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
+ export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
diff --git a/queue-4.19/kbuild-remove-as-variable.patch b/queue-4.19/kbuild-remove-as-variable.patch
new file mode 100644 (file)
index 0000000..65d9f97
--- /dev/null
@@ -0,0 +1,49 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Thu, 26 Mar 2020 14:57:18 +0900
+Subject: kbuild: remove AS variable
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit aa824e0c962b532d5073cbb41b2efcd6f5e72bae upstream.
+
+As commit 5ef872636ca7 ("kbuild: get rid of misleading $(AS) from
+documents") noted, we rarely use $(AS) directly in the kernel build.
+
+Now that the only/last user of $(AS) in drivers/net/wan/Makefile was
+converted to $(CC), $(AS) is no longer used in the build process.
+
+You can still pass in AS=clang, which is just a switch to turn on
+the LLVM integrated assembler.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Tested-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+[nd: conflict in exported vars list from not backporting commit
+ e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -368,7 +368,6 @@ KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAG
+ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
+ # Make variables (CC, etc...)
+-AS            = $(CROSS_COMPILE)as
+ LD            = $(CROSS_COMPILE)ld
+ CC            = $(CROSS_COMPILE)gcc
+ CPP           = $(CC) -E
+@@ -434,7 +433,7 @@ KBUILD_LDFLAGS :=
+ GCC_PLUGINS_CFLAGS :=
+ CLANG_FLAGS :=
+-export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
++export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
+ export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
+ export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
+ export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
diff --git a/queue-4.19/kbuild-replace-as-clang-with-llvm_ias-1.patch b/queue-4.19/kbuild-replace-as-clang-with-llvm_ias-1.patch
new file mode 100644 (file)
index 0000000..e61afcb
--- /dev/null
@@ -0,0 +1,57 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Wed, 8 Apr 2020 10:36:22 +0900
+Subject: kbuild: replace AS=clang with LLVM_IAS=1
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 7e20e47c70f810d678d02941fa3c671209c4ca97 upstream.
+
+The 'AS' variable is unused for building the kernel. Only the remaining
+usage is to turn on the integrated assembler. A boolean flag is a better
+fit for this purpose.
+
+AS=clang was added for experts. So, I replaced it with LLVM_IAS=1,
+breaking the backward compatibility.
+
+Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/kbuild/llvm.rst |    5 ++++-
+ Makefile                      |    2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/Documentation/kbuild/llvm.rst
++++ b/Documentation/kbuild/llvm.rst
+@@ -50,11 +50,14 @@ LLVM Utilities
+ LLVM has substitutes for GNU binutils utilities. These can be invoked as
+ additional parameters to `make`.
+-      make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
++      make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
+         READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
+         HOSTLD=ld.lld
++Currently, the integrated assembler is disabled by default. You can pass
++`LLVM_IAS=1` to enable it.
++
+ Getting Help
+ ------------
+--- a/Makefile
++++ b/Makefile
+@@ -492,7 +492,9 @@ endif
+ ifneq ($(GCC_TOOLCHAIN),)
+ CLANG_FLAGS   += --gcc-toolchain=$(GCC_TOOLCHAIN)
+ endif
++ifneq ($(LLVM_IAS),1)
+ CLANG_FLAGS   += -no-integrated-as
++endif
+ CLANG_FLAGS   += -Werror=unknown-warning-option
+ KBUILD_CFLAGS += $(CLANG_FLAGS)
+ KBUILD_AFLAGS += $(CLANG_FLAGS)
diff --git a/queue-4.19/kbuild-support-llvm-1-to-switch-the-default-tools-to-clang-llvm.patch b/queue-4.19/kbuild-support-llvm-1-to-switch-the-default-tools-to-clang-llvm.patch
new file mode 100644 (file)
index 0000000..b7caaf9
--- /dev/null
@@ -0,0 +1,156 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Wed, 8 Apr 2020 10:36:23 +0900
+Subject: kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit a0d1c951ef08ed24f35129267e3595d86f57f5d3 upstream.
+
+As Documentation/kbuild/llvm.rst implies, building the kernel with a
+full set of LLVM tools gets very verbose and unwieldy.
+
+Provide a single switch LLVM=1 to use Clang and LLVM tools instead
+of GCC and Binutils. You can pass it from the command line or as an
+environment variable.
+
+Please note LLVM=1 does not turn on the integrated assembler. You need
+to pass LLVM_IAS=1 to use it. When the upstream kernel is ready for the
+integrated assembler, I think we can make it default.
+
+We discussed what we need, and we agreed to go with a simple boolean
+flag that switches both target and host tools:
+
+  https://lkml.org/lkml/2020/3/28/494
+  https://lkml.org/lkml/2020/4/3/43
+
+Some items discussed, but not adopted:
+
+- LLVM_DIR
+
+  When multiple versions of LLVM are installed, I just thought supporting
+  LLVM_DIR=/path/to/my/llvm/bin/ might be useful.
+
+  CC      = $(LLVM_DIR)clang
+  LD      = $(LLVM_DIR)ld.lld
+    ...
+
+  However, we can handle this by modifying PATH. So, we decided to not do
+  this.
+
+- LLVM_SUFFIX
+
+  Some distributions (e.g. Debian) package specific versions of LLVM with
+  naming conventions that use the version as a suffix.
+
+  CC      = clang$(LLVM_SUFFIX)
+  LD      = ld.lld(LLVM_SUFFIX)
+    ...
+
+  will allow a user to pass LLVM_SUFFIX=-11 to use clang-11 etc.,
+  but the suffixed versions in /usr/bin/ are symlinks to binaries in
+  /usr/lib/llvm-#/bin/, so this can also be handled by PATH.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build
+Tested-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+[nd: conflict in exported vars list from not backporting commit
+ e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")]
+[nd: hunk against Documentation/kbuild/kbuild.rst dropped due to not backporting
+ commit cd238effefa2 ("docs: kbuild: convert docs to ReST and rename to *.rst")]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/kbuild/llvm.rst |    8 ++++++--
+ Makefile                      |   29 +++++++++++++++++++++++------
+ tools/objtool/Makefile        |    6 ++++++
+ 3 files changed, 35 insertions(+), 8 deletions(-)
+
+--- a/Documentation/kbuild/llvm.rst
++++ b/Documentation/kbuild/llvm.rst
+@@ -47,8 +47,12 @@ example:
+ LLVM Utilities
+ --------------
+-LLVM has substitutes for GNU binutils utilities. These can be invoked as
+-additional parameters to `make`.
++LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
++to enable them.
++
++      make LLVM=1
++
++They can be enabled individually. The full list of the parameters:
+       make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
+         OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
+--- a/Makefile
++++ b/Makefile
+@@ -358,8 +358,13 @@ HOST_LFS_CFLAGS := $(shell getconf LFS_C
+ HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
+ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
+-HOSTCC       = gcc
+-HOSTCXX      = g++
++ifneq ($(LLVM),)
++HOSTCC        = clang
++HOSTCXX       = clang++
++else
++HOSTCC        = gcc
++HOSTCXX       = g++
++endif
+ KBUILD_HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
+               -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
+               $(HOSTCFLAGS)
+@@ -368,16 +373,28 @@ KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAG
+ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
+ # Make variables (CC, etc...)
+-LD            = $(CROSS_COMPILE)ld
+-CC            = $(CROSS_COMPILE)gcc
+ CPP           = $(CC) -E
++ifneq ($(LLVM),)
++CC            = clang
++LD            = ld.lld
++AR            = llvm-ar
++NM            = llvm-nm
++OBJCOPY               = llvm-objcopy
++OBJDUMP               = llvm-objdump
++READELF               = llvm-readelf
++OBJSIZE               = llvm-size
++STRIP         = llvm-strip
++else
++CC            = $(CROSS_COMPILE)gcc
++LD            = $(CROSS_COMPILE)ld
+ AR            = $(CROSS_COMPILE)ar
+ NM            = $(CROSS_COMPILE)nm
+-STRIP         = $(CROSS_COMPILE)strip
+ OBJCOPY               = $(CROSS_COMPILE)objcopy
+ OBJDUMP               = $(CROSS_COMPILE)objdump
+-OBJSIZE               = $(CROSS_COMPILE)size
+ READELF               = $(CROSS_COMPILE)readelf
++OBJSIZE               = $(CROSS_COMPILE)size
++STRIP         = $(CROSS_COMPILE)strip
++endif
+ LEX           = flex
+ YACC          = bison
+ AWK           = awk
+--- a/tools/objtool/Makefile
++++ b/tools/objtool/Makefile
+@@ -7,9 +7,15 @@ ARCH := x86
+ endif
+ # always use the host compiler
++ifneq ($(LLVM),)
++HOSTAR        ?= llvm-ar
++HOSTCC        ?= clang
++HOSTLD        ?= ld.lld
++else
+ HOSTAR        ?= ar
+ HOSTCC        ?= gcc
+ HOSTLD        ?= ld
++endif
+ AR     = $(HOSTAR)
+ CC     = $(HOSTCC)
+ LD     = $(HOSTLD)
diff --git a/queue-4.19/maintainers-add-clang-llvm-build-support-info.patch b/queue-4.19/maintainers-add-clang-llvm-build-support-info.patch
new file mode 100644 (file)
index 0000000..db72a5b
--- /dev/null
@@ -0,0 +1,42 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Nick Desaulniers <ndesaulniers@google.com>
+Date: Fri, 28 Jun 2019 12:07:12 -0700
+Subject: MAINTAINERS: add CLANG/LLVM BUILD SUPPORT info
+
+From: Nick Desaulniers <ndesaulniers@google.com>
+
+commit 8708e13c6a0600625eea3aebd027c0715a5d2bb2 upstream.
+
+Add keyword support so that our mailing list gets cc'ed for clang/llvm
+patches.  We're pretty active on our mailing list so far as code review.
+There are numerous Googlers like myself that are paid to support
+building the Linux kernel with Clang and LLVM.
+
+Link: http://lkml.kernel.org/r/20190620001907.255803-1-ndesaulniers@google.com
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Cc: Joe Perches <joe@perches.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ MAINTAINERS |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -3613,6 +3613,14 @@ M:      Miguel Ojeda <miguel.ojeda.sandonis@g
+ S:    Maintained
+ F:    .clang-format
++CLANG/LLVM BUILD SUPPORT
++L:    clang-built-linux@googlegroups.com
++W:    https://clangbuiltlinux.github.io/
++B:    https://github.com/ClangBuiltLinux/linux/issues
++C:    irc://chat.freenode.net/clangbuiltlinux
++S:    Supported
++K:    \b(?i:clang|llvm)\b
++
+ CLEANCACHE API
+ M:    Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+ L:    linux-kernel@vger.kernel.org
diff --git a/queue-4.19/net-wan-wanxl-use-allow-to-pass-cross_compile_m68k-for-rebuilding-firmware.patch b/queue-4.19/net-wan-wanxl-use-allow-to-pass-cross_compile_m68k-for-rebuilding-firmware.patch
new file mode 100644 (file)
index 0000000..b37a502
--- /dev/null
@@ -0,0 +1,72 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Thu, 26 Mar 2020 14:57:15 +0900
+Subject: net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 63b903dfebdea92aa92ad337d8451a6fbfeabf9d upstream.
+
+As far as I understood from the Kconfig help text, this build rule is
+used to rebuild the driver firmware, which runs on an old m68k-based
+chip. So, you need m68k tools for the firmware rebuild.
+
+wanxl.c is a PCI driver, but CONFIG_M68K does not select CONFIG_HAVE_PCI.
+So, you cannot enable CONFIG_WANXL_BUILD_FIRMWARE for ARCH=m68k. In other
+words, ifeq ($(ARCH),m68k) is false here.
+
+I am keeping the dead code for now, but rebuilding the firmware requires
+'as68k' and 'ld68k', which I do not have in hand.
+
+Instead, the kernel.org m68k GCC [1] successfully built it.
+
+Allowing a user to pass in CROSS_COMPILE_M68K= is handier.
+
+[1] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/9.2.0/x86_64-gcc-9.2.0-nolibc-m68k-linux.tar.xz
+
+Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wan/Kconfig  |    2 +-
+ drivers/net/wan/Makefile |   12 ++++++------
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/wan/Kconfig
++++ b/drivers/net/wan/Kconfig
+@@ -199,7 +199,7 @@ config WANXL_BUILD_FIRMWARE
+       depends on WANXL && !PREVENT_FIRMWARE_BUILD
+       help
+         Allows you to rebuild firmware run by the QUICC processor.
+-        It requires as68k, ld68k and hexdump programs.
++        It requires m68k toolchains and hexdump programs.
+         You should never need this option, say N.
+--- a/drivers/net/wan/Makefile
++++ b/drivers/net/wan/Makefile
+@@ -41,17 +41,17 @@ $(obj)/wanxl.o:    $(obj)/wanxlfw.inc
+ ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
+ ifeq ($(ARCH),m68k)
+-  AS68K = $(AS)
+-  LD68K = $(LD)
++  M68KAS = $(AS)
++  M68KLD = $(LD)
+ else
+-  AS68K = as68k
+-  LD68K = ld68k
++  M68KAS = $(CROSS_COMPILE_M68K)as
++  M68KLD = $(CROSS_COMPILE_M68K)ld
+ endif
+ quiet_cmd_build_wanxlfw = BLD FW  $@
+       cmd_build_wanxlfw = \
+-      $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
+-      $(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
++      $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(M68KAS) -m68360 -o $(obj)/wanxlfw.o; \
++      $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
+       hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
+       rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
diff --git a/queue-4.19/net-wan-wanxl-use-m68kcc-instead-of-m68kas-for-rebuilding-firmware.patch b/queue-4.19/net-wan-wanxl-use-m68kcc-instead-of-m68kas-for-rebuilding-firmware.patch
new file mode 100644 (file)
index 0000000..b5034a4
--- /dev/null
@@ -0,0 +1,46 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Thu, 26 Mar 2020 14:57:16 +0900
+Subject: net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 734f3719d3438f9cc181d674c33ca9762e9148a1 upstream.
+
+The firmware source, wanxlfw.S, is currently compiled by the combo of
+$(CPP) and $(M68KAS). This is not what we usually do for compiling *.S
+files. In fact, this Makefile is the only user of $(AS) in the kernel
+build.
+
+Instead of combining $(CPP) and (AS) from different tool sets, using
+$(M68KCC) as an assembler driver is simpler, and saner.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wan/Makefile |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wan/Makefile
++++ b/drivers/net/wan/Makefile
+@@ -41,16 +41,16 @@ $(obj)/wanxl.o:    $(obj)/wanxlfw.inc
+ ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
+ ifeq ($(ARCH),m68k)
+-  M68KAS = $(AS)
++  M68KCC = $(CC)
+   M68KLD = $(LD)
+ else
+-  M68KAS = $(CROSS_COMPILE_M68K)as
++  M68KCC = $(CROSS_COMPILE_M68K)gcc
+   M68KLD = $(CROSS_COMPILE_M68K)ld
+ endif
+ quiet_cmd_build_wanxlfw = BLD FW  $@
+       cmd_build_wanxlfw = \
+-      $(CPP) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi $< | $(M68KAS) -m68360 -o $(obj)/wanxlfw.o; \
++      $(M68KCC) -D__ASSEMBLY__ -Wp,-MD,$(depfile) -I$(srctree)/include/uapi -c -o $(obj)/wanxlfw.o $<; \
+       $(M68KLD) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
+       hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static const u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
+       rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
index 45533b5315a20d61944c4d73e5aa30062bd39f62..86580339943cf7dbcdaa8f2a7bcf073bc6157750 100644 (file)
@@ -21,3 +21,13 @@ net-phy-avoid-npd-upon-phy_detach-when-driver-is-unbound.patch
 net-qrtr-check-skb_put_padto-return-value.patch
 net-add-__must_check-to-skb_put_padto.patch
 ipv4-update-exception-handling-for-multipath-routes-via-same-device.patch
+maintainers-add-clang-llvm-build-support-info.patch
+kbuild-add-objsize-variable-for-the-size-tool.patch
+documentation-llvm-add-documentation-on-building-w-clang-llvm.patch
+documentation-llvm-fix-the-name-of-llvm-size.patch
+net-wan-wanxl-use-allow-to-pass-cross_compile_m68k-for-rebuilding-firmware.patch
+net-wan-wanxl-use-m68kcc-instead-of-m68kas-for-rebuilding-firmware.patch
+x86-boot-kbuild-allow-readelf-executable-to-be-specified.patch
+kbuild-remove-as-variable.patch
+kbuild-replace-as-clang-with-llvm_ias-1.patch
+kbuild-support-llvm-1-to-switch-the-default-tools-to-clang-llvm.patch
diff --git a/queue-4.19/x86-boot-kbuild-allow-readelf-executable-to-be-specified.patch b/queue-4.19/x86-boot-kbuild-allow-readelf-executable-to-be-specified.patch
new file mode 100644 (file)
index 0000000..e06073d
--- /dev/null
@@ -0,0 +1,62 @@
+From foo@baz Fri Sep 25 10:52:54 AM CEST 2020
+From: Dmitry Golovin <dima@golovin.in>
+Date: Thu, 5 Dec 2019 00:54:41 +0200
+Subject: x86/boot: kbuild: allow readelf executable to be specified
+
+From: Dmitry Golovin <dima@golovin.in>
+
+commit eefb8c124fd969e9a174ff2bedff86aa305a7438 upstream.
+
+Introduce a new READELF variable to top-level Makefile, so the name of
+readelf binary can be specified.
+
+Before this change the name of the binary was hardcoded to
+"$(CROSS_COMPILE)readelf" which might not be present for every
+toolchain.
+
+This allows to build with LLVM Object Reader by using make parameter
+READELF=llvm-readelf.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/771
+Signed-off-by: Dmitry Golovin <dima@golovin.in>
+Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
+[nd: conflict in exported vars list from not backporting commit
+ e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux")]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile                          |    3 ++-
+ arch/x86/boot/compressed/Makefile |    2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -378,6 +378,7 @@ STRIP              = $(CROSS_COMPILE)strip
+ OBJCOPY               = $(CROSS_COMPILE)objcopy
+ OBJDUMP               = $(CROSS_COMPILE)objdump
+ OBJSIZE               = $(CROSS_COMPILE)size
++READELF               = $(CROSS_COMPILE)readelf
+ LEX           = flex
+ YACC          = bison
+ AWK           = awk
+@@ -434,7 +435,7 @@ GCC_PLUGINS_CFLAGS :=
+ CLANG_FLAGS :=
+ export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
+-export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
++export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
+ export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
+ export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+--- a/arch/x86/boot/compressed/Makefile
++++ b/arch/x86/boot/compressed/Makefile
+@@ -102,7 +102,7 @@ vmlinux-objs-$(CONFIG_EFI_MIXED) += $(ob
+ quiet_cmd_check_data_rel = DATAREL $@
+ define cmd_check_data_rel
+       for obj in $(filter %.o,$^); do \
+-              ${CROSS_COMPILE}readelf -S $$obj | grep -qF .rel.local && { \
++              $(READELF) -S $$obj | grep -qF .rel.local && { \
+                       echo "error: $$obj has data relocations!" >&2; \
+                       exit 1; \
+               } || true; \