2018-07-10 00:47:25

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 0/7] 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(-)

--
2.17.1



2018-07-10 00:47:33

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep

The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS.
Fix this.

Signed-off-by: Laura Abbott <[email protected]>
---
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


2018-07-10 00:48:16

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 7/7] Kbuild: Use HOST*FLAGS options from the command line


Now that we have the rename in place, reuse the HOST*FLAGS options as
something that can be set from the command line and included with the
rest of the flags.

Signed-off-by: Laura Abbott <[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(-)

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


2018-07-10 00:48:31

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 6/7] 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 <[email protected]>
---
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(-)

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 035c5670d9ff..4baab548b979 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 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
--
2.17.1


2018-07-10 00:48:35

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 5/7] treewide: Rename HOSTLDFLAGS to KBUILD_HOSTLDFLAGS

In preparation for enabling command line LDFLAGS, re-name HOSTLDFLAGS to
KBUILD_HOSTLDFLAGS as the internal use only flags. This should not have any
visible effects.

Signed-off-by: Laura Abbott <[email protected]>
---
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


2018-07-10 00:49:07

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 4/7] treewide: Rename HOSTCXXFLAGS to KBUILD_HOSTCXXFLAGS

In preparation for enabling command line CXXFLAGS, re-name HOSTCXXFLAGS to
KBUILD_HOSTCXXFLAGS as the internal use only flags. This should not have any
visible effects.

Signed-off-by: Laura Abbott <[email protected]>
---
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


2018-07-10 00:49:25

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2 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.

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.
---
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


2018-07-10 00:50:04

by Laura Abbott

[permalink] [raw]
Subject: [PATCHv2] treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS

In preparation for enabling command line CFLAGS, re-name HOSTCFLAGS to
KBUILD_HOSTCFLAGS as the internal use only flags. This should not have any
visible effects.

Signed-off-by: Laura Abbott <[email protected]>
---
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


2018-07-10 07:39:37

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv2 1/7] tools: build: Fixup host c flags

On Mon, Jul 09, 2018 at 05:45:56PM -0700, Laura Abbott wrote:
> 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 <[email protected]>
> ---
> v2: Also fixed another instance in perf pmu-events.

Acked-by: Jiri Olsa <[email protected]>

cc-ing more folks, that were in initial patch for heads up

thanks,
jirka


> ---
> 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
>

2018-07-10 07:40:09

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep

On Mon, Jul 09, 2018 at 05:45:57PM -0700, Laura Abbott wrote:
> 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]>

thanks,
jirka

> ---
> 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
>

2018-07-12 10:06:06

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCHv2] treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS

Hi.


2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
> 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 <[email protected]>
> ---
> v2: Dropped name change for individual files (still CHOSTFLAGS_foo)
> ---



One more fix for a document.


diff --git a/Documentation/kbuild/makefiles.txt
b/Documentation/kbuild/makefiles.txt
index 048fc39..63655c1 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -661,7 +661,7 @@ Both possibilities are described in the following.

When compiling host programs, it is possible to set specific flags.
The programs will always be compiled utilising $(HOSTCC) passed
- the options specified in $(HOSTCFLAGS).
+ the options specified in $(KBUILD_HOSTCFLAGS).
To set flags that will take effect for all host programs created
in that Makefile, use the variable HOST_EXTRACFLAGS.


I will fold this.


--
Best Regards
Masahiro Yamada

2018-07-12 10:13:18

by Masahiro Yamada

[permalink] [raw]
Subject: 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]>:
>
> 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(-)
>




> +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.





--
Best Regards
Masahiro Yamada

2018-07-12 10:14:59

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCHv2 0/7] HOSTFLAGS and HOSTLDFLAGS from the environment

2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
>
> 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.




> 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(-)
>
> --
> 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



--
Best Regards
Masahiro Yamada

2018-07-12 15:44:53

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCHv2 1/7] tools: build: Fixup host c flags

2018-07-10 16:38 GMT+09:00 Jiri Olsa <[email protected]>:
> On Mon, Jul 09, 2018 at 05:45:56PM -0700, Laura Abbott wrote:
>> 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 <[email protected]>
>> ---
>> v2: Also fixed another instance in perf pmu-events.
>
> 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!


>
>> ---
>> 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
>>
> --
> 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



--
Best Regards
Masahiro Yamada

2018-07-12 15:46:06

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCHv2 2/7] tools: build: Use HOSTLDFLAGS with fixdep

2018-07-10 16:38 GMT+09:00 Jiri Olsa <[email protected]>:
> On Mon, Jul 09, 2018 at 05:45:57PM -0700, Laura Abbott wrote:
>> 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!

> thanks,
> jirka
>
>> ---
>> 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
>>
> --
> 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



--
Best Regards
Masahiro Yamada

2018-07-12 17:09:54

by Laura Abbott

[permalink] [raw]
Subject: Re: [PATCHv2 0/7] HOSTFLAGS and HOSTLDFLAGS from the environment

On 07/12/2018 03:13 AM, Masahiro Yamada wrote:
> 2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
>>
>> 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.
>

The fixes look fine.

Thanks,
Laura



2018-07-18 00:54:10

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCHv2 0/7] HOSTFLAGS and HOSTLDFLAGS from the environment

2018-07-13 2:08 GMT+09:00 Laura Abbott <[email protected]>:
> On 07/12/2018 03:13 AM, Masahiro Yamada wrote:
>>
>> 2018-07-10 9:45 GMT+09:00 Laura Abbott <[email protected]>:
>>>
>>>
>>> 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.
>>
>
> The fixes look fine.
>


Applied to linux-kbuild. Thanks.


> 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



--
Best Regards
Masahiro Yamada