Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull Kbuild fixes from Masahiro Yamada:

- Move -Wcast-align to W=3, which tends to be false-positive and there
is no tree-wide solution.

- Pass -fmacro-prefix-map to KBUILD_CPPFLAGS because it is a
preprocessor option and makes sense for .S files as well.

- Disable -gdwarf-2 for Clang's integrated assembler to avoid warnings.

- Disable --orphan-handling=warn for LLD 10.0.1 to avoid warnings.

- Fix undesirable line breaks in *.mod files.

* tag 'kbuild-fixes-v5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kbuild: avoid split lines in .mod files
kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1
kbuild: Hoist '--orphan-handling' into Kconfig
Kbuild: do not emit debug info for assembly with LLVM_IAS=1
kbuild: use -fmacro-prefix-map for .S sources
Makefile.extrawarn: move -Wcast-align to W=3

+64 -24
+1
MAINTAINERS
··· 4287 4287 C: irc://chat.freenode.net/clangbuiltlinux 4288 4288 F: Documentation/kbuild/llvm.rst 4289 4289 F: scripts/clang-tools/ 4290 + F: scripts/lld-version.sh 4290 4291 K: \b(?i:clang|llvm)\b 4291 4292 4292 4293 CLEANCACHE API
+9 -1
Makefile
··· 826 826 DEBUG_CFLAGS += -g 827 827 endif 828 828 829 + ifneq ($(LLVM_IAS),1) 829 830 KBUILD_AFLAGS += -Wa,-gdwarf-2 831 + endif 830 832 831 833 ifdef CONFIG_DEBUG_INFO_DWARF4 832 834 DEBUG_CFLAGS += -gdwarf-4 ··· 946 944 KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) 947 945 948 946 # change __FILE__ to the relative path from the srctree 949 - KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) 947 + KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) 950 948 951 949 # ensure -fcf-protection is disabled when using retpoline as it is 952 950 # incompatible with -mindirect-branch=thunk-extern ··· 982 980 983 981 ifeq ($(CONFIG_RELR),y) 984 982 LDFLAGS_vmlinux += --pack-dyn-relocs=relr 983 + endif 984 + 985 + # We never want expected sections to be placed heuristically by the 986 + # linker. All sections should be explicitly named in the linker script. 987 + ifdef CONFIG_LD_ORPHAN_WARN 988 + LDFLAGS_vmlinux += --orphan-handling=warn 985 989 endif 986 990 987 991 # Align the bit size of userspace programs with the kernel
+9
arch/Kconfig
··· 1028 1028 bool 1029 1029 depends on HAVE_STATIC_CALL 1030 1030 1031 + config ARCH_WANT_LD_ORPHAN_WARN 1032 + bool 1033 + help 1034 + An arch should select this symbol once all linker sections are explicitly 1035 + included, size-asserted, or discarded in the linker scripts. This is 1036 + important because we never want expected sections to be placed heuristically 1037 + by the linker, since the locations of such sections can change between linker 1038 + versions. 1039 + 1031 1040 source "kernel/gcov/Kconfig" 1032 1041 1033 1042 source "scripts/gcc-plugins/Kconfig"
+1
arch/arm/Kconfig
··· 35 35 select ARCH_USE_CMPXCHG_LOCKREF 36 36 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 37 37 select ARCH_WANT_IPC_PARSE_VERSION 38 + select ARCH_WANT_LD_ORPHAN_WARN 38 39 select BINFMT_FLAT_ARGVP_ENVP_ON_STACK 39 40 select BUILDTIME_TABLE_SORT if MMU 40 41 select CLONE_BACKWARDS
-4
arch/arm/Makefile
··· 16 16 KBUILD_LDFLAGS_MODULE += --be8 17 17 endif 18 18 19 - # We never want expected sections to be placed heuristically by the 20 - # linker. All sections should be explicitly named in the linker script. 21 - LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn) 22 - 23 19 GZFLAGS :=-9 24 20 #KBUILD_CFLAGS +=-pipe 25 21
+3 -1
arch/arm/boot/compressed/Makefile
··· 129 129 # Delete all temporary local symbols 130 130 LDFLAGS_vmlinux += -X 131 131 # Report orphan sections 132 - LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn) 132 + ifdef CONFIG_LD_ORPHAN_WARN 133 + LDFLAGS_vmlinux += --orphan-handling=warn 134 + endif 133 135 # Next argument is a linker script 134 136 LDFLAGS_vmlinux += -T 135 137
+1
arch/arm64/Kconfig
··· 81 81 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT 82 82 select ARCH_WANT_FRAME_POINTERS 83 83 select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36) 84 + select ARCH_WANT_LD_ORPHAN_WARN 84 85 select ARCH_HAS_UBSAN_SANITIZE_ALL 85 86 select ARM_AMBA 86 87 select ARM_ARCH_TIMER
-4
arch/arm64/Makefile
··· 28 28 endif 29 29 endif 30 30 31 - # We never want expected sections to be placed heuristically by the 32 - # linker. All sections should be explicitly named in the linker script. 33 - LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn) 34 - 35 31 ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y) 36 32 ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y) 37 33 $(warning LSE atomics not supported by binutils)
+1
arch/powerpc/Kconfig
··· 152 152 select ARCH_USE_QUEUED_SPINLOCKS if PPC_QUEUED_SPINLOCKS 153 153 select ARCH_WANT_IPC_PARSE_VERSION 154 154 select ARCH_WANT_IRQS_OFF_ACTIVATE_MM 155 + select ARCH_WANT_LD_ORPHAN_WARN 155 156 select ARCH_WEAK_RELEASE_ACQUIRE 156 157 select BINFMT_ELF 157 158 select BUILDTIME_TABLE_SORT
-1
arch/powerpc/Makefile
··· 123 123 LDFLAGS_vmlinux-y := -Bstatic 124 124 LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie 125 125 LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) 126 - LDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn) 127 126 128 127 ifdef CONFIG_PPC64 129 128 ifeq ($(call cc-option-yn,-mcmodel=medium),y)
+1
arch/x86/Kconfig
··· 100 100 select ARCH_WANT_DEFAULT_BPF_JIT if X86_64 101 101 select ARCH_WANTS_DYNAMIC_TASK_STRUCT 102 102 select ARCH_WANT_HUGE_PMD_SHARE 103 + select ARCH_WANT_LD_ORPHAN_WARN 103 104 select ARCH_WANTS_THP_SWAP if X86_64 104 105 select BUILDTIME_TABLE_SORT 105 106 select CLKEVT_I8253
-3
arch/x86/Makefile
··· 209 209 LDFLAGS_vmlinux += -z max-page-size=0x200000 210 210 endif 211 211 212 - # We never want expected sections to be placed heuristically by the 213 - # linker. All sections should be explicitly named in the linker script. 214 - LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn) 215 212 216 213 archscripts: scripts_basic 217 214 $(Q)$(MAKE) $(build)=arch/x86/tools relocs
+3 -1
arch/x86/boot/compressed/Makefile
··· 61 61 # Compressed kernel should be built as PIE since it may be loaded at any 62 62 # address by the bootloader. 63 63 LDFLAGS_vmlinux := -pie $(call ld-option, --no-dynamic-linker) 64 - LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn) 64 + ifdef CONFIG_LD_ORPHAN_WARN 65 + LDFLAGS_vmlinux += --orphan-handling=warn 66 + endif 65 67 LDFLAGS_vmlinux += -T 66 68 67 69 hostprogs := mkpiggy
+10
init/Kconfig
··· 47 47 int 48 48 default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) 49 49 50 + config LLD_VERSION 51 + int 52 + default $(shell,$(srctree)/scripts/lld-version.sh $(LD)) 53 + 50 54 config CC_CAN_LINK 51 55 bool 52 56 default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(m64-flag)) if 64BIT ··· 1351 1347 silently broken kernel if the required annotations are not 1352 1348 present. This option is not well tested yet, so use at your 1353 1349 own risk. 1350 + 1351 + config LD_ORPHAN_WARN 1352 + def_bool y 1353 + depends on ARCH_WANT_LD_ORPHAN_WARN 1354 + depends on !LD_IS_LLD || LLD_VERSION >= 110000 1355 + depends on $(ld-option,--orphan-handling=warn) 1354 1356 1355 1357 config SYSCTL 1356 1358 bool
+4 -8
scripts/Makefile.build
··· 252 252 ifdef CONFIG_TRIM_UNUSED_KSYMS 253 253 cmd_gen_ksymdeps = \ 254 254 $(CONFIG_SHELL) $(srctree)/scripts/gen_ksymdeps.sh $@ >> $(dot-target).cmd 255 + 256 + # List module undefined symbols 257 + undefined_syms = $(NM) $< | $(AWK) '$$1 == "U" { printf("%s%s", x++ ? " " : "", $$2) }'; 255 258 endif 256 259 257 260 define rule_cc_o_c ··· 274 271 $(call cmd,modversions_S) 275 272 endef 276 273 277 - # List module undefined symbols (or empty line if not enabled) 278 - ifdef CONFIG_TRIM_UNUSED_KSYMS 279 - cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo 280 - else 281 - cmd_undef_syms = echo 282 - endif 283 - 284 274 # Built-in and composite module parts 285 275 $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE 286 276 $(call if_changed_rule,cc_o_c) ··· 281 285 282 286 cmd_mod = { \ 283 287 echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ 284 - $(cmd_undef_syms); \ 288 + $(undefined_syms) echo; \ 285 289 } > $@ 286 290 287 291 $(obj)/%.mod: $(obj)/%.o FORCE
+1 -1
scripts/Makefile.extrawarn
··· 60 60 # 61 61 ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) 62 62 63 - KBUILD_CFLAGS += -Wcast-align 64 63 KBUILD_CFLAGS += -Wdisabled-optimization 65 64 KBUILD_CFLAGS += -Wnested-externs 66 65 KBUILD_CFLAGS += -Wshadow ··· 79 80 ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) 80 81 81 82 KBUILD_CFLAGS += -Wbad-function-cast 83 + KBUILD_CFLAGS += -Wcast-align 82 84 KBUILD_CFLAGS += -Wcast-qual 83 85 KBUILD_CFLAGS += -Wconversion 84 86 KBUILD_CFLAGS += -Wpacked
+20
scripts/lld-version.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Usage: $ ./scripts/lld-version.sh ld.lld 5 + # 6 + # Print the linker version of `ld.lld' in a 5 or 6-digit form 7 + # such as `100001' for ld.lld 10.0.1 etc. 8 + 9 + linker_string="$($* --version)" 10 + 11 + if ! ( echo $linker_string | grep -q LLD ); then 12 + echo 0 13 + exit 1 14 + fi 15 + 16 + VERSION=$(echo $linker_string | cut -d ' ' -f 2) 17 + MAJOR=$(echo $VERSION | cut -d . -f 1) 18 + MINOR=$(echo $VERSION | cut -d . -f 2) 19 + PATCHLEVEL=$(echo $VERSION | cut -d . -f 3) 20 + printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL