Skip to content

Commit b753101

Browse files
committed
Merge tag 'kbuild-v5.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull more Kbuild updates from Masahiro Yamada: - raise minimum supported binutils version to 2.23 - remove old CONFIG_AS_* macros that we know binutils >= 2.23 supports - move remaining CONFIG_AS_* tests to Kconfig from Makefile - enable -Wtautological-compare warnings to catch more issues - do not support GCC plugins for GCC <= 4.7 - fix various breakages of 'make xconfig' - include the linker version used for linking the kernel into LINUX_COMPILER, which is used for the banner, and also exposed to /proc/version - link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y, which allows us to remove the lib-ksyms.o workaround, and to solve the last known issue of the LLVM linker - add dummy tools in scripts/dummy-tools/ to enable all compiler tests in Kconfig, which will be useful for distro maintainers - support the single switch, LLVM=1 to use Clang and all LLVM utilities instead of GCC and Binutils. - support LLVM_IAS=1 to enable the integrated assembler, which is still experimental * tag 'kbuild-v5.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (36 commits) kbuild: fix comment about missing include guard detection kbuild: support LLVM=1 to switch the default tools to Clang/LLVM kbuild: replace AS=clang with LLVM_IAS=1 kbuild: add dummy toolchains to enable all cc-option etc. in Kconfig kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y MIPS: fw: arc: add __weak to prom_meminit and prom_free_prom_memory kbuild: remove -I$(srctree)/tools/include from scripts/Makefile kbuild: do not pass $(KBUILD_CFLAGS) to scripts/mkcompile_h Documentation/llvm: fix the name of llvm-size kbuild: mkcompile_h: Include $LD version in /proc/version kconfig: qconf: Fix a few alignment issues kconfig: qconf: remove some old bogus TODOs kconfig: qconf: fix support for the split view mode kconfig: qconf: fix the content of the main widget kconfig: qconf: Change title for the item window kconfig: qconf: clean deprecated warnings gcc-plugins: drop support for GCC <= 4.7 kbuild: Enable -Wtautological-compare x86: update AS_* macros to binutils >=2.23, supporting ADX and AVX2 crypto: x86 - clean up poly1305-x86_64-cryptogams.S by 'make clean' ...
2 parents c7850ae + 00d76a0 commit b753101

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+384
-519
lines changed

Documentation/kbuild/kbuild.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,8 @@ KBUILD_BUILD_USER, KBUILD_BUILD_HOST
262262
These two variables allow to override the user@host string displayed during
263263
boot and in /proc/version. The default value is the output of the commands
264264
whoami and host, respectively.
265+
266+
LLVM
267+
----
268+
If this variable is set to 1, Kbuild will use Clang and LLVM utilities instead
269+
of GCC and GNU binutils to build the kernel.

Documentation/kbuild/llvm.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,21 @@ example:
4747
LLVM Utilities
4848
--------------
4949

