forked from rpms/kernel
		
	Proper support for parallel debuginfo and hardening flags
This commit is contained in:
		
							parent
							
								
									fbedc324c5
								
							
						
					
					
						commit
						edd5e61032
					
				
							
								
								
									
										134
									
								
								0001-kbuild-Add-build-salt-to-the-kernel-and-modules.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								0001-kbuild-Add-build-salt-to-the-kernel-and-modules.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,134 @@ | ||||
| From 25d3cf21987c752240df03c050593621ed2bd3a3 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Tue, 3 Jul 2018 15:50:14 -0700 | ||||
| Subject: [PATCHv6 1/4] kbuild: Add build salt to the kernel and modules | ||||
| To: Andy Lutomirski <luto@kernel.org> | ||||
| To: mjw@fedoraproject.org | ||||
| Cc: Linus Torvalds <torvalds@linux-foundation.org> | ||||
| To: H. J. Lu <hjl.tools@gmail.com> | ||||
| Cc: X86 ML <x86@kernel.org> | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| Cc: Nick Clifton <nickc@redhat.com> | ||||
| Cc: Cary Coutant <ccoutant@gmail.com> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linuxppc-dev@lists.ozlabs.org | ||||
| To: Michael Ellerman <mpe@ellerman.id.au> | ||||
| To: Catalin Marinas <catalin.marinas@arm.com> | ||||
| To: Will Deacon <will.deacon@arm.com> | ||||
| Cc: linux-arm-kernel@lists.infradead.org | ||||
| 
 | ||||
| 
 | ||||
| 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 <yamada.masahiro@socionext.com> | ||||
| Signed-off-by: Laura Abbott <labbott@redhat.com> | ||||
| ---
 | ||||
| v6: Added more detail to the commit text about why exactly this feature | ||||
| is useful. Default string now "" | ||||
| ---
 | ||||
|  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 <linux/elfnote.h>
 | ||||
| +
 | ||||
| +#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 <generated/compile.h> | ||||
| +#include <linux/build-salt.h>
 | ||||
|  #include <linux/export.h> | ||||
|  #include <linux/uts.h> | ||||
|  #include <linux/utsname.h> | ||||
| @@ -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 <linux/build-salt.h>\n");
 | ||||
|  	buf_printf(b, "#include <linux/module.h>\n"); | ||||
|  	buf_printf(b, "#include <linux/vermagic.h>\n"); | ||||
|  	buf_printf(b, "#include <linux/compiler.h>\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"); | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										50
									
								
								0001-tools-build-Fixup-host-c-flags.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								0001-tools-build-Fixup-host-c-flags.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | ||||
| From b8c8dc142ff2f7f46060ed77b2de05c813233029 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Fri, 6 Jul 2018 17:11:31 -0700 | ||||
| Subject: [PATCHv2 1/7] tools: build: Fixup host c flags | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| 
 | ||||
| Commit 0c3b7e42616f ("tools build: Add support for host programs format") | ||||
| introduced host_c_flags which referenced CHOSTFLAGS. The actual name of the | ||||
| variable is HOSTCFLAGS. Fix this up. | ||||
| 
 | ||||
| Fixes: 0c3b7e42616f ("tools build: Add support for host programs format") | ||||
| Signed-off-by: Laura Abbott <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: Also fixed another instance in perf pmu-events. | ||||
| ---
 | ||||
|  tools/build/Build.include   | 2 +- | ||||
|  tools/perf/pmu-events/Build | 2 +- | ||||
|  2 files changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/tools/build/Build.include b/tools/build/Build.include
 | ||||
| index a4bbb984941d..b5c679cd441c 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,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
 | ||||
| +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
 | ||||
| diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
 | ||||
| index 17783913d330..215ba30b8534 100644
 | ||||
| --- a/tools/perf/pmu-events/Build
 | ||||
| +++ b/tools/perf/pmu-events/Build
 | ||||
| @@ -1,7 +1,7 @@
 | ||||
