From 5a144a1acd0b4b4afd1b2695f7231b58e8848ce6 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 9 May 2018 16:23:48 +0900 Subject: depmod.sh: remove symbol prefix support CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX was selected by BLACKFIN, METAG. They were removed by commit 4ba66a976072 ("arch: remove blackfin port"), commit bb6fb6dfcc17 ("metag: Remove arch/metag/"), respectively. No more architecture enables CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX, hence the last argument of scripts/depmod.sh can be removed. Signed-off-by: Masahiro Yamada Reviewed-by: Sam Ravnborg --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d0d2652db174..a1ea84dfdde6 100644 --- a/Makefile +++ b/Makefile @@ -1760,7 +1760,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) # Run depmod only if we have System.map and depmod is executable quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ - $(KERNELRELEASE) "$(patsubst y,_,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))" + $(KERNELRELEASE) # Create temporary dir for module support files # clean it up only when building all modules -- cgit v1.2.3 From 6ca8d9433d7712d4c3c6102816b685470504dc3d Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Wed, 9 May 2018 22:59:59 +1000 Subject: kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-sections for module build Modules do not tend to cope with -ffunction-sections, even though they do not link with -gc-sections. It may be possible for unused symbols to be trimmed from modules, but in general that would take much more work in architecture module linker scripts. For now, enable these only for kernel build. Signed-off-by: Nicholas Piggin Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a1ea84dfdde6..52ea534f5173 100644 --- a/Makefile +++ b/Makefile @@ -799,8 +799,8 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) -KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) +KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) +KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) endif # arch Makefile may override CC so keep this after arch Makefile is included -- cgit v1.2.3 From 59f7b5847b0c279d416977d07b7d23aaa7fdc1be Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 28 May 2018 15:47:22 +0200 Subject: kbuild: $(CHECK) doesnt need NOSTDINC_FLAGS twice Currently, $(CHECK) receives NOSTDINC_FLAGS twice: * first directly in the main Makefile via CHECKFLAGS, * then indirectly in scripts/Makefile.build via c_flags. Since once is enough, leave the occurence via c_flags and remove the one via CHECKFLAGS. Signed-off-by: Luc Van Oostenryck Signed-off-by: Masahiro Yamada --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 52ea534f5173..1617ab517819 100644 --- a/Makefile +++ b/Makefile @@ -805,7 +805,6 @@ endif # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(call shell-cached,$(CC) -print-file-name=include) -CHECKFLAGS += $(NOSTDINC_FLAGS) # warn about C99 declaration after statement KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) -- cgit v1.2.3 From 145167650b96967d6b726efef978c74831e6b2bd Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 28 May 2018 20:27:35 +0200 Subject: kbuild: add endianness flag to CHEKCFLAGS The kernel depends on macros like __BYTE_ORDER__, __BIG_ENDIAN__ or __LITTLE_ENDIAN__. OTOH, sparse doesn't know about the endianness of the kernel and by default uses the same as the machine on which sparse was built. Ensure that sparse can predefine the macros corresponding to how the kernel was configured by adding -m{big,little}-endian to CHECKFLAGS in the main Makefile (and so for all archs). Also, remove the equivalent done in arch specific Makefiles. Signed-off-by: Luc Van Oostenryck Signed-off-by: Masahiro Yamada --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1617ab517819..68982ba7bc2f 100644 --- a/Makefile +++ b/Makefile @@ -874,6 +874,9 @@ ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) endif +# insure the checker run with the right endianness +CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) + # Default kernel image to build when no specific target is given. # KBUILD_IMAGE may be overruled on the command line or # set in the environment -- cgit v1.2.3 From 1f2f01b122d7c78a9e842a126ef168afb279552b Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Wed, 30 May 2018 22:48:38 +0200 Subject: kbuild: add machine size to CHECKFLAGS By default, sparse assumes a 64bit machine when compiled on x86-64 and 32bit when compiled on anything else. This can of course create all sort of problems for the other archs, like issuing false warnings ('shift too big (32) for type unsigned long'), or worse, failing to emit legitimate warnings. Fix this by adding the -m32/-m64 flag, depending on CONFIG_64BIT, to CHECKFLAGS in the main Makefile (and so for all archs). Also, remove the now unneeded -m32/-m64 in arch specific Makefiles. Signed-off-by: Luc Van Oostenryck Signed-off-by: Masahiro Yamada --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 68982ba7bc2f..2626de329e5f 100644 --- a/Makefile +++ b/Makefile @@ -877,6 +877,9 @@ endif # insure the checker run with the right endianness CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) +# the checker needs the correct machine size +CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) + # Default kernel image to build when no specific target is given. # KBUILD_IMAGE may be overruled on the command line or # set in the environment -- cgit v1.2.3