tools: Various build flags fixes
Subsystems (4)
v2 cover tools: Various build flags fixes
hi,
while hardening some of the tools rpm, we noticed we can't pass build flags to some of them.
Sending separate tools fixes for what we found. It's mostly override for CFLAGS and adding LDFLAGS to the build commands.
v2 changes:
- 4 patches already accepted, still 6 to go ;-)
- adding more people to cc
Also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
tools/flags
thanks,
jirka
---
Jiri Olsa (6):
tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command tools thermal tmon: Override CFLAGS assignments
tools thermal tmon: Use -O3 instead of -O1 if available
tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command tools iio: Override CFLAGS assignments
tools gpio: Override CFLAGS assignments
tools/gpio/Makefile | 2 +- tools/iio/Makefile | 2 +- tools/power/x86/turbostat/Makefile | 8 ++++---- tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++--- tools/thermal/tmon/Makefile | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-)
PATCH v2 1/6 tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command
So user could specify outside CFLAGS/LDFLAGS values.
--- tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/power/x86/x86_energy_perf_policy/Makefile +3 -3
@@ -9,12 +9,12 @@ ifeq ("$(origin O)", "command line") endif x86_energy_perf_policy : x86_energy_perf_policy.c -CFLAGS += -Wall -CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +override CFLAGS += -Wall +override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' %: %.c @mkdir -p $(BUILD_OUTPUT) - $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) .PHONY : clean clean :
Signature · 1 line
2.17.2
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command
tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command
Commit-ID: f1770e3ca4ec10ce43825de2f855a1831c711195 Gitweb: https://git.kernel.org/tip/f1770e3ca4ec10ce43825de2f855a1831c711195 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 12 Oct 2018 07:20:16 -0400 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 28 Dec 2018 16:33:07 -0300
tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command
So user could specify outside CFLAGS/LDFLAGS values.
--- tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/power/x86/x86_energy_perf_policy/Makefile +3 -3
@@ -9,12 +9,12 @@ ifeq ("$(origin O)", "command line") endif x86_energy_perf_policy : x86_energy_perf_policy.c -CFLAGS += -Wall -CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +override CFLAGS += -Wall +override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' %: %.c @mkdir -p $(BUILD_OUTPUT) - $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) .PHONY : clean clean :
PATCH v2 2/6 tools thermal tmon: Override CFLAGS assignments
In reply to Jiri OlsaSo user could specify outside CFLAGS values.
--- tools/thermal/tmon/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/thermal/tmon/Makefile +4 -4
@@ -6,13 +6,13 @@ VERSION = 1.0 BINDIR=usr/bin WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS+= -O1 ${WARNFLAGS} +override CFLAGS+= -O1 ${WARNFLAGS} # Add "-fstack-protector" only if toolchain supports it. -CFLAGS+= $(call cc-option,-fstack-protector) +override CFLAGS+= $(call cc-option,-fstack-protector-strong) CC?= $(CROSS_COMPILE)gcc PKG_CONFIG?= pkg-config -CFLAGS+=-D VERSION=\"$(VERSION)\" +override CFLAGS+=-D VERSION=\"$(VERSION)\" LDFLAGS+= TARGET=tmon
@@ -29,7 +29,7 @@ TMON_LIBS += $(shell $(PKG_CONFIG) --libs $(STATIC) panelw ncursesw 2> /dev/null $(PKG_CONFIG) --libs $(STATIC) panel ncurses 2> /dev/null || \ echo -lpanel -lncurses) -CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \ +override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \ $(PKG_CONFIG) --cflags $(STATIC) panel ncurses 2> /dev/null) OBJS = tmon.o tui.o sysfs.o pid.o
Signature · 1 line
2.17.2
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] tools thermal tmon: Allow overriding CFLAGS assignments
tools thermal tmon: Allow overriding CFLAGS assignments
Commit-ID: ad6b474f445e587e9b56ec44241b1639bccf6738 Gitweb: https://git.kernel.org/tip/ad6b474f445e587e9b56ec44241b1639bccf6738 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 12 Dec 2018 11:25:33 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 28 Dec 2018 16:33:08 -0300
tools thermal tmon: Allow overriding CFLAGS assignments
So that the user can provide, e.g. distro package alternative values.
--- tools/thermal/tmon/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/thermal/tmon/Makefile +4 -4
@@ -6,13 +6,13 @@ VERSION = 1.0 BINDIR=usr/bin WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS+= -O1 ${WARNFLAGS} +override CFLAGS+= -O1 ${WARNFLAGS} # Add "-fstack-protector" only if toolchain supports it. -CFLAGS+= $(call cc-option,-fstack-protector) +override CFLAGS+= $(call cc-option,-fstack-protector-strong) CC?= $(CROSS_COMPILE)gcc PKG_CONFIG?= pkg-config -CFLAGS+=-D VERSION=\"$(VERSION)\" +override CFLAGS+=-D VERSION=\"$(VERSION)\" LDFLAGS+= TARGET=tmon
@@ -29,7 +29,7 @@ TMON_LIBS += $(shell $(PKG_CONFIG) --libs $(STATIC) panelw ncursesw 2> /dev/null $(PKG_CONFIG) --libs $(STATIC) panel ncurses 2> /dev/null || \ echo -lpanel -lncurses) -CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \ +override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \ $(PKG_CONFIG) --cflags $(STATIC) panel ncurses 2> /dev/null) OBJS = tmon.o tui.o sysfs.o pid.o
PATCH v2 3/6 tools thermal tmon: Use -O3 instead of -O1 if available
In reply to Jiri OlsaUsing -O3 instead of -O1 if it's supported by compiler.
--- tools/thermal/tmon/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/tmon/Makefile +1 -1
@@ -6,7 +6,7 @@ VERSION = 1.0 BINDIR=usr/bin WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -override CFLAGS+= -O1 ${WARNFLAGS} +override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS} # Add "-fstack-protector" only if toolchain supports it. override CFLAGS+= $(call cc-option,-fstack-protector-strong) CC?= $(CROSS_COMPILE)gcc
Signature · 1 line
2.17.2
PATCH v2 4/6 tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command
In reply to Jiri OlsaSo user could specify outside CFLAGS/LDFLAGS values.
--- tools/power/x86/turbostat/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/power/x86/turbostat/Makefile +4 -4
@@ -9,13 +9,13 @@ ifeq ("$(origin O)", "command line") endif turbostat : turbostat.c -CFLAGS += -Wall -CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' -CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' +override CFLAGS += -Wall +override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' %: %.c @mkdir -p $(BUILD_OUTPUT) - $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) .PHONY : clean clean :
Signature · 1 line
2.17.2
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command
tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command
Commit-ID: 6b7f98a37ac63fe94e84a5289962457b4b504a8d Gitweb: https://git.kernel.org/tip/6b7f98a37ac63fe94e84a5289962457b4b504a8d Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 12 Dec 2018 11:25:35 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 28 Dec 2018 16:33:08 -0300
tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command
So that the user can specify outside CFLAGS/LDFLAGS values.
--- tools/power/x86/turbostat/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/power/x86/turbostat/Makefile +4 -4
@@ -9,13 +9,13 @@ ifeq ("$(origin O)", "command line") endif turbostat : turbostat.c -CFLAGS += -Wall -CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' -CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' +override CFLAGS += -Wall +override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' +override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' %: %.c @mkdir -p $(BUILD_OUTPUT) - $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ + $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) .PHONY : clean clean :
PATCH v2 5/6 tools iio: Override CFLAGS assignments
In reply to Jiri OlsaSo user could specify outside CFLAGS values.
--- tools/iio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/iio/Makefile +1 -1
@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Signature · 1 line
2.17.2
Jonathan Cameron
maintainerRe: [PATCH 5/6] tools iio: Override CFLAGS assignments
Quoted 7 lines · On Wed, 12 Dec 2018 11:25:36 +0100 Jiri Olsa <[email protected]> wrote:
So user could specify outside CFLAGS values.
Cc Andy Shevchenko <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Jiri Olsa <[email protected]>
Sorry. I must have failed to reply. I applied this from previous version. It's in Linux next - I just checked.
Jonathan
Quoted 17 lines
--- tools/iio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/iio/Makefile +1
-1@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := iio_event_monitor lsiio iio_generic_buffer ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Re: [PATCH 5/6] tools iio: Override CFLAGS assignments
Quoted 5 lines · Jonathan Cameron
Quoted 2 lines · On Wed, 12 Dec 2018 11:25:36 +0100 Jiri Olsa <[email protected]> wrote:
So user could specify outside CFLAGS values.
Quoted 8 lines
Quoted 5 lines
Cc Andy Shevchenko <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Jiri Olsa <[email protected]>Sorry. I must have failed to reply. I applied this from previous version. It's in Linux next - I just checked.
great, thanks
jirka
PATCH v2 6/6 tools gpio: Override CFLAGS assignments
In reply to Jiri OlsaSo user could specify outside CFLAGS values.
--- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/gpio/Makefile +1 -1
@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Signature · 1 line
2.17.2
Re: [PATCH 6/6] tools gpio: Override CFLAGS assignments
Quoted 1 line · Jiri Olsa
So user could specify outside CFLAGS values.
For all three where I'm in Cc list
Quoted 26 lines
Cc Andy Shevchenko <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Jiri Olsa <[email protected]>--- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/gpio/Makefile +1
-1@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))Signature · 1 line
2.17.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 6/6] tools gpio: Override CFLAGS assignments
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Jiri Olsa
So user could specify outside CFLAGS values.
For all three where I'm in Cc list
Reviewed-by Andy Shevchenko <[email protected]>
thanks, I should have cc-ed you on all of them ;-)
any idea who could I ask to pull these in?
thanks,
jirka
Quoted 33 lines
Quoted 27 lines
Cc Andy Shevchenko <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Jiri Olsa <[email protected]>--- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/gpio/Makefile +1
-1@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))Signature · 1 line
2.17.2Signature · 2 lines
With Best Regards, Andy Shevchenko
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] tools gpio: Allow overriding CFLAGS
In reply to Jiri Olsatools gpio: Allow overriding CFLAGS
Commit-ID: 4ccc98a48958da9f89beb71c66a4e05468727951 Gitweb: https://git.kernel.org/tip/4ccc98a48958da9f89beb71c66a4e05468727951 Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 12 Dec 2018 11:25:37 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 28 Dec 2018 16:33:08 -0300
tools gpio: Allow overriding CFLAGS
So that the user can specify outside CFLAGS values.
--- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/gpio/Makefile +1 -1
@@ -12,7 +12,7 @@ endif # (this improves performance and avoids hard-to-debug behaviour); MAKEFLAGS += -r -CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include +override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))