2018-07-07 01:11:31

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 0/7] HOSTFLAGS and HOSTLDFLAGS from the environment (new approach)

Hi,

This is a follow up from
lkml.kernel.org/r/<[email protected]> . I was
pointed to a previous suggestion (https://lkml.org/lkml/2018/2/28/178)
to rename the variables for better namespacing. I hadn't seen anyone
follow up so this is a series to do just that. I split up the rename by
variable for ease of review. This was mostly just a pretty
straight-forward search and replace. I intentionally didn't Cc all the
outside maintainers on the rename because I wanted to make sure this
approach was correct before bothering people.

This series also includes two other issuse I found to finally have all
the generated files pick up the host flags. The first seems to be a typo
of CHOSTFLAGS instead of HOSTCFLAGS. The second is a missing HOSTLDFLAGS
when linking fixdep. I put these two separately in case there was
interest in picking them up for stable.

For the interested, the full command line I've been testing with:

HOSTCFLAGS="-O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection"

HOSTLDFLAGS="-Wl,-z,relro -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld"

Thanks,
Laura

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

Makefile | 17 +++++++++--------
arch/alpha/boot/Makefile | 2 +-
arch/s390/tools/Makefile | 4 ++--
arch/x86/tools/Makefile | 4 ++--
net/bpfilter/Makefile | 4 ++--
samples/bpf/Makefile | 28 ++++++++++++++--------------
samples/connector/Makefile | 2 +-
samples/hidraw/Makefile | 2 +-
samples/seccomp/Makefile | 24 ++++++++++++------------
samples/statx/Makefile | 2 +-
samples/uhid/Makefile | 2 +-
scripts/Kbuild.include | 2 +-
scripts/Makefile | 4 ++--
scripts/Makefile.host | 28 ++++++++++++++--------------
scripts/dtc/Makefile | 24 ++++++++++++------------
scripts/genksyms/Makefile | 4 ++--
scripts/kconfig/Makefile | 14 +++++++-------
tools/build/Build.include | 2 +-
tools/build/Makefile | 2 +-
tools/objtool/Makefile | 4 ++--
20 files changed, 88 insertions(+), 87 deletions(-)

--
2.17.1



2018-07-07 01:08:38

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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]>
---
Makefile | 4 ++--
scripts/Makefile.host | 4 ++--
scripts/kconfig/Makefile | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 16cab22b1f40..9c3f1864d678 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 7a4c90f2b0ce..1c153cc5b530 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -64,8 +64,8 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))

_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(KBUILD_HOSTCFLAGS_$(basetarget).o)
-_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
- $(HOSTCXXFLAGS_$(basetarget).o)
+_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
+ $(KBUILD_HOSTCXXFLAGS_$(basetarget).o)

ifeq ($(KBUILD_SRC),)
__hostc_flags = $(_hostc_flags)
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index f98a22618e1f..37605d92c597 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -192,7 +192,7 @@ qconf-cxxobjs := qconf.o
qconf-objs := zconf.tab.o

HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
-HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
+KBUILD_HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)

$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc

--
2.17.1


2018-07-07 01:08:38

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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]>
---
Makefile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index d925af1fb11b..77c74b3cf30b 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) $(HOST_LOADLIBES)

# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
--
2.17.1


2018-07-07 01:08:58

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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. This should not have any
visible effects.

Signed-off-by: Laura Abbott <[email protected]>
---
Makefile | 4 ++--
samples/bpf/Makefile | 2 +-
scripts/Makefile.host | 10 +++++-----
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 319736b80016..d925af1fb11b 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 09f90955412e..c20fb2fa9c37 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -180,7 +180,7 @@ KBUILD_HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
KBUILD_HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
KBUILD_HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/

-HOST_LOADLIBES += $(LIBBPF) -lelf
+KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf
HOSTLOADLIBES_tracex4 += -lrt
HOSTLOADLIBES_trace_output += -lrt
HOSTLOADLIBES_map_perf_test += -lrt
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 07acf5779f55..7b784413d921 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) $(HOSTLOADLIBES_$(@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) $(HOSTLOADLIBES_$(@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) $(HOSTLOADLIBES_$(@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) $(HOSTLOADLIBES_$(@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) $(HOSTLOADLIBES_$(@F))
$(host-cxxshlib): FORCE
$(call if_changed,host-cxxshlib)
$(call multi_depend, $(host-cxxshlib), .so, -objs)
--
2.17.1


2018-07-07 01:09:24

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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]>
---
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 9c3f1864d678..319736b80016 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 1c153cc5b530..07acf5779f55 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 cd0fd2cd165b..5f7903e8eabd 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) $(LDFLAGS) -o $@ $<
+ $(QUIET_LINK)$(HOSTCC) $(KBUILD_HOSTLDFLAGS) $(LDFLAGS) -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-07 01:09:44

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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]>
---
This was another one where I couldn't tell of the use of LDFLAGS was a
typo or intentional, hence keeping both.
---
tools/build/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index 5eb4b5ad79cb..cd0fd2cd165b 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) $(LDFLAGS) -o $@ $<

