From 055efab3120bae7ab1ed841317774f3c953f6e1b Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 23 Apr 2019 14:27:41 -0700 Subject: kbuild: drop support for cc-ldoption If you want to see if your linker supports a certain flag, then ask the linker directly with ld-option (not the compiler with cc-ldoption). Checking for linker flag support is an antipattern that complicates the usage of various linkers other than bfd via -fuse-ld={bfd|gold|lld}. Cc: clang-built-linux@googlegroups.com Suggested-by: Masahiro Yamada Signed-off-by: Nick Desaulniers Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 14 -------------- scripts/Kbuild.include | 5 ----- 2 files changed, 19 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 03c065855eaf..d65ad5746f94 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -437,20 +437,6 @@ more details, with real examples. The second argument is optional, and if supplied will be used if first argument is not supported. - cc-ldoption - cc-ldoption is used to check if $(CC) when used to link object files - supports the given option. An optional second option may be - specified if first option are not supported. - - Example: - #arch/x86/kernel/Makefile - vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) - - In the above example, vsyscall-flags will be assigned the option - -Wl$(comma)--hash-style=sysv if it is supported by $(CC). - The second argument is optional, and if supplied will be used - if first argument is not supported. - as-instr as-instr checks if the assembler reports a specific instruction and then outputs either option1 or option2 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index a675ce11a573..e2de6c4dce90 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -138,11 +138,6 @@ cc-disable-warning = $(call try-run,\ # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) -# cc-ldoption -# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) -cc-ldoption = $(call try-run,\ - $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) - # ld-option # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3)) -- cgit v1.2.3-59-g8ed1b From 4a33d4f17a19ece50ccf5ccbb8bc4ee539fb492e Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 20 May 2019 11:54:37 +0900 Subject: kbuild: do not check name uniqueness of builtin modules I just thought it was a good idea to scan builtin.modules in the name uniqueness checking, but a couple of false positives were found. Stephen reported a false positive for ppc64_defconfig: warning: same basename if the following are built as modules: arch/powerpc/platforms/powermac/nvram.ko drivers/char/nvram.ko The former is never built as a module as you see in arch/powerpc/platforms/powermac/Makefile: # CONFIG_NVRAM is an arch. independent tristate symbol, for pmac32 we really # need this to be a bool. Cheat here and pretend CONFIG_NVRAM=m is really # CONFIG_NVRAM=y obj-$(CONFIG_NVRAM:m=y) += nvram.o Another example of false positive is arm64 defconfig: warning: same basename if the following are built as modules: arch/arm64/lib/crc32.ko lib/crc32.ko It is true CONFIG_CRC32 is a tristate option but it is always 'y' since it is select'ed by ARM64. Hence, neither of them is built as a module for the arm64 build. From the above, modules.builtin essentially contains false positives. I do not think it is a big deal as far as kmod is concerned, but false positive warnings in the kernel build make people upset. It is better to not check it. Even without builtin.modules checked, we have enough (and more solid) test coverage with allmodconfig. While I touched this part, I replaced the sed code with neater one provided by Stephen. Link: https://lkml.org/lkml/2019/5/19/120 Link: https://lkml.org/lkml/2019/5/19/123 Fixes: 3a48a91901c5 ("kbuild: check uniqueness of module names") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Acked-by: Arnd Bergmann Reviewed-by: Greg Kroah-Hartman --- scripts/modules-check.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh index 2f659530e1ec..39e8cb36ba19 100755 --- a/scripts/modules-check.sh +++ b/scripts/modules-check.sh @@ -6,10 +6,10 @@ set -e # Check uniqueness of module names check_same_name_modules() { - for m in $(sed 's:.*/::' modules.order modules.builtin | sort | uniq -d) + for m in $(sed 's:.*/::' modules.order | sort | uniq -d) do - echo "warning: same basename if the following are built as modules:" >&2 - sed "/\/$m/!d;s:^kernel/: :" modules.order modules.builtin >&2 + echo "warning: same module names found:" >&2 + sed -n "/\/$m/s:^kernel/: :p" modules.order >&2 done } -- cgit v1.2.3-59-g8ed1b