HOSTFLAGS and HOSTLDFLAGS from the environment
Subsystems (8)
v2 cover HOSTFLAGS and HOSTLDFLAGS from the environment
Hi,
This is v2 of the series to set HOSTCFLAGS and HOSTLDFLAGS from the environment. The changes are mostly minor fixups requested and also include documentation of the new options.
Laura Abbott (7):
tools: build: Fixup host c flags
tools: build: Use HOSTLDFLAGS with fixdep
treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS
treewide: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
treewide: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
treewide: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
Kbuild: Use HOST*FLAGS options from the command line
Documentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 17 +++++++++-------- arch/alpha/boot/Makefile | 2 +- net/bpfilter/Makefile | 4 ++-- samples/bpf/Makefile | 22 +++++++++++----------- samples/seccomp/Makefile | 6 +++--- scripts/Kbuild.include | 2 +- scripts/Makefile | 4 ++-- scripts/Makefile.host | 24 ++++++++++++------------ scripts/kconfig/Makefile | 10 +++++----- tools/build/Build.include | 2 +- tools/build/Makefile | 2 +- tools/objtool/Makefile | 4 ++-- tools/perf/pmu-events/Build | 2 +- 14 files changed, 67 insertions(+), 50 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/7 tools: build: Fixup host c flags
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.
---
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(-)
tools/build/Build.include +1 -1
@@ -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))
tools/perf/pmu-events/Build +1 -1
@@ -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) ] && \
Signature · 1 line
2.17.1
Re: [PATCHv2 1/7] tools: build: Fixup host c flags
Quoted 8 lines · Laura Abbott
Commit
0c3b7e42616f("tools build: Add support for host programs format") introducedhost_c_flagswhich 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 <[email protected]>---
v2: Also fixed another instance in perf pmu-events.
cc-ing more folks, that were in initial patch for heads up
thanks,
jirka
Quoted 31 lines
--- tools/build/Build.include | 2 +- tools/perf/pmu-events/Build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)tools/build/Build.include +1
-1@@ -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))tools/perf/pmu-events/Build +1
-1@@ -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) ] && \Signature · 1 line
2.17.1
Re: [PATCHv2 1/7] tools: build: Fixup host c flags
2018-07-10 16:38 GMT+09:00 Jiri Olsa <[email protected]>:
Quoted 10 lines · Laura Abbott
Quoted 8 lines
Commit
0c3b7e42616f("tools build: Add support for host programs format") introducedhost_c_flagswhich 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 <[email protected]>---
v2: Also fixed another instance in perf pmu-events.
Quoted 7 lines
Acked-by Jiri Olsa <[email protected]>cc-ing more folks, that were in initial patch for heads up
thanks,
jirka
Applied to linux-kbuild/fixes. Thanks!
Quoted 36 lines
Quoted 30 lines
--- tools/build/Build.include | 2 +- tools/perf/pmu-events/Build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)tools/build/Build.include +1
-1@@ -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))tools/perf/pmu-events/Build +1
-2@@ -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) ] && \ --Quoted 2 lines
2.17.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v2 2/7 tools: build: Use HOSTLDFLAGS with fixdep
In reply to Laura AbbottThe final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS. Fix this.
---
v2: Switch to just using HOSTLDFLAGS instead of both LDFLAGS and HOSTLDFLAGS.
--- tools/build/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/Makefile +1 -1
@@ -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:
Signature · 1 line
2.17.1
Re: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep
Quoted 4 lines · Laura Abbott
The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS. Fix this.
Signed-off-by Laura Abbott <[email protected]>
thanks,
jirka
Quoted 23 lines
---
v2: Switch to just using HOSTLDFLAGS instead of both LDFLAGS and HOSTLDFLAGS.--- tools/build/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/build/Makefile +1
-1@@ -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:Signature · 1 line
2.17.1
Re: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep
2018-07-10 16:38 GMT+09:00 Jiri Olsa <[email protected]>:
Quoted 8 lines · Laura Abbott
Quoted 4 lines
The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS. Fix this.
Signed-off-by Laura Abbott <[email protected]>Acked-by Jiri Olsa <[email protected]>
Applied to linux-kbuild/fixes. Thanks!
Quoted 30 lines
thanks,
jirkaQuoted 21 lines
---
v2: Switch to just using HOSTLDFLAGS instead of both LDFLAGS and HOSTLDFLAGS.--- tools/build/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/build/Makefile +1
-2@@ -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: --Quoted 2 lines
2.17.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v2 1/1 treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS
In reply to Laura AbbottIn 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.
---
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(-)
Makefile +2 -2
@@ -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
arch/alpha/boot/Makefile +1 -1
@@ -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.
net/bpfilter/Makefile +1 -1
@@ -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)
samples/bpf/Makefile +5 -5
@@ -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/
scripts/Kbuild.include +1 -1
@@ -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)
scripts/Makefile.host +1 -1
@@ -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)
tools/build/Build.include +1 -1
@@ -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))
tools/objtool/Makefile +1 -1
@@ -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:
Signature · 1 line
2.17.1
Re: [PATCHv2] treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS
Hi.
2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 8 lines
In preparation for enabling command line CFLAGS, re-name HOSTCFLAGS to
KBUILD_HOSTCFLAGSas the internal use only flags. This should not have any visible effects.Signed-off-by Laura Abbott <[email protected]>---
v2: Dropped name change for individual files (stillCHOSTFLAGS_foo)
---
One more fix for a document.
(quoted diff) +0 -0
b/Documentation/kbuild/makefiles.txt
index 048fc39..63655c1 100644
Documentation/kbuild/makefiles.txt +1 -1
@@ -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.
I will fold this.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v2 4/7 treewide: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS
In reply to Laura AbbottIn 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.
---
v2: Dropped name change for individual files (still HOSTCXXFLAGS_foo)
--- Makefile | 4 ++-- scripts/Makefile.host | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Makefile +2 -2
@@ -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
scripts/Makefile.host +1 -1
@@ -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),)
Signature · 1 line
2.17.1
PATCH v2 5/7 treewide: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS
In reply to Laura AbbottIn 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.
---
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(-)
Makefile +2 -2
@@ -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
net/bpfilter/Makefile +1 -1
@@ -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
scripts/Makefile.host +5 -5
@@ -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
tools/build/Makefile +1 -1
@@ -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:
tools/objtool/Makefile +1 -1
@@ -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)
Signature · 1 line
2.17.1
PATCH v2 6/7 treewide: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
In reply to Laura AbbottIn 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.
---
v2: Rename existing HOSTLOADLIBES to HOSTLDLIBS
--- 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(-)
Makefile +2 -2
@@ -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
samples/bpf/Makefile +6 -6
@@ -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
samples/seccomp/Makefile +3 -3
@@ -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
scripts/Makefile +2 -2
@@ -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)
scripts/Makefile.host +5 -5
@@ -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)
scripts/kconfig/Makefile +4 -4
@@ -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 KBUILD_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
Signature · 1 line
2.17.1
PATCH v2 7/7 Kbuild: Use HOST*FLAGS options from the command line
In reply to Laura AbbottNow 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.
---
v2: Use the correct name for HOSTLDLIBS, update documentation.
--- Documentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
Documentation/kbuild/kbuild.txt +16 -0
@@ -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.
Makefile +5 -4
@@ -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
Signature · 1 line
2.17.1
Re: [PATCHv2 7/7] Kbuild: Use HOST*FLAGS options from the command line
2018-07-10 9:46 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 17 lines
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 <[email protected]>---
v2: Use the correct name for HOSTLDLIBS, update documentation.--- Documentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
Documentation/kbuild/kbuild.txt KBUILD_VMLINUX_LIBS · line 248
Quoted 3 lines
Documentation/kbuild/kbuild.txt +3
-0+HOSTLDFLAGS +-------------------------------------------------- +Additional flags to be passed to $(HOSTLD) when building host programs.
Strictly speaking, $(CC) or $(CXX) is used
when linking host programs.
See this.
https://github.com/torvalds/linux/blob/v4.17/scripts/Makefile.host#L95
https://github.com/torvalds/linux/blob/v4.17/scripts/Makefile.host#L112
In fact, there is no definition of 'HOSTLD' in the top Makefile.
I will reword it to:
HOSTLDFLAGS
--------------------------------------------------
Additional flags to be passed when linking host programs.
I will also move this hunk up
after LDFLAGS_MODULE.
Signature · 2 lines
Best Regards Masahiro Yamada
2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 6 lines
Hi,
This is v2 of the series to set HOSTCFLAGS and HOSTLDFLAGS from the environment. The changes are mostly minor fixups requested and also include documentation of the new options.
I checked this series.
I left minor comments for 3/7 and 7/7.
Unless you disagree,
I will fix them up locally
and queue it to my tree.
Thanks.
Quoted 32 lines
Laura Abbott (7):
tools: build: Fixup host c flags
tools: build: Use HOSTLDFLAGS with fixdep
treewide: Rename HOSTCFLAGS ->KBUILD_HOSTCFLAGS
treewide: Rename HOSTCXXFLAGS toKBUILD_HOSTCXXFLAGS
treewide: Rename HOSTLDFLAGS toKBUILD_HOSTLDFLAGS
treewide: RenameHOST_LOADLIBEStoKBUILD_HOSTLDLIBS
Kbuild: Use HOST*FLAGS options from the command lineDocumentation/kbuild/kbuild.txt | 16 ++++++++++++++++ Makefile | 17 +++++++++-------- arch/alpha/boot/Makefile | 2 +- net/bpfilter/Makefile | 4 ++-- samples/bpf/Makefile | 22 +++++++++++----------- samples/seccomp/Makefile | 6 +++--- scripts/Kbuild.include | 2 +- scripts/Makefile | 4 ++-- scripts/Makefile.host | 24 ++++++++++++------------ scripts/kconfig/Makefile | 10 +++++----- tools/build/Build.include | 2 +- tools/build/Makefile | 2 +- tools/objtool/Makefile | 4 ++-- tools/perf/pmu-events/Build | 2 +- 14 files changed, 67 insertions(+), 50 deletions(-)--
2.17.1--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 10 lines · Masahiro Yamada
2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 6 lines
Hi,
This is v2 of the series to set HOSTCFLAGS and HOSTLDFLAGS from the environment. The changes are mostly minor fixups requested and also include documentation of the new options.
Quoted 9 lines
I checked this series.
I left minor comments for 3/7 and 7/7.
Unless you disagree,
I will fix them up locally
and queue it to my tree.
The fixes look fine.
Thanks,
Laura
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
2018-07-13 2:08 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 17 lines · Masahiro Yamada
Quoted 16 lines
2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
Quoted 7 lines
Hi,
This is v2 of the series to set HOSTCFLAGS and HOSTLDFLAGS from the environment. The changes are mostly minor fixups requested and also include documentation of the new options.
I checked this series.
Quoted 9 lines
Quoted 6 lines
I left minor comments for 3/7 and 7/7.
Unless you disagree,
I will fix them up locally
and queue it to my tree.The fixes look fine.
Applied to linux-kbuild. Thanks.
Quoted 9 lines
Thanks,
Laura--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best Regards Masahiro Yamada