From b56e5355091d799d58ce8b40fdf62dc9c2159981 Mon Sep 17 00:00:00 2001 From: Elena Reshetova Date: Fri, 1 Sep 2017 12:40:20 +0300 Subject: Coccinelle: add atomic_as_refcounter script atomic_as_refcounter.cocci script allows detecting cases when refcount_t type and API should be used instead of atomic_t. Signed-off-by: Elena Reshetova Acked-by: Julia Lawall Reviewed-by: Kees Cook Signed-off-by: Masahiro Yamada --- scripts/coccinelle/api/atomic_as_refcounter.cocci | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 scripts/coccinelle/api/atomic_as_refcounter.cocci diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci new file mode 100644 index 000000000000..988120e0fd67 --- /dev/null +++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci @@ -0,0 +1,129 @@ +// Check if refcount_t type and API should be used +// instead of atomic_t type when dealing with refcounters +// +// Copyright (c) 2016-2017, Elena Reshetova, Intel Corporation +// +// Confidence: Moderate +// URL: http://coccinelle.lip6.fr/ +// Options: --include-headers --very-quiet + +virtual report + +@r1 exists@ +identifier a, x; +position p1, p2; +identifier fname =~ ".*free.*"; +identifier fname2 =~ ".*destroy.*"; +identifier fname3 =~ ".*del.*"; +identifier fname4 =~ ".*queue_work.*"; +identifier fname5 =~ ".*schedule_work.*"; +identifier fname6 =~ ".*call_rcu.*"; + +@@ + +( + atomic_dec_and_test@p1(&(a)->x) +| + atomic_dec_and_lock@p1(&(a)->x, ...) +| + atomic_long_dec_and_lock@p1(&(a)->x, ...) +| + atomic_long_dec_and_test@p1(&(a)->x) +| + atomic64_dec_and_test@p1(&(a)->x) +| + local_dec_and_test@p1(&(a)->x) +) +... +( + fname@p2(a, ...); +| + fname2@p2(...); +| + fname3@p2(...); +| + fname4@p2(...); +| + fname5@p2(...); +| + fname6@p2(...); +) + + +@script:python depends on report@ +p1 << r1.p1; +p2 << r1.p2; +@@ +msg = "atomic_dec_and_test variation before object free at line %s." +coccilib.report.print_report(p1[0], msg % (p2[0].line)) + +@r4 exists@ +identifier a, x, y; +position p1, p2; +identifier fname =~ ".*free.*"; + +@@ + +( + atomic_dec_and_test@p1(&(a)->x) +| + atomic_dec_and_lock@p1(&(a)->x, ...) +| + atomic_long_dec_and_lock@p1(&(a)->x, ...) +| + atomic_long_dec_and_test@p1(&(a)->x) +| + atomic64_dec_and_test@p1(&(a)->x) +| + local_dec_and_test@p1(&(a)->x) +) +... +y=a +... +fname@p2(y, ...); + + +@script:python depends on report@ +p1 << r4.p1; +p2 << r4.p2; +@@ +msg = "atomic_dec_and_test variation before object free at line %s." +coccilib.report.print_report(p1[0], msg % (p2[0].line)) + +@r2 exists@ +identifier a, x; +position p1; +@@ + +( +atomic_add_unless(&(a)->x,-1,1)@p1 +| +atomic_long_add_unless(&(a)->x,-1,1)@p1 +| +atomic64_add_unless(&(a)->x,-1,1)@p1 +) + +@script:python depends on report@ +p1 << r2.p1; +@@ +msg = "atomic_add_unless" +coccilib.report.print_report(p1[0], msg) + +@r3 exists@ +identifier x; +position p1; +@@ + +( +x = atomic_add_return@p1(-1, ...); +| +x = atomic_long_add_return@p1(-1, ...); +| +x = atomic64_add_return@p1(-1, ...); +) + +@script:python depends on report@ +p1 << r3.p1; +@@ +msg = "x = atomic_add_return(-1, ...)" +coccilib.report.print_report(p1[0], msg) -- cgit v1.2.3-70-g09d2 From c417fbce98722ad7e384caa8ba6f2e7c5f8672d9 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 26 Jun 2018 01:40:23 +0900 Subject: kbuild: move bin2c back to scripts/ from scripts/basic/ Commit 8370edea81e3 ("bin2c: move bin2c in scripts/basic") moved bin2c to the scripts/basic/ directory, incorrectly stating "Kexec wants to use bin2c and it wants to use it really early in the build process. See arch/x86/purgatory/ code in later patches." Commit bdab125c9301 ("Revert "kexec/purgatory: Add clean-up for purgatory directory"") and commit d6605b6bbee8 ("x86/build: Remove unnecessary preparation for purgatory") removed the redundant purgatory build magic entirely. That means that the move of bin2c was unnecessary in the first place. fixdep is the only host program that deserves to sit in the scripts/basic/ directory. Signed-off-by: Masahiro Yamada --- arch/powerpc/purgatory/Makefile | 3 +-- arch/s390/purgatory/Makefile | 3 +-- arch/x86/purgatory/Makefile | 3 +-- kernel/Makefile | 2 +- scripts/.gitignore | 1 + scripts/Makefile | 1 + scripts/basic/.gitignore | 1 - scripts/basic/Makefile | 1 - scripts/basic/bin2c.c | 36 ------------------------------------ scripts/bin2c.c | 36 ++++++++++++++++++++++++++++++++++++ security/tomoyo/Makefile | 2 +- 11 files changed, 43 insertions(+), 46 deletions(-) delete mode 100644 scripts/basic/bin2c.c create mode 100644 scripts/bin2c.c diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile index 30e05decbb4c..4314ba5baf43 100644 --- a/arch/powerpc/purgatory/Makefile +++ b/arch/powerpc/purgatory/Makefile @@ -6,9 +6,8 @@ LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined $(obj)/purgatory.ro: $(obj)/trampoline.o FORCE $(call if_changed,ld) -CMD_BIN2C = $(objtree)/scripts/basic/bin2c quiet_cmd_bin2c = BIN2C $@ - cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ + cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE $(call if_changed,bin2c) diff --git a/arch/s390/purgatory/Makefile b/arch/s390/purgatory/Makefile index 1ace023cbdce..445c4603ce02 100644 --- a/arch/s390/purgatory/Makefile +++ b/arch/s390/purgatory/Makefile @@ -27,9 +27,8 @@ KBUILD_CFLAGS += $(call cc-option,-fno-PIE) $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld) -CMD_BIN2C = $(objtree)/scripts/basic/bin2c quiet_cmd_bin2c = BIN2C $@ - cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ + cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE $(call if_changed,bin2c) diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 81a8e33115ad..3cf302b26332 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -28,9 +28,8 @@ $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE targets += kexec-purgatory.c -CMD_BIN2C = $(objtree)/scripts/basic/bin2c quiet_cmd_bin2c = BIN2C $@ - cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ + cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE $(call if_changed,bin2c) diff --git a/kernel/Makefile b/kernel/Makefile index 04bc07c2b42a..7a63d567fdb5 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -123,7 +123,7 @@ targets += config_data.gz $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE $(call if_changed,gzip) - filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/basic/bin2c; echo "MAGIC_END;") + filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") targets += config_data.h $(obj)/config_data.h: $(obj)/config_data.gz FORCE $(call filechk,ikconfiggz) diff --git a/scripts/.gitignore b/scripts/.gitignore index 0442c06eefcb..12d302d70128 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,6 +1,7 @@ # # Generated files # +bin2c conmakehash kallsyms pnmtologo diff --git a/scripts/Makefile b/scripts/Makefile index 25ab143cbe14..59c21ec49b84 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -10,6 +10,7 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/include +hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c hostprogs-$(CONFIG_KALLSYMS) += kallsyms hostprogs-$(CONFIG_LOGO) += pnmtologo hostprogs-$(CONFIG_VT) += conmakehash diff --git a/scripts/basic/.gitignore b/scripts/basic/.gitignore index 9528ec9e5adc..a776371a3502 100644 --- a/scripts/basic/.gitignore +++ b/scripts/basic/.gitignore @@ -1,2 +1 @@ fixdep -bin2c diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index 0372b33febe5..af49b446f17d 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile @@ -9,7 +9,6 @@ # fixdep: Used to generate dependency information during build process hostprogs-y := fixdep -hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c always := $(hostprogs-y) # fixdep is needed to compile other host programs diff --git a/scripts/basic/bin2c.c b/scripts/basic/bin2c.c deleted file mode 100644 index c3d7eef3ad06..000000000000 --- a/scripts/basic/bin2c.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Unloved program to convert a binary on stdin to a C include on stdout - * - * Jan 1999 Matt Mackall - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - */ - -#include - -int main(int argc, char *argv[]) -{ - int ch, total = 0; - - if (argc > 1) - printf("const char %s[] %s=\n", - argv[1], argc > 2 ? argv[2] : ""); - - do { - printf("\t\""); - while ((ch = getchar()) != EOF) { - total++; - printf("\\x%02x", ch); - if (total % 16 == 0) - break; - } - printf("\"\n"); - } while (ch != EOF); - - if (argc > 1) - printf("\t;\n\n#include \n\nconst size_t %s_size = %d;\n", - argv[1], total); - - return 0; -} diff --git a/scripts/bin2c.c b/scripts/bin2c.c new file mode 100644 index 000000000000..c3d7eef3ad06 --- /dev/null +++ b/scripts/bin2c.c @@ -0,0 +1,36 @@ +/* + * Unloved program to convert a binary on stdin to a C include on stdout + * + * Jan 1999 Matt Mackall + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#include + +int main(int argc, char *argv[]) +{ + int ch, total = 0; + + if (argc > 1) + printf("const char %s[] %s=\n", + argv[1], argc > 2 ? argv[2] : ""); + + do { + printf("\t\""); + while ((ch = getchar()) != EOF) { + total++; + printf("\\x%02x", ch); + if (total % 16 == 0) + break; + } + printf("\"\n"); + } while (ch != EOF); + + if (argc > 1) + printf("\t;\n\n#include \n\nconst size_t %s_size = %d;\n", + argv[1], total); + + return 0; +} diff --git a/security/tomoyo/Makefile b/security/tomoyo/Makefile index b7c6a7ffc058..cca5a3012fee 100644 --- a/security/tomoyo/Makefile +++ b/security/tomoyo/Makefile @@ -4,7 +4,7 @@ obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load targets += builtin-policy.h define do_policy echo "static char tomoyo_builtin_$(1)[] __initdata ="; \ -$(objtree)/scripts/basic/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \ +$(objtree)/scripts/bin2c <$(firstword $(wildcard $(obj)/policy/$(1).conf $(srctree)/$(src)/policy/$(1).conf.default) /dev/null); \ echo ";" endef quiet_cmd_policy = POLICY $@ -- cgit v1.2.3-70-g09d2 From 934193a654c1f4d0643ddbf4b2529b508cae926e Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sun, 1 Jul 2018 19:46:06 -0700 Subject: kbuild: verify that $DEPMOD is installed Verify that 'depmod' ($DEPMOD) is installed. This is a partial revert of commit 620c231c7a7f ("kbuild: do not check for ancient modutils tools"). Also update Documentation/process/changes.rst to refer to kmod instead of module-init-tools. Fixes kernel bugzilla #198965: https://bugzilla.kernel.org/show_bug.cgi?id=198965 Signed-off-by: Randy Dunlap Cc: Lucas De Marchi Cc: Lucas De Marchi Cc: Michal Marek Cc: Jessica Yu Cc: Chih-Wei Huang Cc: stable@vger.kernel.org # any kernel since 2012 Signed-off-by: Masahiro Yamada --- Documentation/process/changes.rst | 19 +++++++------------ scripts/depmod.sh | 8 +++++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst index ddc029734b25..005d8842a503 100644 --- a/Documentation/process/changes.rst +++ b/Documentation/process/changes.rst @@ -35,7 +35,7 @@ binutils 2.20 ld -v flex 2.5.35 flex --version bison 2.0 bison --version util-linux 2.10o fdformat --version -module-init-tools 0.9.10 depmod -V +kmod 13 depmod -V e2fsprogs 1.41.4 e2fsck -V jfsutils 1.1.3 fsck.jfs -V reiserfsprogs 3.6.3 reiserfsck -V @@ -156,12 +156,6 @@ is not build with ``CONFIG_KALLSYMS`` and you have no way to rebuild and reproduce the Oops with that option, then you can still decode that Oops with ksymoops. -Module-Init-Tools ------------------ - -A new module loader is now in the kernel that requires ``module-init-tools`` -to use. It is backward compatible with the 2.4.x series kernels. - Mkinitrd -------- @@ -371,16 +365,17 @@ Util-linux - +Kmod +---- + +- +- + Ksymoops -------- - -Module-Init-Tools ------------------ - -- - Mkinitrd -------- diff --git a/scripts/depmod.sh b/scripts/depmod.sh index 1a6f85e0e6e1..999d585eaa73 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh @@ -10,10 +10,16 @@ fi DEPMOD=$1 KERNELRELEASE=$2 -if ! test -r System.map -a -x "$DEPMOD"; then +if ! test -r System.map ; then exit 0 fi +if [ -z $(command -v $DEPMOD) ]; then + echo "'make modules_install' requires $DEPMOD. Please install it." >&2 + echo "This is probably in the kmod package." >&2 + exit 1 +fi + # older versions of depmod require the version string to start with three # numbers, so we cheat with a symlink here depmod_hack_needed=true -- cgit v1.2.3-70-g09d2 From 9afb719e7046c4f2462278862ab3db2961cc141c Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 5 Jul 2018 17:49:37 -0700 Subject: kbuild: Add build salt to the kernel and modules In Fedora, the debug information is packaged separately (foo-debuginfo) and can be installed separately. There's been a long standing issue where only one version of a debuginfo info package can be installed at a time. There's been an effort for Fedora for parallel debuginfo to rectify this problem. Part of the requirement to allow parallel debuginfo to work is that build ids are unique between builds. The existing upstream rpm implementation ensures this by re-calculating the build-id using the version and release as a seed. This doesn't work 100% for the kernel because of the vDSO which is its own binary and doesn't get updated when embedded. Fix this by adding some data in an ELF note for both the kernel and modules. The data is controlled via a Kconfig option so distributions can set it to an appropriate value to ensure uniqueness between builds. Suggested-by: Masahiro Yamada Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- include/linux/build-salt.h | 20 ++++++++++++++++++++ init/Kconfig | 9 +++++++++ init/version.c | 3 +++ scripts/mod/modpost.c | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 include/linux/build-salt.h diff --git a/include/linux/build-salt.h b/include/linux/build-salt.h new file mode 100644 index 000000000000..bb007bd05e7a --- /dev/null +++ b/include/linux/build-salt.h @@ -0,0 +1,20 @@ +#ifndef __BUILD_SALT_H +#define __BUILD_SALT_H + +#include + +#define LINUX_ELFNOTE_BUILD_SALT 0x100 + +#ifdef __ASSEMBLER__ + +#define BUILD_SALT \ + ELFNOTE(Linux, LINUX_ELFNOTE_BUILD_SALT, .asciz CONFIG_BUILD_SALT) + +#else + +#define BUILD_SALT \ + ELFNOTE32("Linux", LINUX_ELFNOTE_BUILD_SALT, CONFIG_BUILD_SALT) + +#endif + +#endif /* __BUILD_SALT_H */ diff --git a/init/Kconfig b/init/Kconfig index 041f3a022122..d39b31484c52 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -107,6 +107,15 @@ config LOCALVERSION_AUTO which is done within the script "scripts/setlocalversion".) +config BUILD_SALT + string "Build ID Salt" + default "" + help + The build ID is used to link binaries and their debug info. Setting + this option will use the value in the calculation of the build id. + This is mostly useful for distributions which want to ensure the + build is unique between builds. It's safe to leave the default. + config HAVE_KERNEL_GZIP bool diff --git a/init/version.c b/init/version.c index bfb4e3f4955e..ef4012ec4375 100644 --- a/init/version.c +++ b/init/version.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -49,3 +50,5 @@ const char linux_proc_banner[] = "%s version %s" " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")" " (" LINUX_COMPILER ") %s\n"; + +BUILD_SALT; diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1663fb19343a..dc6d714e4dcb 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2125,10 +2125,13 @@ static int check_modname_len(struct module *mod) **/ static void add_header(struct buffer *b, struct module *mod) { + buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); buf_printf(b, "#include \n"); buf_printf(b, "\n"); + buf_printf(b, "BUILD_SALT;\n"); + buf_printf(b, "\n"); buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); buf_printf(b, "\n"); -- cgit v1.2.3-70-g09d2 From d623f60df03a1e44c823ed906ca8ddbd8d3a5983 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 5 Jul 2018 17:49:38 -0700 Subject: x86: Add build salt to the vDSO The vDSO needs to have a unique build id in a similar manner to the kernel and modules. Use the build salt macro. Acked-by: Andy Lutomirski Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- arch/x86/entry/vdso/vdso-note.S | 3 +++ arch/x86/entry/vdso/vdso32/note.S | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/entry/vdso/vdso-note.S b/arch/x86/entry/vdso/vdso-note.S index 79a071e4357e..79423170118f 100644 --- a/arch/x86/entry/vdso/vdso-note.S +++ b/arch/x86/entry/vdso/vdso-note.S @@ -3,6 +3,7 @@ * Here we can supply some information useful to userland. */ +#include #include #include #include @@ -10,3 +11,5 @@ ELFNOTE_START(Linux, 0, "a") .long LINUX_VERSION_CODE ELFNOTE_END + +BUILD_SALT diff --git a/arch/x86/entry/vdso/vdso32/note.S b/arch/x86/entry/vdso/vdso32/note.S index 9fd51f206314..e78047d119f6 100644 --- a/arch/x86/entry/vdso/vdso32/note.S +++ b/arch/x86/entry/vdso/vdso32/note.S @@ -4,6 +4,7 @@ * Here we can supply some information useful to userland. */ +#include #include #include @@ -14,6 +15,8 @@ ELFNOTE_START(Linux, 0, "a") .long LINUX_VERSION_CODE ELFNOTE_END +BUILD_SALT + #ifdef CONFIG_XEN /* * Add a special note telling glibc's dynamic linker a fake hardware -- cgit v1.2.3-70-g09d2 From b399baaaf7522750eab0c2a6b9f0dc511d878dd6 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 5 Jul 2018 17:49:39 -0700 Subject: powerpc: Add build salt to the vDSO The vDSO needs to have a unique build id in a similar manner to the kernel and modules. Use the build salt macro. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- arch/powerpc/kernel/vdso32/note.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/vdso32/note.S b/arch/powerpc/kernel/vdso32/note.S index d4b5be4f3d5f..227a7327399e 100644 --- a/arch/powerpc/kernel/vdso32/note.S +++ b/arch/powerpc/kernel/vdso32/note.S @@ -5,6 +5,7 @@ #include #include +#include #define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \ .section name, flags; \ @@ -23,3 +24,5 @@ ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0) .long LINUX_VERSION_CODE ASM_ELF_NOTE_END + +BUILD_SALT -- cgit v1.2.3-70-g09d2 From efa75c4923be7fedc00b040116657101f20b3678 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 5 Jul 2018 17:49:40 -0700 Subject: arm64: Add build salt to the vDSO The vDSO needs to have a unique build id in a similar manner to the kernel and modules. Use the build salt macro. Acked-by: Will Deacon Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- arch/arm64/kernel/vdso/note.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kernel/vdso/note.S b/arch/arm64/kernel/vdso/note.S index b82c85e5d972..e20483b104d9 100644 --- a/arch/arm64/kernel/vdso/note.S +++ b/arch/arm64/kernel/vdso/note.S @@ -22,7 +22,10 @@ #include #include #include +#include ELFNOTE_START(Linux, 0, "a") .long LINUX_VERSION_CODE ELFNOTE_END + +BUILD_SALT -- cgit v1.2.3-70-g09d2 From 96f14fe738b69dd97a33efe3cc8ab330af5fd1f1 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 9 Jul 2018 17:45:58 -0700 Subject: kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS In preparation for enabling command line CFLAGS, re-name HOSTCFLAGS to KBUILD_HOSTCFLAGS as the internal use only flags. This should not have any visible effects. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 2 +- Makefile | 4 ++-- arch/alpha/boot/Makefile | 2 +- net/bpfilter/Makefile | 2 +- samples/bpf/Makefile | 10 +++++----- scripts/Kbuild.include | 2 +- scripts/Makefile.host | 2 +- tools/build/Build.include | 2 +- tools/objtool/Makefile | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 048fc39a6b91..63655c1a3ad6 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -661,7 +661,7 @@ Both possibilities are described in the following. When compiling host programs, it is possible to set specific flags. The programs will always be compiled utilising $(HOSTCC) passed - the options specified in $(HOSTCFLAGS). + the options specified in $(KBUILD_HOSTCFLAGS). To set flags that will take effect for all host programs created in that Makefile, use the variable HOST_EXTRACFLAGS. diff --git a/Makefile b/Makefile index a89d8a0d3ee1..c364e1100ce0 100644 --- a/Makefile +++ b/Makefile @@ -359,7 +359,7 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ +KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) @@ -429,7 +429,7 @@ KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds LDFLAGS := GCC_PLUGINS_CFLAGS := -export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC +export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS diff --git a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile index 0cbe4c59d3ce..991e023a6fc4 100644 --- a/arch/alpha/boot/Makefile +++ b/arch/alpha/boot/Makefile @@ -14,7 +14,7 @@ targets := vmlinux.gz vmlinux \ tools/bootpzh bootloader bootpheader bootpzheader OBJSTRIP := $(obj)/tools/objstrip -HOSTCFLAGS := -Wall -I$(objtree)/usr/include +KBUILD_HOSTCFLAGS := -Wall -I$(objtree)/usr/include BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj) # SRM bootable image. Copy to offset 512 of a partition. diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile index 39c6980b5d99..70beeb4ad806 100644 --- a/net/bpfilter/Makefile +++ b/net/bpfilter/Makefile @@ -5,7 +5,7 @@ hostprogs-y := bpfilter_umh bpfilter_umh-objs := main.o -HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi +KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi HOSTCC := $(CC) ifeq ($(CONFIG_BPFILTER_UMH), y) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1303af10e54d..494ef04c56cc 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -164,11 +164,11 @@ always += xdpsock_kern.o always += xdp_fwd_kern.o always += task_fd_query_kern.o -HOSTCFLAGS += -I$(objtree)/usr/include -HOSTCFLAGS += -I$(srctree)/tools/lib/ -HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ -HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include -HOSTCFLAGS += -I$(srctree)/tools/perf +KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include +KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ +KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ +KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include +KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 86321f06461e..02bb3163cd8d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -126,7 +126,7 @@ cc-option = $(call __cc-option, $(CC),\ # hostcc-option # Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) hostcc-option = $(call __cc-option, $(HOSTCC),\ - $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) + $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index aa971cc3f339..09f00dae21fe 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -62,7 +62,7 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) ##### # Handle options to gcc. Support building with separate output directory -_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ +_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ $(HOSTCFLAGS_$(basetarget).o) _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ $(HOSTCXXFLAGS_$(basetarget).o) diff --git a/tools/build/Build.include b/tools/build/Build.include index 950c1504ca37..9ec01f4454f9 100644 --- a/tools/build/Build.include +++ b/tools/build/Build.include @@ -98,4 +98,4 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index f76d9914686a..b5d8c2964b52 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -31,7 +31,7 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ -I$(srctree)/tools/objtool/arch/$(ARCH)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -CFLAGS += -Werror $(WARNINGS) $(HOSTCFLAGS) -g $(INCLUDES) +CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) # Allow old libelf to be used: -- cgit v1.2.3-70-g09d2 From 10844aebf44851a981ddaa714351ae61c4b29103 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 9 Jul 2018 17:45:59 -0700 Subject: kbuild: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS In preparation for enabling command line CXXFLAGS, re-name HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS as the internal use only flags. This should not have any visible effects. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- scripts/Makefile.host | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c364e1100ce0..3d2fff178eb6 100644 --- a/Makefile +++ b/Makefile @@ -361,7 +361,7 @@ HOSTCC = gcc HOSTCXX = g++ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) -HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) +KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) HOST_LOADLIBES := $(HOST_LFS_LIBS) @@ -432,7 +432,7 @@ GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE -export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS +export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 09f00dae21fe..455d85aa1d37 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -64,7 +64,7 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs)) _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ $(HOSTCFLAGS_$(basetarget).o) -_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ +_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ $(HOSTCXXFLAGS_$(basetarget).o) ifeq ($(KBUILD_SRC),) -- cgit v1.2.3-70-g09d2 From b90a368000abe5e015e0b045ca2ff7c2173b94c0 Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 9 Jul 2018 17:46:00 -0700 Subject: kbuild: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS In preparation for enabling command line LDFLAGS, re-name HOSTLDFLAGS to KBUILD_HOSTLDFLAGS as the internal use only flags. This should not have any visible effects. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- net/bpfilter/Makefile | 2 +- scripts/Makefile.host | 10 +++++----- tools/build/Makefile | 2 +- tools/objtool/Makefile | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 3d2fff178eb6..d8104dcc0b4f 100644 --- a/Makefile +++ b/Makefile @@ -362,7 +362,7 @@ HOSTCXX = g++ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) -HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) +KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) HOST_LOADLIBES := $(HOST_LFS_LIBS) # Make variables (CC, etc...) @@ -430,7 +430,7 @@ LDFLAGS := GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES +export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS HOST_LOADLIBES export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile index 70beeb4ad806..0947ee7f70d5 100644 --- a/net/bpfilter/Makefile +++ b/net/bpfilter/Makefile @@ -12,7 +12,7 @@ ifeq ($(CONFIG_BPFILTER_UMH), y) # builtin bpfilter_umh should be compiled with -static # since rootfs isn't mounted at the time of __init # function is called and do_execv won't find elf interpreter -HOSTLDFLAGS += -static +KBUILD_HOSTLDFLAGS += -static endif $(obj)/bpfilter_umh_blob.o: $(obj)/bpfilter_umh diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 455d85aa1d37..c019d781b2c9 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -84,7 +84,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOSTLDFLAGS) -o $@ $< \ + cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-csingle): $(obj)/%: $(src)/%.c FORCE $(call if_changed_dep,host-csingle) @@ -92,7 +92,7 @@ $(host-csingle): $(obj)/%: $(src)/%.c FORCE # Link an executable based on list of .o files, all plain c # host-cmulti -> executable quiet_cmd_host-cmulti = HOSTLD $@ - cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ + cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \ $(addprefix $(obj)/,$($(@F)-objs)) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-cmulti): FORCE @@ -109,7 +109,7 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE # Link an executable based on list of .o files, a mixture of .c and .cc # host-cxxmulti -> executable quiet_cmd_host-cxxmulti = HOSTLD $@ - cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ + cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \ $(foreach o,objs cxxobjs,\ $(addprefix $(obj)/,$($(@F)-$(o)))) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) @@ -143,7 +143,7 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE # Link a shared library, based on position independent .o files # *.o -> .so shared library (host-cshlib) quiet_cmd_host-cshlib = HOSTLLD -shared $@ - cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ + cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-cshlib): FORCE @@ -153,7 +153,7 @@ $(call multi_depend, $(host-cshlib), .so, -objs) # Link a shared library, based on position independent .o files # *.o -> .so shared library (host-cxxshlib) quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ - cmd_host-cxxshlib = $(HOSTCXX) $(HOSTLDFLAGS) -shared -o $@ \ + cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-cxxshlib): FORCE diff --git a/tools/build/Makefile b/tools/build/Makefile index 5edf65e684ab..727050c40f09 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -43,7 +43,7 @@ $(OUTPUT)fixdep-in.o: FORCE $(Q)$(MAKE) $(build)=fixdep $(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o - $(QUIET_LINK)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< + $(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ $< FORCE: diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index b5d8c2964b52..c9d038f91af6 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -32,7 +32,7 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/objtool/arch/$(ARCH)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) -LDFLAGS += -lelf $(LIBSUBCMD) $(HOSTLDFLAGS) +LDFLAGS += -lelf $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) # Allow old libelf to be used: elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) -- cgit v1.2.3-70-g09d2 From 8377bd2b9ee1be35b39b5523f640a2b75ddd7c4e Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 9 Jul 2018 17:46:01 -0700 Subject: kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS In preparation for enabling command line LDLIBS, re-name HOST_LOADLIBES to KBUILD_HOSTLDLIBS as the internal use only flags. Also rename existing usage to HOSTLDLIBS for consistency. This should not have any visible effects. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- Makefile | 4 ++-- samples/bpf/Makefile | 12 ++++++------ samples/seccomp/Makefile | 6 +++--- scripts/Makefile | 4 ++-- scripts/Makefile.host | 10 +++++----- scripts/kconfig/Makefile | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index d8104dcc0b4f..caad81c802a4 100644 --- a/Makefile +++ b/Makefile @@ -363,7 +363,7 @@ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) -HOST_LOADLIBES := $(HOST_LFS_LIBS) +KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as @@ -430,7 +430,7 @@ LDFLAGS := GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS HOST_LOADLIBES +export CPP AR NM STRIP OBJCOPY OBJDUMP 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/samples/bpf/Makefile b/samples/bpf/Makefile index 494ef04c56cc..bd9f6c2a808e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -180,12 +180,12 @@ HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/ HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/ -HOST_LOADLIBES += $(LIBBPF) -lelf -HOSTLOADLIBES_tracex4 += -lrt -HOSTLOADLIBES_trace_output += -lrt -HOSTLOADLIBES_map_perf_test += -lrt -HOSTLOADLIBES_test_overhead += -lrt -HOSTLOADLIBES_xdpsock += -pthread +KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf +HOSTLDLIBS_tracex4 += -lrt +HOSTLDLIBS_trace_output += -lrt +HOSTLDLIBS_map_perf_test += -lrt +HOSTLDLIBS_test_overhead += -lrt +HOSTLDLIBS_xdpsock += -pthread # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile index ba942e3ead89..cf34ff6b4065 100644 --- a/samples/seccomp/Makefile +++ b/samples/seccomp/Makefile @@ -30,9 +30,9 @@ HOSTCFLAGS_bpf-direct.o += $(MFLAG) HOSTCFLAGS_dropper.o += $(MFLAG) HOSTCFLAGS_bpf-helper.o += $(MFLAG) HOSTCFLAGS_bpf-fancy.o += $(MFLAG) -HOSTLOADLIBES_bpf-direct += $(MFLAG) -HOSTLOADLIBES_bpf-fancy += $(MFLAG) -HOSTLOADLIBES_dropper += $(MFLAG) +HOSTLDLIBS_bpf-direct += $(MFLAG) +HOSTLDLIBS_bpf-fancy += $(MFLAG) +HOSTLDLIBS_dropper += $(MFLAG) endif always := $(hostprogs-m) endif diff --git a/scripts/Makefile b/scripts/Makefile index 59c21ec49b84..61affa300d25 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -23,8 +23,8 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include -HOSTLOADLIBES_sign-file = -lcrypto -HOSTLOADLIBES_extract-cert = -lcrypto +HOSTLDLIBS_sign-file = -lcrypto +HOSTLDLIBS_extract-cert = -lcrypto always := $(hostprogs-y) $(hostprogs-m) diff --git a/scripts/Makefile.host b/scripts/Makefile.host index c019d781b2c9..0393f75db4d4 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -85,7 +85,7 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-csingle): $(obj)/%: $(src)/%.c FORCE $(call if_changed_dep,host-csingle) @@ -94,7 +94,7 @@ $(host-csingle): $(obj)/%: $(src)/%.c FORCE quiet_cmd_host-cmulti = HOSTLD $@ cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \ $(addprefix $(obj)/,$($(@F)-objs)) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-cmulti): FORCE $(call if_changed,host-cmulti) $(call multi_depend, $(host-cmulti), , -objs) @@ -112,7 +112,7 @@ quiet_cmd_host-cxxmulti = HOSTLD $@ cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \ $(foreach o,objs cxxobjs,\ $(addprefix $(obj)/,$($(@F)-$(o)))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-cxxmulti): FORCE $(call if_changed,host-cxxmulti) $(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) @@ -145,7 +145,7 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE quiet_cmd_host-cshlib = HOSTLLD -shared $@ cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-cshlib): FORCE $(call if_changed,host-cshlib) $(call multi_depend, $(host-cshlib), .so, -objs) @@ -155,7 +155,7 @@ $(call multi_depend, $(host-cshlib), .so, -objs) quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \ $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) + $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F)) $(host-cxxshlib): FORCE $(call if_changed,host-cxxshlib) $(call multi_depend, $(host-cxxshlib), .so, -objs) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a3ac2c91331c..f3c0e6261e2a 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -169,7 +169,7 @@ HOSTCFLAGS_zconf.tab.o := -I$(src) hostprogs-y += nconf nconf-objs := nconf.o zconf.tab.o nconf.gui.o -HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) +HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) @@ -180,7 +180,7 @@ hostprogs-y += mconf lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) -HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) +HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) $(foreach f, mconf.o $(lxdialog), \ $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) @@ -191,7 +191,7 @@ hostprogs-y += qconf qconf-cxxobjs := qconf.o qconf-objs := zconf.tab.o -HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) +HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) $(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc @@ -206,7 +206,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg hostprogs-y += gconf gconf-objs := gconf.o zconf.tab.o -HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) +HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) $(obj)/gconf.o: $(obj)/.gconf-cfg -- cgit v1.2.3-70-g09d2 From f92d19e0ef9bbbb2984845682e740934ad45473b Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 9 Jul 2018 17:46:02 -0700 Subject: kbuild: Use HOST*FLAGS options from the command line Now that we have the rename in place, reuse the HOST*FLAGS options as something that can be set from the command line and included with the rest of the flags. Signed-off-by: Laura Abbott Signed-off-by: Masahiro Yamada --- Documentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt index 114c7ce7b58d..8390c360d4b3 100644 --- a/Documentation/kbuild/kbuild.txt +++ b/Documentation/kbuild/kbuild.txt @@ -50,6 +50,22 @@ LDFLAGS_MODULE -------------------------------------------------- Additional options used for $(LD) when linking modules. +HOSTCFLAGS +-------------------------------------------------- +Additional flags to be passed to $(HOSTCC) when building host programs. + +HOSTCXXFLAGS +-------------------------------------------------- +Additional flags to be passed to $(HOSTCXX) when building host programs. + +HOSTLDFLAGS +-------------------------------------------------- +Additional flags to be passed when linking host programs. + +HOSTLDLIBS +-------------------------------------------------- +Additional libraries to link against when building host programs. + KBUILD_KCONFIG -------------------------------------------------- Set the top-level Kconfig file to the value of this environment diff --git a/Makefile b/Makefile index caad81c802a4..433f87015c1d 100644 --- a/Makefile +++ b/Makefile @@ -360,10 +360,11 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) HOSTCC = gcc HOSTCXX = g++ KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ - -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) -KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) -KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) -KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) + -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \ + $(HOSTCFLAGS) +KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) +KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) +KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as -- cgit v1.2.3-70-g09d2 From 3a477d4efc57adeb3b2bfd6ccedf6f20d275ae1b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Jul 2018 17:01:31 +0900 Subject: um: remove redundant 'export LDFLAGS' in arch/x86/Makefile.um This is already exported by the top-level Makefile. Signed-off-by: Masahiro Yamada Acked-by: Kirill A. Shutemov --- arch/x86/Makefile.um | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index 45af19921ebd..5296f8c9e7f0 100644 --- a/arch/x86/Makefile.um +++ b/arch/x86/Makefile.um @@ -13,8 +13,6 @@ KBUILD_CFLAGS += $(call cc-option,-m32) KBUILD_AFLAGS += $(call cc-option,-m32) LINK-y += $(call cc-option,-m32) -export LDFLAGS - LDS_EXTRA := -Ui386 export LDS_EXTRA -- cgit v1.2.3-70-g09d2 From ec33408a2279b7c72fc09eb4c7fba805e3ec5afe Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Jul 2018 17:01:33 +0900 Subject: kbuild: remove redundant LDFLAGS clearing in arch/*/Makefile Since commit ce99d0bf312d ("kbuild: clear LDFLAGS in the top Makefile"), the top-level Makefile caters to this. Signed-off-by: Masahiro Yamada Acked-by: Kirill A. Shutemov --- arch/arm/Makefile | 3 --- arch/openrisc/Makefile | 1 - arch/riscv/Makefile | 1 - 3 files changed, 5 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index fc26c3d7b9b6..0306640602e7 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -10,9 +10,6 @@ # # Copyright (C) 1995-2001 by Russell King -# Ensure linker flags are correct -LDFLAGS := - LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) LDFLAGS_vmlinux += --be8 diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile index 89076a66eee2..70e06d34006c 100644 --- a/arch/openrisc/Makefile +++ b/arch/openrisc/Makefile @@ -19,7 +19,6 @@ KBUILD_DEFCONFIG := or1ksim_defconfig -LDFLAGS := OBJCOPYFLAGS := -O binary -R .note -R .comment -S LDFLAGS_vmlinux := LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 6d4a5f6c3f4f..2627e4813edf 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -8,7 +8,6 @@ # for more details. # -LDFLAGS := OBJCOPYFLAGS := -O binary LDFLAGS_vmlinux := ifeq ($(CONFIG_DYNAMIC_FTRACE),y) -- cgit v1.2.3-70-g09d2 From f60b992e30ffef82fd6cd317c6fba3ccaacbe921 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Jul 2018 17:01:34 +0900 Subject: kbuild: replace $(LDFLAGS) $(ldflags-y) with $(ld_flags) $(LDFLAGS) $(ldflags-y) is equivalent to $(ld_flags). Signed-off-by: Masahiro Yamada Acked-by: Kirill A. Shutemov --- scripts/Makefile.lib | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 1bb594fcfe12..19155748063b 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -225,8 +225,7 @@ $(obj)/%: $(src)/%_shipped # --------------------------------------------------------------------------- quiet_cmd_ld = LD $@ -cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ - $(filter-out FORCE,$^) -o $@ +cmd_ld = $(LD) $(ld_flags) $(LDFLAGS_$(@F)) $(filter-out FORCE,$^) -o $@ # Objcopy # --------------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 2fb9279f2c3e021745d5c461894a0f6c3690db7b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Jul 2018 17:01:35 +0900 Subject: kbuild: change ld_flags to contain LDFLAGS_$(@F) Put $(LDFLAGS_$(@F)) into ld_flags so that $(LDFLAGS_pcap.o) and $(LDFLAGS_vde.o) in arch/um/drivers/Makefile are absorbed. Signed-off-by: Masahiro Yamada Acked-by: Kirill A. Shutemov --- arch/um/drivers/Makefile | 4 ++-- scripts/Makefile.lib | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile index 16b3cebddafb..693319839f69 100644 --- a/arch/um/drivers/Makefile +++ b/arch/um/drivers/Makefile @@ -25,10 +25,10 @@ LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o - $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) + $(LD) -r -dp -o $@ $^ $(ld_flags) $(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o - $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_vde.o) + $(LD) -r -dp -o $@ $^ $(ld_flags) #XXX: The call below does not work because the flags are added before the # object name, so nothing from the library gets linked. diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 19155748063b..f56bb4b8bc60 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(__cpp_flags) -ld_flags = $(LDFLAGS) $(ldflags-y) +ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes @@ -225,7 +225,7 @@ $(obj)/%: $(src)/%_shipped # --------------------------------------------------------------------------- quiet_cmd_ld = LD $@ -cmd_ld = $(LD) $(ld_flags) $(LDFLAGS_$(@F)) $(filter-out FORCE,$^) -o $@ +cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@ # Objcopy # --------------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2 From 33c362bbc0748dec3a4d3c119a9a5f4b7f7062a7 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Fri, 13 Jul 2018 09:24:57 -0700 Subject: kbuild: buildtar: remove crufty vax pieces ARCH=vax isn't in mainline; it can be added back if/when it shows up. Signed-off-by: Olof Johansson Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/package/buildtar b/scripts/package/buildtar index e8cc72a51b32..55887ac84ee4 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -84,10 +84,6 @@ case "${ARCH}" in [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}" ;; - vax) - [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" - [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" - ;; mips) if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" -- cgit v1.2.3-70-g09d2 From 0df57d90bfd6bb94831e70f4bcb4b7af784066cf Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Fri, 13 Jul 2018 09:24:58 -0700 Subject: kbuild: buildtar: add arm64 support Make 'make tar-pkg' work on arm64. Cc: Will Deacon Cc: Catalin Marinas Signed-off-by: Olof Johansson Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 55887ac84ee4..d624a07a4e77 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -105,6 +105,14 @@ case "${ARCH}" in cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" fi ;; + arm64) + for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo ; do + if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then + cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" + break + fi + done + ;; *) [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" echo "" >&2 -- cgit v1.2.3-70-g09d2 From bb81955fd4a49fffdd86d50afd0c1f2eea044c05 Mon Sep 17 00:00:00 2001 From: Dirk Gouders Date: Wed, 18 Jul 2018 11:13:36 +0200 Subject: kbuild: if_changed: document single use per target limitation Users of if_changed could easily feel invited to use it to divide a recipe into parts like: a: prereq FORCE $(call if_changed,do_a) $(call if_changed,do_b) But this is problematic, because if_changed should not be used more than once per target: in the above example, if_changed stores the command-line of the given command in .a.cmd and when a is up-to-date with respect to prereq, the file .a.cmd contains the command-line for the last command executed, i.e. do_b. When the recipe is then executed again, without any change of prerequisites, the command-line check for do_a will fail, do_a will be executed and stored in .a.cmd. The next check, however, will still see the old content (the file isn't re-read) and if_changed will skip do_b, because the command-line test will not recognize a change. On the next execution of the recipe the roles will flip: do_a is OK but do_b not and it will be executed. And so on... Signed-off-by: Dirk Gouders Signed-off-by: Masahiro Yamada --- Documentation/kbuild/makefiles.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 63655c1a3ad6..766355b1d221 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -1105,6 +1105,12 @@ When kbuild executes, the following steps are followed (roughly): target: source(s) FORCE #WRONG!# $(call if_changed, ld/objcopy/gzip/...) + Note: if_changed should not be used more than once per target. + It stores the executed command in a corresponding .cmd + file and multiple calls would result in overwrites and + unwanted results when the target is up to date and only the + tests on changed commands trigger execution of commands. + ld Link target. Often, LDFLAGS_$@ is used to set specific options to ld. -- cgit v1.2.3-70-g09d2 From 6b0709f5a50a98df5919ade32fd131dde10bdcb0 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 25 Jul 2018 14:16:10 +0900 Subject: ARM: at91: remove unused duplicated filechk_offsets The filechk_offsets in arch/arm/mach-at91/Makefile is never used because it is always overridden by the equivalent one in scripts/Makefile.lib Signed-off-by: Masahiro Yamada Acked-by: Alexandre Belloni --- arch/arm/mach-at91/Makefile | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 4ea93c9df77b..7415f181907b 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile @@ -19,31 +19,6 @@ ifeq ($(CONFIG_PM_DEBUG),y) CFLAGS_pm.o += -DDEBUG endif -# Default sed regexp - multiline due to syntax constraints -define sed-y - "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" -endef - -# Use filechk to avoid rebuilds when a header changes, but the resulting file -# does not -define filechk_offsets - (set -e; \ - echo "#ifndef $2"; \ - echo "#define $2"; \ - echo "/*"; \ - echo " * DO NOT MODIFY."; \ - echo " *"; \ - echo " * This file was generated by Kbuild"; \ - echo " */"; \ - echo ""; \ - sed -ne $(sed-y); \ - echo ""; \ - echo "#endif" ) -endef - arch/arm/mach-at91/pm_data-offsets.s: arch/arm/mach-at91/pm_data-offsets.c $(call if_changed_dep,cc_s_c) -- cgit v1.2.3-70-g09d2 From 43fee2b238959a7b46e2e8c0cd3305c7c044ded8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 25 Jul 2018 14:16:11 +0900 Subject: kbuild: do not redirect the first prerequisite for filechk Currently, filechk unconditionally opens the first prerequisite and redirects it as the stdin of a filechk_* rule. Hence, every target using $(call filechk,...) must list something as the first prerequisite even if it is unneeded. '< $<' is actually unneeded in most cases. Each rule can explicitly adds it if necessary. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- arch/s390/kernel/syscalls/Makefile | 6 +++--- arch/um/Makefile | 2 +- scripts/Kbuild.include | 2 +- scripts/Makefile.lib | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 433f87015c1d..bc3a65be9035 100644 --- a/Makefile +++ b/Makefile @@ -1117,7 +1117,7 @@ define filechk_version.h echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) endef -$(version_h): $(srctree)/Makefile FORCE +$(version_h): FORCE $(call filechk,version.h) $(Q)rm -f $(old_version_h) diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile index 8ff96c08955f..4d929edc80a6 100644 --- a/arch/s390/kernel/syscalls/Makefile +++ b/arch/s390/kernel/syscalls/Makefile @@ -25,15 +25,15 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \ $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)') define filechk_syshdr - $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" + $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $< endef define filechk_sysnr - $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) + $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< endef define filechk_syscalls - $(CONFIG_SHELL) '$(systbl)' -S + $(CONFIG_SHELL) '$(systbl)' -S < $< endef syshdr_abi_unistd_32 := common,32 diff --git a/arch/um/Makefile b/arch/um/Makefile index e54dda8a0363..8c35261f5706 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -169,7 +169,7 @@ define filechk_gen-asm-offsets echo " *"; \ echo " */"; \ echo ""; \ - sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ + sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \ echo ""; ) endef diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 02bb3163cd8d..7eabe80cb9fb 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -56,7 +56,7 @@ kecho := $($(quiet)kecho) define filechk $(Q)set -e; \ mkdir -p $(dir $@); \ - $(filechk_$(1)) < $< > $@.tmp; \ + $(filechk_$(1)) > $@.tmp; \ if [ -r $@ ] && cmp -s $@ $@.tmp; then \ rm -f $@.tmp; \ else \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f56bb4b8bc60..df0fff252619 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -415,7 +415,7 @@ define filechk_offsets echo " * This file was generated by Kbuild"; \ echo " */"; \ echo ""; \ - sed -ne $(sed-offsets); \ + sed -ne $(sed-offsets) < $<; \ echo ""; \ echo "#endif" ) endef -- cgit v1.2.3-70-g09d2 From f2abcc13e4a1b3139f1e3a0ca71bf4db8b7dfe72 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:20:28 +0100 Subject: builddeb: Skip architecture detection when KBUILD_DEBARCH is set If KBUILD_DEBARCH is set then we will not use the result of architecture detection, and we may also warn unnecessarily. Move the check for KBUILD_DEBARCH further up to avoid this. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 985d72d1ab34..434f0b4d5231 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -7,6 +7,11 @@ set -e set_debarch() { + if [ -n "$KBUILD_DEBARCH" ] ; then + debarch="$KBUILD_DEBARCH" + return + fi + # Attempt to find the correct Debian architecture case "$UTS_MACHINE" in i386|ia64|alpha) @@ -46,10 +51,8 @@ set_debarch() { echo "Falling back to using your current userspace instead!" >&2 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 echo "" >&2 + ;; esac - if [ -n "$KBUILD_DEBARCH" ] ; then - debarch="$KBUILD_DEBARCH" - fi } # Some variables and settings used throughout the script -- cgit v1.2.3-70-g09d2 From 091d30aefc8a4d76ffa139a6e51dc237ea1cd599 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:20:45 +0100 Subject: builddeb: Change architecture detection fallback to use dpkg-architecture We currently use dpkg --print-architecture, which reports the architecture of the build machine. We can make a better guess than this by asking dpkg-architecture what the host architecture, i.e. the default architecture for building packages, is. This is sensitive to environment variables such as CC and DEB_HOST_ARCH, which should already be set in a cross-build environment. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 434f0b4d5231..389bf983879d 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -42,13 +42,13 @@ set_debarch() { fi ;; *) - debarch=$(dpkg --print-architecture) + debarch=$(dpkg-architecture -qDEB_HOST_ARCH) echo "" >&2 echo "** ** ** WARNING ** ** **" >&2 echo "" >&2 echo "Your architecture doesn't have its equivalent" >&2 echo "Debian userspace architecture defined!" >&2 - echo "Falling back to using your current userspace instead!" >&2 + echo "Falling back to the current host architecture ($debarch)." >&2 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 echo "" >&2 ;; -- cgit v1.2.3-70-g09d2 From 4260ecd0ad8c10cef8ff6551267bb351e10f70c9 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:20:54 +0100 Subject: builddeb: Drop check for 32-bit s390 s390 now only supports 64-bit configurations. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 389bf983879d..f4449b575379 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -21,7 +21,7 @@ set_debarch() { sparc*) debarch=sparc ;; s390*) - debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; + debarch=s390x ;; ppc*) debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; parisc*) -- cgit v1.2.3-70-g09d2 From 08d3892cdcea7e918106bd78be5471d05b000b30 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:21:01 +0100 Subject: builddeb: Introduce functions to simplify kconfig tests in set_debarch We now have many repetitive greps over the kernel config. Refactor them into functions. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index f4449b575379..ada3c73d1493 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -6,6 +6,18 @@ set -e +is_enabled() { + grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG +} + +if_enabled_echo() { + if is_enabled "$1"; then + echo -n "$2" + elif [ $# -ge 3 ]; then + echo -n "$3" + fi +} + set_debarch() { if [ -n "$KBUILD_DEBARCH" ] ; then debarch="$KBUILD_DEBARCH" @@ -23,22 +35,18 @@ set_debarch() { s390*) debarch=s390x ;; ppc*) - debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; + debarch=$(if_enabled_echo CPU_LITTLE_ENDIAN ppc64el powerpc) ;; parisc*) debarch=hppa ;; mips*) - debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; + debarch=mips$(if_enabled_echo CPU_LITTLE_ENDIAN el) ;; aarch64|arm64) debarch=arm64 ;; arm*) - if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then - if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then - debarch=armhf - else - debarch=armel - fi + if is_enabled AEABI; then + debarch=arm$(if_enabled_echo VFP hf el) else - debarch=arm + debarch=arm fi ;; *) -- cgit v1.2.3-70-g09d2 From 50d511ba6246c46654857b8ef64aefe76a87e455 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:21:09 +0100 Subject: builddeb: Add automatic support for ppc64 and powerpcspe architectures We currently label 64-bit big-endian kernel packages as powerpc (32-bit), mostly because it was officially supported while ppc64 (64-bit big-endian) was not. Now neither is officially supported, so label these packages as ppc64. Debian also has a powerpcspe (32-bit with SPE) architecture. Label packages with a suitable configuration as powerpcspe. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index ada3c73d1493..0891974f499b 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -35,7 +35,12 @@ set_debarch() { s390*) debarch=s390x ;; ppc*) - debarch=$(if_enabled_echo CPU_LITTLE_ENDIAN ppc64el powerpc) ;; + if is_enabled 64BIT; then + debarch=ppc64$(if_enabled_echo CPU_LITTLE_ENDIAN el) + else + debarch=powerpc$(if_enabled_echo SPE spe) + fi + ;; parisc*) debarch=hppa ;; mips*) -- cgit v1.2.3-70-g09d2 From 159b37942286b32aa1c08620b3a1ed2dace7d047 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:21:16 +0100 Subject: builddeb: Add automatic support for mips64el architecture We currently label 64-bit little-endian kernel packages as mipsel (32-bit little-endian), mostly it was officially supported while mips64el (64-bit little-endian) was not. Now both are officially supported, so label these packages as mips64el. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 0891974f499b..350724cdc5af 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -44,7 +44,12 @@ set_debarch() { parisc*) debarch=hppa ;; mips*) - debarch=mips$(if_enabled_echo CPU_LITTLE_ENDIAN el) ;; + if is_enabled CPU_LITTLE_ENDIAN; then + debarch=mips$(if_enabled_echo 64BIT 64)el + else + debarch=mips + fi + ;; aarch64|arm64) debarch=arm64 ;; arm*) -- cgit v1.2.3-70-g09d2 From 679caaf3f79f0adad3b6b6b02539b868a963f46d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:20 +0100 Subject: builddeb: Add automatic support for mips{,64}r6{,el} architectures MIPS R6 is not fully backward-compatible, so Debian has separate architecture names for userland built for R6. Label kernel packages accordingly. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 350724cdc5af..595482923844 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -45,7 +45,9 @@ set_debarch() { debarch=hppa ;; mips*) if is_enabled CPU_LITTLE_ENDIAN; then - debarch=mips$(if_enabled_echo 64BIT 64)el + debarch=mips$(if_enabled_echo 64BIT 64)$(if_enabled_echo CPU_MIPSR6 r6)el + elif is_enabled CPU_MIPSR6; then + debarch=mips$(if_enabled_echo 64BIT 64)r6 else debarch=mips fi -- cgit v1.2.3-70-g09d2 From a27ae285d5efb6d41f70f504dddadaca560de476 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:27 +0100 Subject: builddeb: Add automatic support for sparc64 architecture We currently label 64-bit kernel packages as sparc (32-bit), mostly because it was officially supported while sparc64 was not. Now neither is officially supported, so label these packages as sparc64. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 595482923844..83179a4c6fda 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -31,7 +31,7 @@ set_debarch() { x86_64) debarch=amd64 ;; sparc*) - debarch=sparc ;; + debarch=sparc$(if_enabled_echo 64BIT 64) ;; s390*) debarch=s390x ;; ppc*) -- cgit v1.2.3-70-g09d2 From 822f44fb5bf456f7032c2b428158d51b5fda1e99 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:34 +0100 Subject: builddeb: Add automatic support for or1k architecture Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 83179a4c6fda..fb0d3056f3e2 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -61,6 +61,8 @@ set_debarch() { debarch=arm fi ;; + openrisc) + debarch=or1k ;; *) debarch=$(dpkg-architecture -qDEB_HOST_ARCH) echo "" >&2 -- cgit v1.2.3-70-g09d2 From 60ca40a0649b462c7b398c6c603433faa0f56e26 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:42 +0100 Subject: builddeb: Add automatic support for m68k architecture Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index fb0d3056f3e2..470899fa3a8c 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -26,7 +26,7 @@ set_debarch() { # Attempt to find the correct Debian architecture case "$UTS_MACHINE" in - i386|ia64|alpha) + i386|ia64|alpha|m68k) debarch="$UTS_MACHINE" ;; x86_64) debarch=amd64 ;; -- cgit v1.2.3-70-g09d2 From 75ebcee7699739c0f6c63abcb9f5754538107c62 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:47 +0100 Subject: builddeb: Add automatic support for riscv* architectures Debian currently only defines "riscv64", but it seems safe to assume that any 32-bit port will now be called "riscv32", also matching $UTS_MACHINE. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 470899fa3a8c..3ef2fd0c5086 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -26,7 +26,7 @@ set_debarch() { # Attempt to find the correct Debian architecture case "$UTS_MACHINE" in - i386|ia64|alpha|m68k) + i386|ia64|alpha|m68k|riscv*) debarch="$UTS_MACHINE" ;; x86_64) debarch=amd64 ;; -- cgit v1.2.3-70-g09d2 From 79a85b55e39e65d6f20c753c4ae8bcd6f4cd7007 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 26 Jul 2018 11:22:54 +0100 Subject: builddeb: Add automatic support for sh{3,4}{,eb} architectures Different generations of the SH architecture are not very compatible, so there are/were separate Debian ports for SH3 and SH4. Move the fallback out of the "case" statement, so that it will also be used in case we find some SH architecture version without a known mapping. Signed-off-by: Ben Hutchings Signed-off-by: Masahiro Yamada --- scripts/package/mkdebian | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 3ef2fd0c5086..663a7f343b42 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -63,7 +63,15 @@ set_debarch() { ;; openrisc) debarch=or1k ;; - *) + sh) + if is_enabled CPU_SH3; then + debarch=sh3$(if_enabled_echo CPU_BIG_ENDIAN eb) + elif is_enabled CPU_SH4; then + debarch=sh4$(if_enabled_echo CPU_BIG_ENDIAN eb) + fi + ;; + esac + if [ -z "$debarch" ]; then debarch=$(dpkg-architecture -qDEB_HOST_ARCH) echo "" >&2 echo "** ** ** WARNING ** ** **" >&2 @@ -73,8 +81,7 @@ set_debarch() { echo "Falling back to the current host architecture ($debarch)." >&2 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 echo "" >&2 - ;; - esac + fi } # Some variables and settings used throughout the script -- cgit v1.2.3-70-g09d2 From ddc7c5721ae3554727f3e25e5c7510e278caf6be Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Sat, 28 Jul 2018 10:48:33 -0400 Subject: scripts: Add Python 3 support to tracing/draw_functrace.py Use the print function. This maintains Python 2 support and should have no functional change. Signed-off-by: Jeremy Cline Signed-off-by: Masahiro Yamada --- scripts/tracing/draw_functrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py index db40fa04cd51..9b6dd4f36335 100755 --- a/scripts/tracing/draw_functrace.py +++ b/scripts/tracing/draw_functrace.py @@ -123,7 +123,7 @@ def main(): tree = tree.getParent(caller) tree = tree.calls(callee, calltime) - print CallTree.ROOT + print(CallTree.ROOT) if __name__ == "__main__": main() -- cgit v1.2.3-70-g09d2 From 13d3d01e26b942ada7cfced68ccb6db49597874a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Aug 2018 13:47:01 +0900 Subject: um: fix parallel building with O= option Randy Dunlap reports UML occasionally fails to build with -j and O= options. make[1]: Entering directory '/home/rdunlap/mmotm-2018-0802-1529/UM64' UPD include/generated/uapi/linux/version.h WRAP arch/x86/include/generated/asm/dma-contiguous.h WRAP arch/x86/include/generated/asm/export.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h WRAP arch/x86/include/generated/asm/mm-arch-hooks.h WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h WRAP arch/x86/include/generated/uapi/asm/poll.h GEN ./Makefile make[2]: *** No rule to make target 'archheaders'. Stop. arch/um/Makefile:119: recipe for target 'archheaders' failed make[1]: *** [archheaders] Error 2 make[1]: *** Waiting for unfinished jobs.... UPD include/config/kernel.release make[1]: *** wait: No child processes. Stop. Makefile:146: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 The cause of the problem is the use of '$(MAKE) KBUILD_SRC=', which recurses to the top Makefile via the $(objtree)/Makefile generated by scripts/mkmakefile. When you run "make -j O= ARCH=um", Make can execute 'archheaders' and 'outputmakefile' targets simultaneously because there is no dependency between them. If it happens, $(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders ... tries to run $(objtree)/Makefile that is being updated. The correct way for the recursion is $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) archheaders ..., which does not rely on the generated Makefile. Reported-by: Randy Dunlap Signed-off-by: Masahiro Yamada Tested-by: Randy Dunlap Acked-by: Richard Weinberger --- arch/um/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index 8c35261f5706..613fc3c79de0 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -122,8 +122,7 @@ archheaders: $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ kbuild-file=$(HOST_DIR)/include/uapi/asm/Kbuild \ obj=$(HOST_DIR)/include/generated/uapi/asm - $(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders - + $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) archheaders archprepare: include/generated/user_constants.h -- cgit v1.2.3-70-g09d2 From 63e31a67f12855129740943a4f826f05ddd0a2d0 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Aug 2018 13:47:02 +0900 Subject: kbuild: add %asm-generic to no-dot-config-targets asm-generic and uapi-asm-generic do not depend on the kernel configuration. In fact, uapi-asm-generic is the prerequisite of headers_{install,check}, hence it should not require the .config file. Signed-off-by: Masahiro Yamada Tested-by: Randy Dunlap Acked-by: Richard Weinberger --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bc3a65be9035..d2832a45dffe 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,7 @@ clean-targets := %clean mrproper cleandocs no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ - kernelversion %src-pkg + %asm-generic kernelversion %src-pkg config-targets := 0 mixed-targets := 0 -- cgit v1.2.3-70-g09d2 From 0004438a165b18d4a611745f12e328e65f46c8f2 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 4 Aug 2018 13:47:03 +0900 Subject: um: clean up archheaders recipe Now that '%asm-generic' is added to no-dot-config-targets, 'make asm-generic' does not include the kernel configuration. You can simply do 'make asm-generic' in the recursed top Makefile without bothering syncconfig. Signed-off-by: Masahiro Yamada Tested-by: Randy Dunlap Acked-by: Richard Weinberger --- arch/um/Makefile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index 613fc3c79de0..306ee51c189f 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -116,13 +116,7 @@ endef KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig archheaders: - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - kbuild-file=$(HOST_DIR)/include/asm/Kbuild \ - obj=$(HOST_DIR)/include/generated/asm - $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ - kbuild-file=$(HOST_DIR)/include/uapi/asm/Kbuild \ - obj=$(HOST_DIR)/include/generated/uapi/asm - $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) archheaders + $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders archprepare: include/generated/user_constants.h -- cgit v1.2.3-70-g09d2 From 3fca1700c4c38aaec1cea0c143b0ff8da029fd9c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 8 Aug 2018 11:14:14 +0900 Subject: kbuild: make samples really depend on headers_install Kernel headers must be installed into $(objtree)/usr/include to avoid the build failure of samples. Commit ddea05fa148b ("kbuild: make samples depend on headers_install") addressed this, but "samples/" is only used for the single target build. "make samples/" properly installs kernel headers, but it does not work for general building because a phony target "sample" (no trailing slash) is used. Reported-by: David Howells Signed-off-by: Masahiro Yamada Tested-by: David Howells --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d2832a45dffe..bb917de24913 100644 --- a/Makefile +++ b/Makefile @@ -1010,9 +1010,10 @@ ifdef CONFIG_GDB_SCRIPTS endif +$(call if_changed,link-vmlinux) -# Build samples along the rest of the kernel +# Build samples along the rest of the kernel. This needs headers_install. ifdef CONFIG_SAMPLES vmlinux-dirs += samples +samples: headers_install endif # The actual objects are generated when descending, -- cgit v1.2.3-70-g09d2 From d6c6ab93e17f139c9b7f9b077307ebddc05a7990 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 9 Aug 2018 14:19:31 +0900 Subject: kbuild: remove deprecated host-progs variable The host-progs has been kept as an alias of hostprogs-y for a long time (at least since the beginning of Git era), with the clear prompt: Usage of host-progs is deprecated. Please replace with hostprogs-y! Enough time for the migration has passed. Signed-off-by: Masahiro Yamada Acked-by: Max Filippov --- arch/xtensa/boot/Makefile | 3 +-- scripts/Makefile.build | 7 ------- scripts/Makefile.clean | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile index 53e4178711e6..dc9e0ba7122c 100644 --- a/arch/xtensa/boot/Makefile +++ b/arch/xtensa/boot/Makefile @@ -30,8 +30,7 @@ Image: boot-elf zImage: boot-redboot uImage: $(obj)/uImage -boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \ - $(addprefix $(obj)/,$(host-progs)) +boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 514ed63ff571..1adaac4e10d8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -53,13 +53,6 @@ endif include scripts/Makefile.lib -ifdef host-progs -ifneq ($(hostprogs-y),$(host-progs)) -$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!) -hostprogs-y += $(host-progs) -endif -endif - # Do not include host rules unless needed ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) include scripts/Makefile.host diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 17ef94c635cd..0b80e3207b20 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -38,7 +38,6 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) __clean-files := $(extra-y) $(extra-m) $(extra-) \ $(always) $(targets) $(clean-files) \ - $(host-progs) \ $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ $(hostcxxlibs-y) $(hostcxxlibs-m) -- cgit v1.2.3-70-g09d2 From 09d4d9648bd01a4c124fcc30dd0c31503975e8c2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 3 Aug 2018 18:32:11 +0200 Subject: Coccinelle: doubletest: reduce side effect false positives Ensure that the cited expression is not a function call or an assignment to reduce the chance of false positives. Slightly modify the warning message to indicate another source of false positves. Signed-off-by: Julia Lawall Signed-off-by: Masahiro Yamada --- scripts/coccinelle/tests/doubletest.cocci | 34 +++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/scripts/coccinelle/tests/doubletest.cocci b/scripts/coccinelle/tests/doubletest.cocci index 78d74c22ca12..7af2ce7eb9bf 100644 --- a/scripts/coccinelle/tests/doubletest.cocci +++ b/scripts/coccinelle/tests/doubletest.cocci @@ -1,6 +1,7 @@ /// Find &&/|| operations that include the same argument more than once -//# A common source of false positives is when the argument performs a side -//# effect. +//# A common source of false positives is when the expression, or +//# another expresssion in the same && or || operation, performs a +//# side effect. /// // Confidence: Moderate // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. @@ -20,20 +21,37 @@ position p; @@ ( -* E@p - || ... || E + E@p || ... || E | -* E@p - && ... && E + E@p && ... && E ) -@script:python depends on org@ +@bad@ +expression r.E,e1,e2,fn; +position r.p; +assignment operator op; +@@ + +( +E@p +& + <+... \(fn(...)\|e1 op e2\|e1++\|e1--\|++e1\|--e1\) ...+> +) + +@depends on context && !bad@ +expression r.E; +position r.p; +@@ + +*E@p + +@script:python depends on org && !bad@ p << r.p; @@ cocci.print_main("duplicated argument to && or ||",p) -@script:python depends on report@ +@script:python depends on report && !bad@ p << r.p; @@ -- cgit v1.2.3-70-g09d2 From 512ddf7d7db056edfed3159ea7cb4e4a5eefddd4 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Fri, 10 Aug 2018 23:25:55 +0300 Subject: coccicheck: return proper error code on fail If coccicheck fails, it should return an error code distinct from zero to signal about an internal problem. Current code instead of exiting with the tool's error code returns the error code of 'echo "coccicheck failed"' which is almost always equals to zero, thus failing the original intention of alerting about a problem. This patch fixes the code. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov Acked-by: Julia Lawall Signed-off-by: Masahiro Yamada --- scripts/coccicheck | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/coccicheck b/scripts/coccicheck index 9fedca611b7f..e04d328210ac 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -128,9 +128,10 @@ run_cmd_parmap() { fi echo $@ >>$DEBUG_FILE $@ 2>>$DEBUG_FILE - if [[ $? -ne 0 ]]; then + err=$? + if [[ $err -ne 0 ]]; then echo "coccicheck failed" - exit $? + exit $err fi } -- cgit v1.2.3-70-g09d2