FORCE:

--
2.17.1


2018-07-07 01:10:28

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 3/7] 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]>
---
Makefile | 4 ++--
arch/alpha/boot/Makefile | 2 +-
arch/s390/tools/Makefile | 4 ++--
arch/x86/tools/Makefile | 4 ++--
net/bpfilter/Makefile | 2 +-
samples/bpf/Makefile | 26 +++++++++++++-------------
samples/connector/Makefile | 2 +-
samples/hidraw/Makefile | 2 +-
samples/seccomp/Makefile | 24 ++++++++++++------------
samples/statx/Makefile | 2 +-
samples/uhid/Makefile | 2 +-
scripts/Kbuild.include | 2 +-
scripts/Makefile | 4 ++--
scripts/Makefile.host | 4 ++--
scripts/dtc/Makefile | 24 ++++++++++++------------
scripts/genksyms/Makefile | 4 ++--
scripts/kconfig/Makefile | 12 ++++++------
tools/build/Build.include | 2 +-
tools/objtool/Makefile | 2 +-
19 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/Makefile b/Makefile
index d15ac32afbaf..16cab22b1f40 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/arch/s390/tools/Makefile b/arch/s390/tools/Makefile
index 48cdac1143a9..40afcebf4e67 100644
--- a/arch/s390/tools/Makefile
+++ b/arch/s390/tools/Makefile
@@ -14,8 +14,8 @@ kapi: $(kapi-hdrs-y)
hostprogs-y += gen_facilities
hostprogs-y += gen_opcode_table

-HOSTCFLAGS_gen_facilities.o += -Wall $(LINUXINCLUDE)
-HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)
+KBUILD_HOSTCFLAGS_gen_facilities.o += -Wall $(LINUXINCLUDE)
+KBUILD_HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)

# Ensure output directory exists
_dummy := $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index 09af7ff53044..140de7589aa2 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -29,9 +29,9 @@ posttest: $(obj)/insn_decoder_test vmlinux $(obj)/insn_sanity
hostprogs-y += insn_decoder_test insn_sanity

# -I needed for generated C source and C source which in the kernel tree.
-HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/
+KBUILD_HOSTCFLAGS_insn_decoder_test.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/uapi/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/uapi/

-HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/
+KBUILD_HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x86/include/ -I$(srctree)/arch/x86/lib/ -I$(srctree)/include/

# Dependencies are also needed.
$(obj)/insn_decoder_test.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
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..09f90955412e 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -164,21 +164,21 @@ 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/
+KBUILD_HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable
+KBUILD_HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/

-HOSTCFLAGS_trace_output_user.o += -I$(srctree)/tools/lib/bpf/
-HOSTCFLAGS_offwaketime_user.o += -I$(srctree)/tools/lib/bpf/
-HOSTCFLAGS_spintest_user.o += -I$(srctree)/tools/lib/bpf/
-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/
+KBUILD_HOSTCFLAGS_trace_output_user.o += -I$(srctree)/tools/lib/bpf/
+KBUILD_HOSTCFLAGS_offwaketime_user.o += -I$(srctree)/tools/lib/bpf/
+KBUILD_HOSTCFLAGS_spintest_user.o += -I$(srctree)/tools/lib/bpf/
+KBUILD_HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
+KBUILD_HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
+KBUILD_HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/

HOST_LOADLIBES += $(LIBBPF) -lelf
HOSTLOADLIBES_tracex4 += -lrt
diff --git a/samples/connector/Makefile b/samples/connector/Makefile
index fe3c8542ae4a..a29fbe0c93cf 100644
--- a/samples/connector/Makefile
+++ b/samples/connector/Makefile
@@ -9,7 +9,7 @@ endif
# Tell kbuild to always build the programs
always := $(hostprogs-y)

-HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include

all: modules

diff --git a/samples/hidraw/Makefile b/samples/hidraw/Makefile
index dec1b22adf54..67cead2a5f56 100644
--- a/samples/hidraw/Makefile
+++ b/samples/hidraw/Makefile
@@ -5,6 +5,6 @@ hostprogs-y := hid-example
# Tell kbuild to always build the programs
always := $(hostprogs-y)

-HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_hid-example.o += -I$(objtree)/usr/include

all: hid-example
diff --git a/samples/seccomp/Makefile b/samples/seccomp/Makefile
index ba942e3ead89..59eda1340859 100644
--- a/samples/seccomp/Makefile
+++ b/samples/seccomp/Makefile
@@ -2,18 +2,18 @@
ifndef CROSS_COMPILE
hostprogs-$(CONFIG_SAMPLE_SECCOMP) := bpf-fancy dropper bpf-direct

-HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include
-HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include
-HOSTCFLAGS_bpf-helper.o += -I$(objtree)/usr/include
-HOSTCFLAGS_bpf-helper.o += -idirafter $(objtree)/include
+KBUILD_HOSTCFLAGS_bpf-fancy.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_bpf-fancy.o += -idirafter $(objtree)/include
+KBUILD_HOSTCFLAGS_bpf-helper.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_bpf-helper.o += -idirafter $(objtree)/include
bpf-fancy-objs := bpf-fancy.o bpf-helper.o

-HOSTCFLAGS_dropper.o += -I$(objtree)/usr/include
-HOSTCFLAGS_dropper.o += -idirafter $(objtree)/include
+KBUILD_HOSTCFLAGS_dropper.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_dropper.o += -idirafter $(objtree)/include
dropper-objs := dropper.o

-HOSTCFLAGS_bpf-direct.o += -I$(objtree)/usr/include
-HOSTCFLAGS_bpf-direct.o += -idirafter $(objtree)/include
+KBUILD_HOSTCFLAGS_bpf-direct.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_bpf-direct.o += -idirafter $(objtree)/include
bpf-direct-objs := bpf-direct.o

# Try to match the kernel target.
@@ -26,10 +26,10 @@ else
MFLAG = -m31
endif

-HOSTCFLAGS_bpf-direct.o += $(MFLAG)
-HOSTCFLAGS_dropper.o += $(MFLAG)
-HOSTCFLAGS_bpf-helper.o += $(MFLAG)
-HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
+KBUILD_HOSTCFLAGS_bpf-direct.o += $(MFLAG)
+KBUILD_HOSTCFLAGS_dropper.o += $(MFLAG)
+KBUILD_HOSTCFLAGS_bpf-helper.o += $(MFLAG)
+KBUILD_HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
HOSTLOADLIBES_bpf-direct += $(MFLAG)
HOSTLOADLIBES_bpf-fancy += $(MFLAG)
HOSTLOADLIBES_dropper += $(MFLAG)
diff --git a/samples/statx/Makefile b/samples/statx/Makefile
index 59df7c25a9d1..e22a682a9fa0 100644
--- a/samples/statx/Makefile
+++ b/samples/statx/Makefile
@@ -4,4 +4,4 @@ hostprogs-$(CONFIG_SAMPLE_STATX) := test-statx
# Tell kbuild to always build the programs
always := $(hostprogs-y)

-HOSTCFLAGS_test-statx.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_test-statx.o += -I$(objtree)/usr/include
diff --git a/samples/uhid/Makefile b/samples/uhid/Makefile
index 8d7fd6190ac4..aa77a2fa063a 100644
--- a/samples/uhid/Makefile
+++ b/samples/uhid/Makefile
@@ -4,4 +4,4 @@ hostprogs-y := uhid-example
# Tell kbuild to always build the programs
always := $(hostprogs-y)

-HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include
+KBUILD_HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include
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 b/scripts/Makefile
index 25ab143cbe14..43dad0e066ac 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -20,8 +20,8 @@ hostprogs-$(CONFIG_MODULE_SIG) += sign-file
hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert

-HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
-HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
+KBUILD_HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
+KBUILD_HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
HOSTLOADLIBES_sign-file = -lcrypto
HOSTLOADLIBES_extract-cert = -lcrypto

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index aa971cc3f339..7a4c90f2b0ce 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -62,8 +62,8 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
#####
# Handle options to gcc. Support building with separate output directory

-_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
- $(HOSTCFLAGS_$(basetarget).o)
+_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
+ $(KBUILD_HOSTCFLAGS_$(basetarget).o)
_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
$(HOSTCXXFLAGS_$(basetarget).o)

diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 9cac65b7419c..b85ff7234e7c 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -10,20 +10,20 @@ dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o

# Source files need to get at the userspace version of libfdt_env.h to compile

-HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
+KBUILD_HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt

-HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_checks.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_data.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_dtc.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_flattree.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_fstree.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_livetree.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_srcpos.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_treesource.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_util.o := $(KBUILD_HOSTCFLAGS_DTC)

-HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
-HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_dtc-lexer.lex.o := $(KBUILD_HOSTCFLAGS_DTC)
+KBUILD_HOSTCFLAGS_dtc-parser.tab.o := $(KBUILD_HOSTCFLAGS_DTC)

# dependencies on generated files need to be listed explicitly
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index 03b7ce97de14..001ae41baa26 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -31,8 +31,8 @@ $(obj)/parse.tab.h: $(src)/parse.y FORCE
endif

# -I needed for generated C source (shipped source)
-HOSTCFLAGS_parse.tab.o := -I$(src)
-HOSTCFLAGS_lex.lex.o := -I$(src)
+KBUILD_HOSTCFLAGS_parse.tab.o := -I$(src)
+KBUILD_HOSTCFLAGS_lex.lex.o := -I$(src)

# dependencies on generated files need to be listed explicitly
$(obj)/lex.lex.o: $(obj)/parse.tab.h
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index a3ac2c91331c..f98a22618e1f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -162,16 +162,16 @@ hostprogs-y := conf
targets += zconf.lex.c

# generated files seem to need this to find local include files
-HOSTCFLAGS_zconf.lex.o := -I$(src)
-HOSTCFLAGS_zconf.tab.o := -I$(src)
+KBUILD_HOSTCFLAGS_zconf.lex.o := -I$(src)
+KBUILD_HOSTCFLAGS_zconf.tab.o := -I$(src)

# nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf
nconf-objs := nconf.o zconf.tab.o nconf.gui.o

HOSTLOADLIBES_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)
+KBUILD_HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
+KBUILD_HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)

$(obj)/nconf.o: $(obj)/.nconf-cfg

@@ -182,7 +182,7 @@ mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))

HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
$(foreach f, mconf.o $(lxdialog), \
- $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
+ $(eval KBUILD_HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))

$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg

@@ -207,7 +207,7 @@ hostprogs-y += gconf
gconf-objs := gconf.o zconf.tab.o

HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
-HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
+KBUILD_HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)

$(obj)/gconf.o: $(obj)/.gconf-cfg

diff --git a/tools/build/Build.include b/tools/build/Build.include
index b5c679cd441c..84e688bbb122 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" $(KBUILD_HOSTCFLAGS_$(basetarget).o) $(KBUILD_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-07 01:11:01

by Laura Abbott

[permalink] [raw]
Subject: [PATCH 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]>
---
This seemed like a typo to the best of my understanding and certain
things wouldn't link properly until this was fixed.
---
tools/build/Build.include | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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


2018-07-08 02:33:12

by Masahiro Yamada

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

2018-07-07 10:07 GMT+09:00 Laura Abbott <[email protected]>:
>
> 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]>
> ---
> Makefile | 4 ++--
> scripts/Makefile.host | 4 ++--
> scripts/kconfig/Makefile | 2 +-
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 16cab22b1f40..9c3f1864d678 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 7a4c90f2b0ce..1c153cc5b530 100644
> --- a/scripts/Makefile.host
> +++ b/scripts/Makefile.host
> @@ -64,8 +64,8 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
>
> _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
> $(KBUILD_HOSTCFLAGS_$(basetarget).o)
> -_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
> - $(HOSTCXXFLAGS_$(basetarget).o)
> +_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
> + $(KBUILD_HOSTCXXFLAGS_$(basetarget).o)
>
> ifeq ($(KBUILD_SRC),)
> __hostc_flags = $(_hostc_flags)
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index f98a22618e1f..37605d92c597 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -192,7 +192,7 @@ qconf-cxxobjs := qconf.o
> qconf-objs := zconf.tab.o
>
> HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
> -HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
> +KBUILD_HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)


Please keep HOSTCXXFLAGS_<file>.o as-is.





--
Best Regards
Masahiro Yamada

2018-07-08 02:33:12

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 3/7] treewide: Rename HOSTCFLAGS -> KBUILD_HOSTCFLAGS