|  hostprogs := jevents | ||||
|   | ||||
|  jevents-y	+= json.o jsmn.o jevents.o | ||||
| -CHOSTFLAGS_jevents.o	= -I$(srctree)/tools/include
 | ||||
| +HOSTCFLAGS_jevents.o	= -I$(srctree)/tools/include
 | ||||
|  pmu-events-y	+= pmu-events.o | ||||
|  JDIR		=  pmu-events/arch/$(SRCARCH) | ||||
|  JSON		=  $(shell [ -d $(JDIR) ] &&				\ | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										38
									
								
								0002-tools-build-Use-HOSTLDFLAGS-with-fixdep.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								0002-tools-build-Use-HOSTLDFLAGS-with-fixdep.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| From b89f16785c9b5176c0af9b15eee74048daf95357 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Fri, 6 Jul 2018 17:42:05 -0700 | ||||
| Subject: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| 
 | ||||
| The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS. | ||||
| Fix this. | ||||
| 
 | ||||
| Signed-off-by: Laura Abbott <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: Switch to just using HOSTLDFLAGS instead of both LDFLAGS and | ||||
| HOSTLDFLAGS. | ||||
| ---
 | ||||
|  tools/build/Makefile | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/tools/build/Makefile b/tools/build/Makefile
 | ||||
| index 5eb4b5ad79cb..5edf65e684ab 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) $(LDFLAGS) -o $@ $<
 | ||||
| +	$(QUIET_LINK)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $<
 | ||||
|   | ||||
|  FORCE: | ||||
|   | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										75
									
								
								0002-x86-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								0002-x86-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,75 @@ | ||||
| From 2199e4e9f81bd90ba82fcb8641a1a5911ac9c96b Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Tue, 3 Jul 2018 15:56:14 -0700 | ||||
| Subject: [PATCHv6 2/4] x86: Add build salt to the vDSO | ||||
| To: Andy Lutomirski <luto@kernel.org> | ||||
| To: mjw@fedoraproject.org | ||||
| Cc: Linus Torvalds <torvalds@linux-foundation.org> | ||||
| To: H. J. Lu <hjl.tools@gmail.com> | ||||
| Cc: X86 ML <x86@kernel.org> | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| Cc: Nick Clifton <nickc@redhat.com> | ||||
| Cc: Cary Coutant <ccoutant@gmail.com> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linuxppc-dev@lists.ozlabs.org | ||||
| Cc: Michael Ellerman <mpe@ellerman.id.au> | ||||
| Cc: Catalin Marinas <catalin.marinas@arm.com> | ||||
| Cc: Will Deacon <will.deacon@arm.com> | ||||
| Cc: linux-arm-kernel@lists.infradead.org | ||||
| 
 | ||||
| 
 | ||||
| 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 <luto@kernel.org> | ||||
| Signed-off-by: Laura Abbott <labbott@redhat.com> | ||||
| ---
 | ||||
| v6: Ack from Andy | ||||
| ---
 | ||||
|  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 <linux/build-salt.h>
 | ||||
|  #include <linux/uts.h> | ||||
|  #include <linux/version.h> | ||||
|  #include <linux/elfnote.h> | ||||
| @@ -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 <linux/build-salt.h>
 | ||||
|  #include <linux/version.h> | ||||
|  #include <linux/elfnote.h> | ||||
|   | ||||
| @@ -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 | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										51
									
								
								0003-powerpc-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								0003-powerpc-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| From e9bb20873f9dff73fc6f381e32b43f198974ed71 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Tue, 3 Jul 2018 15:59:53 -0700 | ||||