50-
LLVM has substitutes for GNU binutils utilities. These can be invoked as
51-
additional parameters to `make`.
50+
LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1`
51+
to enable them.
5252

53-
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
54-
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-objsize \\
53+
make LLVM=1
54+
55+
They can be enabled individually. The full list of the parameters:
56+
57+
make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\
58+
OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\
5559
READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\
5660
HOSTLD=ld.lld
5761

62+
Currently, the integrated assembler is disabled by default. You can pass
63+
`LLVM_IAS=1` to enable it.
64+
5865
Getting Help
5966
------------
6067

Documentation/process/changes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
3131
====================== =============== ========================================
3232
GNU C 4.6 gcc --version
3333
GNU make 3.81 make --version
34-
binutils 2.21 ld -v
34+
binutils 2.23 ld -v
3535
flex 2.5.35 flex --version
3636
bison 2.0 bison --version
3737
util-linux 2.10o fdformat --version
@@ -76,7 +76,7 @@ You will need GNU make 3.81 or later to build the kernel.
7676
Binutils
7777
--------
7878

79-
Binutils 2.21 or newer is needed to build the kernel.
79+
Binutils 2.23 or newer is needed to build the kernel.
8080

8181
pkg-config
8282
----------

Makefile

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,13 @@ HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null)
399399
HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
400400
HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
401401

402-
HOSTCC = gcc
403-
HOSTCXX = g++
402+
ifneq ($(LLVM),)
403+
HOSTCC = clang
404+
HOSTCXX = clang++
405+
else
406+
HOSTCC = gcc
407+
HOSTCXX = g++
408+
endif
404409
KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
405410
-fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
406411
$(HOSTCFLAGS)
@@ -409,16 +414,28 @@ KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
409414
KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
410415

411416
# Make variables (CC, etc...)
412-
LD = $(CROSS_COMPILE)ld
413-
CC = $(CROSS_COMPILE)gcc
414417
CPP = $(CC) -E
418+
ifneq ($(LLVM),)
419+
CC = clang
420+
LD = ld.lld
421+
AR = llvm-ar
422+
NM = llvm-nm
423+
OBJCOPY = llvm-objcopy
424+
OBJDUMP = llvm-objdump
425+
READELF = llvm-readelf
426+
OBJSIZE = llvm-size
427+
STRIP = llvm-strip
428+
else
429+
CC = $(CROSS_COMPILE)gcc
430+
LD = $(CROSS_COMPILE)ld
415431
AR = $(CROSS_COMPILE)ar
416432
NM = $(CROSS_COMPILE)nm
417-
STRIP = $(CROSS_COMPILE)strip
418433
OBJCOPY = $(CROSS_COMPILE)objcopy
419434
OBJDUMP = $(CROSS_COMPILE)objdump
420-
OBJSIZE = $(CROSS_COMPILE)size
421435
READELF = $(CROSS_COMPILE)readelf
436+
OBJSIZE = $(CROSS_COMPILE)size
437+
STRIP = $(CROSS_COMPILE)strip
438+
endif
422439
PAHOLE = pahole
423440
LEX = flex
424441
YACC = bison
@@ -538,7 +555,7 @@ endif
538555
ifneq ($(GCC_TOOLCHAIN),)
539556
CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
540557
endif
541-
ifeq ($(if $(AS),$(shell $(AS) --version 2>&1 | head -n 1 | grep clang)),)
558+
ifneq ($(LLVM_IAS),1)
542559
CLANG_FLAGS += -no-integrated-as
543560
endif
544561
CLANG_FLAGS += -Werror=unknown-warning-option
@@ -747,8 +764,6 @@ ifdef CONFIG_CC_IS_CLANG
747764
KBUILD_CPPFLAGS += -Qunused-arguments
748765
KBUILD_CFLAGS += -Wno-format-invalid-specifier
749766
KBUILD_CFLAGS += -Wno-gnu
750-
# Quiet clang warning: comparison of unsigned expression < 0 is always false
751-
KBUILD_CFLAGS += -Wno-tautological-compare
752767
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
753768
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
754769
# See modpost pattern 2
@@ -1036,8 +1051,13 @@ init-y := $(patsubst %/, %/built-in.a, $(init-y))
10361051
core-y := $(patsubst %/, %/built-in.a, $(core-y))
10371052
drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y))
10381053
net-y := $(patsubst %/, %/built-in.a, $(net-y))
1054+
libs-y2 := $(patsubst %/, %/built-in.a, $(filter %/, $(libs-y)))
1055+
ifdef CONFIG_MODULES
1056+
libs-y1 := $(filter-out %/, $(libs-y))
1057+
libs-y2 += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
1058+
else
10391059
libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
1040-
libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
1060+
endif
10411061
virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
10421062

10431063
# Externally visible symbols (used by link-vmlinux.sh)

arch/h8300/include/uapi/asm/bitsperlong.h

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2+
#ifndef _UAPI_ASM_POSIX_TYPES_H
3+
#define _UAPI_ASM_POSIX_TYPES_H
4+
5+
/* h8300-unknown-linux required long */
6+
#define __kernel_size_t __kernel_size_t
7+
typedef unsigned long __kernel_size_t;
8+
typedef long __kernel_ssize_t;
9+
typedef long __kernel_ptrdiff_t;
10+
11+
#include <asm-generic/posix_types.h>
12+
13+
#endif /* _UAPI_ASM_POSIX_TYPES_H */

arch/mips/fw/arc/memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int __init prom_memtype_classify(union linux_memtypes type)
117117
return memtype_classify_arc(type);
118118
}
119119

120-
void __init prom_meminit(void)
120+
void __weak __init prom_meminit(void)
121121
{
122122
struct linux_mdesc *p;
123123

@@ -162,7 +162,7 @@ void __weak __init prom_cleanup(void)
162162
{
163163
}
164164

165-
void __init prom_free_prom_memory(void)
165+
void __weak __init prom_free_prom_memory(void)
166166
{
167167
int i;
168168

arch/sh/include/asm/bitops-op32.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
#define BYTE_OFFSET(nr) ((nr) % BITS_PER_BYTE)
1717
#endif
1818

19-
#define IS_IMMEDIATE(nr) (__builtin_constant_p(nr))
20-
2119
static inline void __set_bit(int nr, volatile unsigned long *addr)
2220
{
23-
if (IS_IMMEDIATE(nr)) {
21+
if (__builtin_constant_p(nr)) {
2422
__asm__ __volatile__ (
2523
"bset.b %1, @(%O2,%0) ! __set_bit\n\t"
2624
: "+r" (addr)
@@ -37,7 +35,7 @@ static inline void __set_bit(int nr, volatile unsigned long *addr)
3735

3836
static inline void __clear_bit(int nr, volatile unsigned long *addr)
3937
{
40-
if (IS_IMMEDIATE(nr)) {
38+
if (__builtin_constant_p(nr)) {
4139
__asm__ __volatile__ (
4240
"bclr.b %1, @(%O2,%0) ! __clear_bit\n\t"
4341
: "+r" (addr)
@@ -64,7 +62,7 @@ static inline void __clear_bit(int nr, volatile unsigned long *addr)
6462
*/
6563
static inline void __change_bit(int nr, volatile unsigned long *addr)
6664
{
67-
if (IS_IMMEDIATE(nr)) {
65+
if (__builtin_constant_p(nr)) {
6866
__asm__ __volatile__ (
6967
"bxor.b %1, @(%O2,%0) ! __change_bit\n\t"
7068
: "+r" (addr)

arch/sh/include/uapi/asm/setup.h

Lines changed: 0 additions & 2 deletions
This file was deleted.

arch/sh/include/uapi/asm/types.h

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)