2018-07-07 10:07 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]>
> ---
> Makefile | 4 ++--
> arch/alpha/boot/Makefile | 2 +-
> arch/s390/tools/Makefile | 4 ++--
> arch/x86/tools/Makefile | 4 ++--
> net/bpfilter/Makefile | 2 +-
> samples/bpf/Makefile | 26 +++++++++++++-------------
> samples/connector/Makefile | 2 +-
> samples/hidraw/Makefile | 2 +-
> samples/seccomp/Makefile | 24 ++++++++++++------------
> samples/statx/Makefile | 2 +-
> samples/uhid/Makefile | 2 +-
> scripts/Kbuild.include | 2 +-
> scripts/Makefile | 4 ++--
> scripts/Makefile.host | 4 ++--
> scripts/dtc/Makefile | 24 ++++++++++++------------
> scripts/genksyms/Makefile | 4 ++--
> scripts/kconfig/Makefile | 12 ++++++------
> tools/build/Build.include | 2 +-
> tools/objtool/Makefile | 2 +-
> 19 files changed, 64 insertions(+), 64 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d15ac32afbaf..16cab22b1f40 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/arch/s390/tools/Makefile b/arch/s390/tools/Makefile
> index 48cdac1143a9..40afcebf4e67 100644
> --- a/arch/s390/tools/Makefile
> +++ b/arch/s390/tools/Makefile
> @@ -14,8 +14,8 @@ kapi: $(kapi-hdrs-y)
> hostprogs-y += gen_facilities
> hostprogs-y += gen_opcode_table
>
> -HOSTCFLAGS_gen_facilities.o += -Wall $(LINUXINCLUDE)
> -HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)
> +KBUILD_HOSTCFLAGS_gen_facilities.o += -Wall $(LINUXINCLUDE)
> +KBUILD_HOSTCFLAGS_gen_opcode_table.o += -Wall $(LINUXINCLUDE)


No.
Please keep HOSTCFLAGS_<file>.o as-is.




--
Best Regards
Masahiro Yamada

2018-07-08 02:33:51

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 6/7] treewide: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS

2018-07-07 10:07 GMT+09:00 Laura Abbott <[email protected]>:
> In preparation for enabling command line LDLIBS, re-name HOST_LOADLIBES to
> KBUILD_HOSTLDLIBS as the internal use only flags. This should not have any
> visible effects.
>
> Signed-off-by: Laura Abbott <[email protected]>
> ---
> Makefile | 4 ++--
> samples/bpf/Makefile | 2 +-
> scripts/Makefile.host | 10 +++++-----
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 319736b80016..d925af1fb11b 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 09f90955412e..c20fb2fa9c37 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -180,7 +180,7 @@ KBUILD_HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/
> KBUILD_HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/
> KBUILD_HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/
>
> -HOST_LOADLIBES += $(LIBBPF) -lelf
> +KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf
> HOSTLOADLIBES_tracex4 += -lrt
> HOSTLOADLIBES_trace_output += -lrt
> HOSTLOADLIBES_map_perf_test += -lrt
> diff --git a/scripts/Makefile.host b/scripts/Makefile.host
> index 07acf5779f55..7b784413d921 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) $(HOSTLOADLIBES_$(@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) $(HOSTLOADLIBES_$(@F))


For consistency, please rename
$(HOSTLOADLIBES_$(@F))
to
$(HOSTLDLIBS_$(@F))






--
Best Regards
Masahiro Yamada

2018-07-08 02:34:45

by Masahiro Yamada

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

2018-07-07 10:07 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]>
> ---
> Makefile | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d925af1fb11b..77c74b3cf30b 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) $(HOST_LOADLIBES)


Please use HOSTLDLIBS instead of HOST_LOADLIBES.

All of these must be documented in Documentation/kbuild/kbuild.txt





--
Best Regards
Masahiro Yamada

2018-07-08 10:56:14

by Jiri Olsa

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

On Fri, Jul 06, 2018 at 06:07:04PM -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]>
> ---
> This was another one where I couldn't tell of the use of LDFLAGS was a
> typo or intentional, hence keeping both.

I think the replacement (using just HOSTLDFLAGS) should
be the correct fix, moreover fixdep doesn't have any special
link requirements

thanks,
jirka


> ---
> tools/build/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/build/Makefile b/tools/build/Makefile
> index 5eb4b5ad79cb..cd0fd2cd165b 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) $(LDFLAGS) -o $@ $<
>
> FORCE:
>
> --
> 2.17.1
>

2018-07-08 11:01:30

by Jiri Olsa

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

On Fri, Jul 06, 2018 at 06:07:03PM -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]>
> ---
> This seemed like a typo to the best of my understanding and certain
> things wouldn't link properly until this was fixed.

ugh, thanks for finding this.. I think/hope it's typo ;-)

please also change the only perf user of this:

tools/perf/pmu-events/Build:CHOSTFLAGS_jevents.o = -I$(srctree)/tools/include

jirka

> ---
> tools/build/Build.include | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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))
> --
> 2.17.1
>