| Subject: [PATCHv6 3/4] powerpc: Add build salt to the vDSO | ||||
| Cc: Andy Lutomirski <luto@kernel.org> | ||||
| To: mjw@fedoraproject.org | ||||
| Cc: Linus Torvalds <torvalds@linux-foundation.org> | ||||
| To: H. J. Lu <hjl.tools@gmail.com> | ||||
| Cc: X86 ML <x86@kernel.org> | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| Cc: Nick Clifton <nickc@redhat.com> | ||||
| Cc: Cary Coutant <ccoutant@gmail.com> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linuxppc-dev@lists.ozlabs.org | ||||
| To: Michael Ellerman <mpe@ellerman.id.au> | ||||
| Cc: Catalin Marinas <catalin.marinas@arm.com> | ||||
| Cc: Will Deacon <will.deacon@arm.com> | ||||
| Cc: linux-arm-kernel@lists.infradead.org | ||||
| 
 | ||||
| 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 <labbott@redhat.com> | ||||
| ---
 | ||||
| v6: Remove semi-colon | ||||
| ---
 | ||||
|  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 <linux/uts.h> | ||||
|  #include <linux/version.h> | ||||
| +#include <linux/build-salt.h>
 | ||||
|   | ||||
|  #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
 | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										150
									
								
								0003-treewide-Rename-HOSTCFLAGS-KBUILD_HOSTCFLAGS.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								0003-treewide-Rename-HOSTCFLAGS-KBUILD_HOSTCFLAGS.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,150 @@ | ||||
| From af0b06e726242516da9df5071e4e058f949f2240 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Thu, 5 Jul 2018 14:39:20 -0700 | ||||
| Subject: [PATCHv2] treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| 
 | ||||
| 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 <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: Dropped name change for individual files (still CHOSTFLAGS_foo) | ||||
| ---
 | ||||
|  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 +- | ||||
|  8 files changed, 13 insertions(+), 13 deletions(-) | ||||
| 
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index 925c55f2524f..1feec222f3c1 100644
 | ||||
| --- a/Makefile
 | ||||
| +++ b/Makefile
 | ||||
| @@ -359,7 +359,7 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
 | ||||
|   | ||||
|  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..dfccf0195306 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 c8156d61678c..827344dfb185 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 b5c679cd441c..a75fa0b6ffc0 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: | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										49
									
								
								0004-arm64-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								0004-arm64-Add-build-salt-to-the-vDSO.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| From de9537aca25d53d9b44e7ec9a9952ebd77d69cd1 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Tue, 3 Jul 2018 16:01:24 -0700 | ||||
| Subject: [PATCHv6 4/4] arm64: Add build salt to the vDSO | ||||
| Cc: Andy Lutomirski <luto@kernel.org> | ||||
| To: mjw@fedoraproject.org | ||||
| Cc: Linus Torvalds <torvalds@linux-foundation.org> | ||||
| To: H. J. Lu <hjl.tools@gmail.com> | ||||
| Cc: X86 ML <x86@kernel.org> | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| Cc: Nick Clifton <nickc@redhat.com> | ||||
| Cc: Cary Coutant <ccoutant@gmail.com> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linuxppc-dev@lists.ozlabs.org | ||||
| Cc: Michael Ellerman <mpe@ellerman.id.au> | ||||
| To: Catalin Marinas <catalin.marinas@arm.com> | ||||
| To: Will Deacon <will.deacon@arm.com> | ||||
| Cc: linux-arm-kernel@lists.infradead.org | ||||
| 
 | ||||
| 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 <will.deacon@arm.com> | ||||
| Signed-off-by: Laura Abbott <labbott@redhat.com> | ||||
| ---
 | ||||
| v6: Remove the semi-colon, Ack from Will | ||||
| ---
 | ||||
|  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 <linux/uts.h> | ||||
|  #include <linux/version.h> | ||||
|  #include <linux/elfnote.h> | ||||
| +#include <linux/build-salt.h>
 | ||||
|   | ||||
|  ELFNOTE_START(Linux, 0, "a") | ||||
|  	.long LINUX_VERSION_CODE | ||||
|  ELFNOTE_END | ||||
| +
 | ||||
| +BUILD_SALT
 | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
| @ -0,0 +1,61 @@ | ||||
| From a6faf06c7da9ea06ca23c3a50215860f5d83b3bd Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Thu, 5 Jul 2018 14:43:37 -0700 | ||||
| Subject: [PATCHv2 4/7] treewide: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| 
 | ||||
| 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 <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: Dropped name change for individual files (still HOSTCXXFLAGS_foo) | ||||
| ---
 | ||||
|  Makefile              | 4 ++-- | ||||
|  scripts/Makefile.host | 2 +- | ||||
|  2 files changed, 3 insertions(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index 1feec222f3c1..857ccd28dc36 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),) | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										139
									
								
								0005-treewide-Rename-HOSTLDFLAGS-to-KBUILD_HOSTLDFLAGS.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								0005-treewide-Rename-HOSTLDFLAGS-to-KBUILD_HOSTLDFLAGS.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,139 @@ | ||||
| From 017d1ce33501da9e3e438066d853a874df64f1a5 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Thu, 5 Jul 2018 14:45:52 -0700 | ||||
| Subject: [PATCHv2 5/7] treewide: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| 
 | ||||
| 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 <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: No change | ||||
| ---
 | ||||
|  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 857ccd28dc36..bd2d64b89463 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 <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										188
									
								
								0006-treewide-Rename-HOST_LOADLIBES-to-KBUILD_HOSTLDLIBS.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								0006-treewide-Rename-HOST_LOADLIBES-to-KBUILD_HOSTLDLIBS.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,188 @@ | ||||
| From b7e46c634a6a8b5a40369b70f1f6e0bf21fd8c22 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Thu, 5 Jul 2018 15:01:07 -0700 | ||||
| Subject: [PATCH] treewide: 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 <labbott@redhat.com> | ||||
| ---
 | ||||
|  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 bd2d64b89463..96e34381d9ee 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 25ab143cbe14..166b94db90e3 100644
 | ||||
| --- a/scripts/Makefile
 | ||||
| +++ b/scripts/Makefile
 | ||||
| @@ -22,8 +22,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..8f283acdaa4d 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 | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
| @ -0,0 +1,73 @@ | ||||
| From 36be6e2f197b4abaf0e7c4fe2f525eb56b3f0298 Mon Sep 17 00:00:00 2001 | ||||
| From: Laura Abbott <labbott@redhat.com> | ||||
| Date: Fri, 6 Jul 2018 17:21:01 -0700 | ||||
| Subject: [PATCHv2 7/7] Kbuild: Use HOST*FLAGS options from the command line | ||||
| To: Masahiro Yamada <yamada.masahiro@socionext.com> | ||||
| To: Josh Poimboeuf <jpoimboe@redhat.com> | ||||
| To: Jiri Olsa <jolsa@kernel.org> | ||||
| Cc: linux-kbuild@vger.kernel.org | ||||
| Cc: linux-kernel@vger.kernel.org | ||||
| Cc: Robin Jarry <robin.jarry@6wind.com> | ||||
| Cc: Jonathan Corbet <corbet@lwn.net> | ||||
| Cc: linux-doc@vger.kernel.org | ||||
| 
 | ||||
| 
 | ||||
| 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 <labbott@redhat.com> | ||||
| ---
 | ||||
| v2: Use the correct name for HOSTLDLIBS, update documentation. | ||||
| ---
 | ||||
|  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 6c9c69ec3986..9847a5974826 100644
 | ||||
| --- a/Documentation/kbuild/kbuild.txt
 | ||||
| +++ b/Documentation/kbuild/kbuild.txt
 | ||||
| @@ -238,3 +238,19 @@ KBUILD_VMLINUX_LIBS
 | ||||
|  All .a "lib" files for vmlinux. | ||||
|  KBUILD_VMLINUX_INIT, KBUILD_VMLINUX_MAIN, and KBUILD_VMLINUX_LIBS together | ||||
|  specify all the object files used to link vmlinux. | ||||
| +
 | ||||
| +HOSTCFLAGS
 | ||||
| +--------------------------------------------------
 | ||||
| +Additional flags to be passed to $(HOSTCC) when building host programs.
 | ||||
| +
 | ||||
| +HOSTLDFLAGS
 | ||||
| +--------------------------------------------------
 | ||||
| +Additional flags to be passed to $(HOSTLD) when building host programs.
 | ||||
| +
 | ||||
| +HOSTCXXFLAGS
 | ||||
| +--------------------------------------------------
 | ||||
| +Additional flags to be passed to $(HOSTCXX) when building host programs.
 | ||||
| +
 | ||||
| +HOSTLDLIBS
 | ||||
| +--------------------------------------------------
 | ||||
| +Additional libraries to link against when building host programs.
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index 96e34381d9ee..c2ee1d4c12c9 100644
 | ||||
| --- a/Makefile
 | ||||
| +++ b/Makefile
 | ||||
| @@ -360,10 +360,11 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS)
 | ||||
|  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 | ||||
| -- 
 | ||||
| 2.17.1 | ||||
| 
 | ||||
							
								
								
									
										1
									
								
								configs/fedora/generic/CONFIG_BUILD_SALT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								configs/fedora/generic/CONFIG_BUILD_SALT
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| CONFIG_BUILD_SALT="" | ||||
| @ -751,6 +751,7 @@ CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUG=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -751,6 +751,7 @@ CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUG=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -786,6 +786,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -760,6 +760,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -759,6 +759,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -785,6 +785,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2 is not set | ||||
| # CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH is not set | ||||
|  | ||||
| @ -636,6 +636,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
| @ -639,6 +639,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
| @ -639,6 +639,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
| @ -636,6 +636,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
| @ -623,6 +623,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -620,6 +620,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -579,6 +579,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -576,6 +576,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -580,6 +580,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -577,6 +577,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
| # CONFIG_CACHEFILES_HISTOGRAM is not set | ||||
|  | ||||
| @ -651,6 +651,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
| @ -648,6 +648,7 @@ CONFIG_BT_WILINK=m | ||||
| CONFIG_BUG_ON_DATA_CORRUPTION=y | ||||
| CONFIG_BUILD_DOCSRC=y | ||||
| CONFIG_BUILD_ID_SALT=0x12345678 | ||||
| CONFIG_BUILD_SALT="" | ||||
| CONFIG_BXT_WC_PMIC_OPREGION=y | ||||
| # CONFIG_C2PORT is not set | ||||
| # CONFIG_CACHEFILES_DEBUG is not set | ||||
|  | ||||
							
								
								
									
										42
									
								
								kernel.spec
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								kernel.spec
									
									
									
									
									
								
							| @ -610,6 +610,21 @@ Patch504: kexec-bzimage-verify-pe-signature-fix.patch | ||||
| # arm64 compile fix | ||||
| Patch505: 0001-Revert-arm64-Use-aarch64elf-and-aarch64elfb-emulatio.patch | ||||
| 
 | ||||
| # Support for unique build ids | ||||
| # All queued in the kbuild tree | ||||
| Patch506: 0001-kbuild-Add-build-salt-to-the-kernel-and-modules.patch | ||||
| Patch507: 0002-x86-Add-build-salt-to-the-vDSO.patch | ||||
| Patch508: 0003-powerpc-Add-build-salt-to-the-vDSO.patch | ||||
| Patch509: 0004-arm64-Add-build-salt-to-the-vDSO.patch | ||||
| Patch510: 0001-tools-build-Fixup-host-c-flags.patch | ||||
| Patch511: 0002-tools-build-Use-HOSTLDFLAGS-with-fixdep.patch | ||||
| Patch512: 0003-treewide-Rename-HOSTCFLAGS-KBUILD_HOSTCFLAGS.patch | ||||
| Patch513: 0004-treewide-Rename-HOSTCXXFLAGS-to-KBUILD_HOSTCXXFLAGS.patch | ||||
| Patch514: 0005-treewide-Rename-HOSTLDFLAGS-to-KBUILD_HOSTLDFLAGS.patch | ||||
| Patch515: 0006-treewide-Rename-HOST_LOADLIBES-to-KBUILD_HOSTLDLIBS.patch | ||||
| Patch516: 0007-Kbuild-Use-HOST-FLAGS-options-from-the-command-line.patch | ||||
| 
 | ||||
| 
 | ||||
| # END OF PATCH DEFINITIONS | ||||
| 
 | ||||
| %endif | ||||
| @ -1171,6 +1186,21 @@ cp_vmlinux() | ||||
|   eu-strip --remove-comment -o "$2" "$1" | ||||
| } | ||||
| 
 | ||||
| # These are for host programs that get built as part of the kernel and | ||||
| # are required to be packaged in kernel-devel for building external modules. | ||||
| # Since they are userspace binaries, they are required to pickup the hardening | ||||
| # flags defined in the macros. The --build-id=uuid is a trick to get around | ||||
| # debuginfo limitations: Typically, find-debuginfo.sh will update the build | ||||
| # id of all binaries to allow for parllel debuginfo installs. The kernel | ||||
| # can't use this because it breaks debuginfo for the vDSO so we have to | ||||
| # use a special mechanism for kernel and modules to be unique. Unfortunately, | ||||
| # we still have userspace binaries which need unique debuginfo and because | ||||
| # they come from the kernel package, we can't just use find-debuginfo.sh to | ||||
| # rewrite only those binaries. The easiest option right now is just to have | ||||
| # the build id be a uuid for the host programs. | ||||
| %define build_hostcflags  %{build_cflags} | ||||
| %define build_hostldflags %{build_ldflags} -Wl,--build-id=uuid | ||||
| 
 | ||||
| BuildKernel() { | ||||
|     MakeTarget=$1 | ||||
|     KernelImage=$2 | ||||
| @ -1221,9 +1251,12 @@ BuildKernel() { | ||||
|     Arch=`head -1 .config | cut -b 3-` | ||||
|     echo USING ARCH=$Arch | ||||
| 
 | ||||
|     make %{?make_opts} ARCH=$Arch olddefconfig >/dev/null | ||||
|     %{make} %{?make_opts} ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags} | ||||
|     %{make} %{?make_opts} ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1 | ||||
|     make %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch olddefconfig | ||||
| 
 | ||||
|     # This ensures build-ids are unique to allow parallel debuginfo | ||||
|     perl -p -i -e "s/^CONFIG_BUILD_SALT.*/CONFIG_BUILD_SALT=\"%{KVERREL}\"/" .config | ||||
|     %{make} %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags} %{?kernel_mflags} | ||||
|     %{make} %{?make_opts} HOSTCFLAGS="%{build_hostcflags}" HOSTLDFLAGS="%{build_hostldflags}" ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1 | ||||
| 
 | ||||
|     mkdir -p $RPM_BUILD_ROOT/%{image_install_path} | ||||
|     mkdir -p $RPM_BUILD_ROOT/lib/modules/$KernelVer | ||||
| @ -1845,6 +1878,9 @@ fi | ||||
| # | ||||
| # | ||||
| %changelog | ||||
| * Thu Jul 12 2018 Laura Abbott <labbott@redhat.com> | ||||
| - Proper support for parallel debuginfo and hardening flags | ||||
| 
 | ||||
| * Thu Jul 12 2018 Javier Martinez Canillas <javierm@redhat.com> | ||||
| - Drop the id field from generated BLS snippets | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,7 @@ | ||||
| Linux 4.18 rebase notes: | ||||
| - Turn off CONFIG_BCM2835_VCHIQ | ||||
| - Drop build-id/hardening flags patches and changes | ||||
| 
 | ||||
| 
 | ||||
| Linux 4.17 rebase notes: | ||||
| - Turn off MTD + JFFS2 + extra infiniband options | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user