2018-10-16 15:08:37

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 00/10] 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.

thanks,
jirka


Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Hartmut Knaack <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Markus Mayer <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Signed-off-by: Len Brown <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Thomas Renninger <[email protected]>
Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: Zhang Rui <[email protected]>
---
Jiri Olsa (10):
tools lib traceevent: Use LDFLAGS in the build commands
tools perf: Pass build flags to traceevent build
tools cpupower debug: Allow to use outside build flags
tools cpupower: Override CFLAGS assignments
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/lib/traceevent/Makefile | 4 ++--
tools/perf/Makefile.perf | 2 +-
tools/power/cpupower/Makefile | 12 ++++++------
tools/power/cpupower/debug/x86_64/Makefile | 4 ++--
tools/power/x86/turbostat/Makefile | 8 ++++----
tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++---
tools/thermal/tmon/Makefile | 8 ++++----
9 files changed, 24 insertions(+), 24 deletions(-)


2018-10-16 15:07:50

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 02/10] tools perf: Pass build flags to traceevent build

So the extra user build flags are propagated to libtraceevent.

Cc: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index b3006e9666d0..b71e0b50c09f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -630,7 +630,7 @@ endif

$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)

-LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
+LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(LDFLAGS)'

$(LIBTRACEEVENT): FORCE
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a
--
2.17.2


2018-10-16 15:08:08

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 03/10] tools cpupower debug: Allow to use outside build flags

Adding CFLAGS and LDFLAGS to be used during the build.

Cc: Thomas Renninger <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/power/cpupower/debug/x86_64/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/power/cpupower/debug/x86_64/Makefile b/tools/power/cpupower/debug/x86_64/Makefile
index 59af84b8ef45..b1b6c43644e7 100644
--- a/tools/power/cpupower/debug/x86_64/Makefile
+++ b/tools/power/cpupower/debug/x86_64/Makefile
@@ -13,10 +13,10 @@ INSTALL = /usr/bin/install
default: all

$(OUTPUT)centrino-decode: ../i386/centrino-decode.c
- $(CC) $(CFLAGS) -o $@ $<
+ $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<

$(OUTPUT)powernow-k8-decode: ../i386/powernow-k8-decode.c
- $(CC) $(CFLAGS) -o $@ $<
+ $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $<

all: $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode

--
2.17.2


2018-10-16 15:08:30

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 08/10] tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command

So user could specify outside CFLAGS/LDFLAGS values.

Cc: Len Brown <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/power/x86/turbostat/Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
index 2ab25aa38263..1598b4fa0b11 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
@@ -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 :
--
2.17.2


2018-10-16 15:08:33

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 01/10] tools lib traceevent: Use LDFLAGS in the build commands

So user could specify outside LDFLAGS values.

Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/lib/traceevent/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 0b4e833088a4..e535073c94ce 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -174,7 +174,7 @@ $(TE_IN): force
$(Q)$(MAKE) $(build)=libtraceevent

$(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
- $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+ $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
@ln -sf $(@F) $(OUTPUT)libtraceevent.so
@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)

@@ -193,7 +193,7 @@ $(PLUGINS_IN): force
$(Q)$(MAKE) $(build)=$(plugin_obj)

$(OUTPUT)%.so: $(OUTPUT)%-in.o
- $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
+ $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^

define make_version.h
(echo '/* This file is automatically generated. Do not modify. */'; \
--
2.17.2


2018-10-16 15:08:37

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 09/10] tools iio: Override CFLAGS assignments

So user could specify outside CFLAGS values.

Cc: Jonathan Cameron <[email protected]>
Cc: Hartmut Knaack <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/iio/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/iio/Makefile b/tools/iio/Makefile
index 332ed2f6c2c2..e22378dba244 100644
--- a/tools/iio/Makefile
+++ b/tools/iio/Makefile
@@ -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))
--
2.17.2


2018-10-16 15:08:41

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 07/10] tools thermal tmon: Use -O3 instead of -O1 if available

Using -O3 instead of -O1 if it's supported by compiler.

Cc: Zhang Rui <[email protected]>
Cc: Markus Mayer <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/thermal/tmon/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 89a2444c1df2..59e417ec3e13 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -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
--
2.17.2


2018-10-16 15:09:02

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 06/10] tools thermal tmon: Override CFLAGS assignments

So user could specify outside CFLAGS values.

Cc: Zhang Rui <[email protected]>
Cc: Markus Mayer <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/thermal/tmon/Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 735a510230c3..89a2444c1df2 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -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
--
2.17.2


2018-10-16 15:09:12

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 05/10] tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command

So user could specify outside CFLAGS/LDFLAGS values.

Cc: Signed-off-by: Len Brown <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/power/x86/x86_energy_perf_policy/Makefile b/tools/power/x86/x86_energy_perf_policy/Makefile
index f4534fb8b951..ae7a0e09b722 100644
--- a/tools/power/x86/x86_energy_perf_policy/Makefile
+++ b/tools/power/x86/x86_energy_perf_policy/Makefile
@@ -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 :
--
2.17.2


2018-10-16 15:09:20

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 04/10] tools cpupower: Override CFLAGS assignments

So user could specify outside CFLAGS values.

Cc: Thomas Renninger <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/power/cpupower/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 1dd5f4fcffd5..db66a952c173 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -129,7 +129,7 @@ WARNINGS += $(call cc-supports,-Wno-pointer-sign)
WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
WARNINGS += -Wshadow

-CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
+override CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" -D_GNU_SOURCE

UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \
@@ -156,12 +156,12 @@ LIB_SRC = lib/cpufreq.c lib/cpupower.c lib/cpuidle.c
LIB_OBJS = lib/cpufreq.o lib/cpupower.o lib/cpuidle.o
LIB_OBJS := $(addprefix $(OUTPUT),$(LIB_OBJS))

-CFLAGS += -pipe
+override CFLAGS += -pipe

ifeq ($(strip $(NLS)),true)
INSTALL_NLS += install-gmo
COMPILE_NLS += create-gmo
- CFLAGS += -DNLS
+ override CFLAGS += -DNLS
endif

ifeq ($(strip $(CPUFREQ_BENCH)),true)
@@ -175,7 +175,7 @@ ifeq ($(strip $(STATIC)),true)
UTIL_SRC += $(LIB_SRC)
endif

-CFLAGS += $(WARNINGS)
+override CFLAGS += $(WARNINGS)

ifeq ($(strip $(V)),false)
QUIET=@
@@ -188,10 +188,10 @@ export QUIET ECHO

# if DEBUG is enabled, then we do not strip or optimize
ifeq ($(strip $(DEBUG)),true)
- CFLAGS += -O1 -g -DDEBUG
+ override CFLAGS += -O1 -g -DDEBUG
STRIPCMD = /bin/true -Since_we_are_debugging
else
- CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
+ override CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
endif

--
2.17.2


2018-10-16 15:24:26

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Tue, 16 Oct 2018 17:06:06 +0200
Jiri Olsa <[email protected]> wrote:

> So user could specify outside LDFLAGS values.
>
> Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/lib/traceevent/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 0b4e833088a4..e535073c94ce 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -174,7 +174,7 @@ $(TE_IN): force
> $(Q)$(MAKE) $(build)=libtraceevent
>
> $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
>
> @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> $(Q)$(MAKE) $(build)=$(plugin_obj)
>
> $(OUTPUT)%.so: $(OUTPUT)%-in.o
> - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^


I'm guessing that the CFLAGS are not needed here, but shouldn't that
also be mentioned in the change log?

-- Steve


>
> define make_version.h
> (echo '/* This file is automatically generated. Do not modify. */'; \


2018-10-16 15:46:28

by Jiri Olsa

[permalink] [raw]
Subject: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> On Tue, 16 Oct 2018 17:06:06 +0200
> Jiri Olsa <[email protected]> wrote:
>
> > So user could specify outside LDFLAGS values.
> >
> > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > Cc: Steven Rostedt <[email protected]>
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> > tools/lib/traceevent/Makefile | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> > index 0b4e833088a4..e535073c94ce 100644
> > --- a/tools/lib/traceevent/Makefile
> > +++ b/tools/lib/traceevent/Makefile
> > @@ -174,7 +174,7 @@ $(TE_IN): force
> > $(Q)$(MAKE) $(build)=libtraceevent
> >
> > $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> > - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> > @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
> >
> > @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> > $(Q)$(MAKE) $(build)=$(plugin_obj)
> >
> > $(OUTPUT)%.so: $(OUTPUT)%-in.o
> > - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> > + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^
>
>
> I'm guessing that the CFLAGS are not needed here, but shouldn't that
> also be mentioned in the change log?

yep, sry.. v2 attached

thanks,
jirka


---
So user could specify outside LDFLAGS values.

Also moving out CFLAGS from link command,
because it's not needed there.

Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/lib/traceevent/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 0b4e833088a4..e535073c94ce 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -174,7 +174,7 @@ $(TE_IN): force
$(Q)$(MAKE) $(build)=libtraceevent

$(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
- $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+ $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
@ln -sf $(@F) $(OUTPUT)libtraceevent.so
@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)

@@ -193,7 +193,7 @@ $(PLUGINS_IN): force
$(Q)$(MAKE) $(build)=$(plugin_obj)

$(OUTPUT)%.so: $(OUTPUT)%-in.o
- $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
+ $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^

define make_version.h
(echo '/* This file is automatically generated. Do not modify. */'; \
--
2.17.2


2018-10-17 13:24:00

by Thomas Renninger

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
> 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.

Looks fine for the cpupower patches 3/10 and 4/10.
(Feel free to add a Reviewed-by or Acked-by for them
if you have to resend).

Thanks,

Thomas

2018-10-17 14:24:42

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Tue, 16 Oct 2018 17:45:26 +0200
Jiri Olsa <[email protected]> wrote:

> On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> > On Tue, 16 Oct 2018 17:06:06 +0200
> > Jiri Olsa <[email protected]> wrote:
> >
> > > So user could specify outside LDFLAGS values.
> > >
> > > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > > Cc: Steven Rostedt <[email protected]>
> > > Signed-off-by: Jiri Olsa <[email protected]>
> > > ---
> > > tools/lib/traceevent/Makefile | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> > > index 0b4e833088a4..e535073c94ce 100644
> > > --- a/tools/lib/traceevent/Makefile
> > > +++ b/tools/lib/traceevent/Makefile
> > > @@ -174,7 +174,7 @@ $(TE_IN): force
> > > $(Q)$(MAKE) $(build)=libtraceevent
> > >
> > > $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> > > - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
> > >
> > > @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> > > $(Q)$(MAKE) $(build)=$(plugin_obj)
> > >
> > > $(OUTPUT)%.so: $(OUTPUT)%-in.o
> > > - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> > > + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^
> >
> >
> > I'm guessing that the CFLAGS are not needed here, but shouldn't that
> > also be mentioned in the change log?
>
> yep, sry.. v2 attached
>

Acked-by: Steven Rostedt (VMware) <[email protected]>

-- Steve

2018-10-17 15:29:45

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On 10/17/2018 07:23 AM, Thomas Renninger wrote:
> On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
>> 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.
>
> Looks fine for the cpupower patches 3/10 and 4/10.
> (Feel free to add a Reviewed-by or Acked-by for them
> if you have to resend).
>

Thanks Thomas.

Hi Jiri,

Same here for cpupower patches 3/10 and 4/10. Please let me know
if you would like me to take these through the cpupower patch flow.

Acked-by: Shuah Khan <[email protected]>

thanks,
-- Shuah


Subject: [tip:perf/urgent] perf tools: Pass build flags to traceevent build

Commit-ID: 298faf53200fc02af38d32715697df6e661c1257
Gitweb: https://git.kernel.org/tip/298faf53200fc02af38d32715697df6e661c1257
Author: Jiri Olsa <[email protected]>
AuthorDate: Tue, 16 Oct 2018 17:06:07 +0200
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 16 Oct 2018 14:57:59 -0300

perf tools: Pass build flags to traceevent build

So the extra user build flags are propagated to libtraceevent.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: "Herton R. Krzesinski" <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: Yordan Karadzhov (VMware) <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5224ade3d5af..0be411695379 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -635,7 +635,7 @@ $(LIBPERF_IN): prepare FORCE
$(LIB_FILE): $(LIBPERF_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)

-LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
+LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(LDFLAGS)'

$(LIBTRACEEVENT): FORCE
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a

2018-10-21 12:27:57

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 09/10] tools iio: Override CFLAGS assignments

On Tue, 16 Oct 2018 17:06:14 +0200
Jiri Olsa <[email protected]> wrote:

> So user could specify outside CFLAGS values.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke at them.

Thanks

Jonathan

>
> Cc: Jonathan Cameron <[email protected]>
> Cc: Hartmut Knaack <[email protected]>
> Cc: Lars-Peter Clausen <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/iio/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/iio/Makefile b/tools/iio/Makefile
> index 332ed2f6c2c2..e22378dba244 100644
> --- a/tools/iio/Makefile
> +++ b/tools/iio/Makefile
> @@ -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))


2018-10-22 09:17:20

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On Wed, Oct 17, 2018 at 09:28:16AM -0600, Shuah Khan wrote:
> On 10/17/2018 07:23 AM, Thomas Renninger wrote:
> > On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
> >> 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.
> >
> > Looks fine for the cpupower patches 3/10 and 4/10.
> > (Feel free to add a Reviewed-by or Acked-by for them
> > if you have to resend).
> >
>
> Thanks Thomas.
>
> Hi Jiri,
>
> Same here for cpupower patches 3/10 and 4/10. Please let me know
> if you would like me to take these through the cpupower patch flow.

that would be great, any idea about 5/10?:
tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS

it's power related and I haven't got any reply on that one

thanks,
jirka

2018-10-22 09:17:23

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 09/10] tools iio: Override CFLAGS assignments

On Sun, Oct 21, 2018 at 01:26:34PM +0100, Jonathan Cameron wrote:
> On Tue, 16 Oct 2018 17:06:14 +0200
> Jiri Olsa <[email protected]> wrote:
>
> > So user could specify outside CFLAGS values.
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to poke at them.

thanks,
jirka

>
> Thanks
>
> Jonathan
>
> >
> > Cc: Jonathan Cameron <[email protected]>
> > Cc: Hartmut Knaack <[email protected]>
> > Cc: Lars-Peter Clausen <[email protected]>
> > Signed-off-by: Jiri Olsa <[email protected]>
> > ---
> > tools/iio/Makefile | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/iio/Makefile b/tools/iio/Makefile
> > index 332ed2f6c2c2..e22378dba244 100644
> > --- a/tools/iio/Makefile
> > +++ b/tools/iio/Makefile
> > @@ -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))
>

2018-10-22 14:54:36

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 10/10] tools gpio: Override CFLAGS assignments

On Tue, Oct 16, 2018 at 05:06:05PM +0200, Jiri Olsa wrote:
> 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.
>
> thanks,
> jirka
>
>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Cc: Hartmut Knaack <[email protected]>
> Cc: Jonathan Cameron <[email protected]>
> Cc: Lars-Peter Clausen <[email protected]>
> Cc: Len Brown <[email protected]>
> Cc: Markus Mayer <[email protected]>
> Cc: Shuah Khan <[email protected]>
> Cc: Signed-off-by: Len Brown <[email protected]>
> Cc: Steven Rostedt <[email protected]>
> Cc: Thomas Renninger <[email protected]>
> Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> Cc: Zhang Rui <[email protected]>
> ---
> Jiri Olsa (10):
> tools lib traceevent: Use LDFLAGS in the build commands
> tools perf: Pass build flags to traceevent build
> tools cpupower debug: Allow to use outside build flags
> tools cpupower: Override CFLAGS assignments
> 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

the last one did not get post for some reason,
attaching it now

jirka


---
So user could specify outside CFLAGS values.

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

diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
index 240eda014b37..6ecdd1067826 100644
--- a/tools/gpio/Makefile
+++ b/tools/gpio/Makefile
@@ -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))
--
2.17.2


2018-10-23 15:20:20

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On 10/22/2018 02:51 AM, Jiri Olsa wrote:
> On Wed, Oct 17, 2018 at 09:28:16AM -0600, Shuah Khan wrote:
>> On 10/17/2018 07:23 AM, Thomas Renninger wrote:
>>> On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
>>>> 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.
>>>
>>> Looks fine for the cpupower patches 3/10 and 4/10.
>>> (Feel free to add a Reviewed-by or Acked-by for them
>>> if you have to resend).
>>>
>>
>> Thanks Thomas.
>>
>> Hi Jiri,
>>
>> Same here for cpupower patches 3/10 and 4/10. Please let me know
>> if you would like me to take these through the cpupower patch flow.
>
> that would be great, any idea about 5/10?:
> tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS
>
> it's power related and I haven't got any reply on that one

Len Brown <[email protected]> seem to be the right contact? Len is on this thread.
Adding Rafael as well. He might be able to help you with 5/10 that touches

tools power x86 x86_energy_perf_policy

thanks,
-- Shuah


2018-10-23 16:55:40

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On 10/23/2018 09:17 AM, Shuah Khan wrote:
> On 10/22/2018 02:51 AM, Jiri Olsa wrote:
>> On Wed, Oct 17, 2018 at 09:28:16AM -0600, Shuah Khan wrote:
>>> On 10/17/2018 07:23 AM, Thomas Renninger wrote:
>>>> On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
>>>>> 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.
>>>>
>>>> Looks fine for the cpupower patches 3/10 and 4/10.
>>>> (Feel free to add a Reviewed-by or Acked-by for them
>>>> if you have to resend).
>>>>
>>>
>>> Thanks Thomas.
>>>
>>> Hi Jiri,
>>>
>>> Same here for cpupower patches 3/10 and 4/10. Please let me know
>>> if you would like me to take these through the cpupower patch flow.
>>
>> that would be great, any idea about 5/10?:

3/10 and 4/10 are now in kernel/git/shuah/linux.git cpupower branch and
will be included in my pull request for 4.20-rc1 or rc2 to Rafael.

thanks,
-- Shuah

2018-10-23 17:27:07

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 00/10] tools: Various build flags fixes

On Tue, Oct 23, 2018 at 10:53:42AM -0600, Shuah Khan wrote:
> On 10/23/2018 09:17 AM, Shuah Khan wrote:
> > On 10/22/2018 02:51 AM, Jiri Olsa wrote:
> >> On Wed, Oct 17, 2018 at 09:28:16AM -0600, Shuah Khan wrote:
> >>> On 10/17/2018 07:23 AM, Thomas Renninger wrote:
> >>>> On Tuesday, October 16, 2018 5:06:05 PM CEST Jiri Olsa wrote:
> >>>>> 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.
> >>>>
> >>>> Looks fine for the cpupower patches 3/10 and 4/10.
> >>>> (Feel free to add a Reviewed-by or Acked-by for them
> >>>> if you have to resend).
> >>>>
> >>>
> >>> Thanks Thomas.
> >>>
> >>> Hi Jiri,
> >>>
> >>> Same here for cpupower patches 3/10 and 4/10. Please let me know
> >>> if you would like me to take these through the cpupower patch flow.
> >>
> >> that would be great, any idea about 5/10?:
>
> 3/10 and 4/10 are now in kernel/git/shuah/linux.git cpupower branch and
> will be included in my pull request for 4.20-rc1 or rc2 to Rafael.

cool, thanks

jirka

2018-10-30 09:27:05

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 02/10] tools perf: Pass build flags to traceevent build

PING

On Tue, Oct 16, 2018 at 05:06:07PM +0200, Jiri Olsa wrote:
> So the extra user build flags are propagated to libtraceevent.
>
> Cc: Arnaldo Carvalho de Melo <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/perf/Makefile.perf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index b3006e9666d0..b71e0b50c09f 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -630,7 +630,7 @@ endif
>
> $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
>
> -LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
> +LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
>
> $(LIBTRACEEVENT): FORCE
> $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a
> --
> 2.17.2
>

2018-10-30 09:28:14

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 05/10] tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command

ping

thanks,
jirka

On Tue, Oct 16, 2018 at 05:06:10PM +0200, Jiri Olsa wrote:
> So user could specify outside CFLAGS/LDFLAGS values.
>
> Cc: Signed-off-by: Len Brown <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/power/x86/x86_energy_perf_policy/Makefile | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/power/x86/x86_energy_perf_policy/Makefile b/tools/power/x86/x86_energy_perf_policy/Makefile
> index f4534fb8b951..ae7a0e09b722 100644
> --- a/tools/power/x86/x86_energy_perf_policy/Makefile
> +++ b/tools/power/x86/x86_energy_perf_policy/Makefile
> @@ -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 :
> --
> 2.17.2
>

2018-10-30 09:28:32

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 06/10] tools thermal tmon: Override CFLAGS assignments

ping

thanks,
jirka

On Tue, Oct 16, 2018 at 05:06:11PM +0200, Jiri Olsa wrote:
> So user could specify outside CFLAGS values.
>
> Cc: Zhang Rui <[email protected]>
> Cc: Markus Mayer <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/thermal/tmon/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
> index 735a510230c3..89a2444c1df2 100644
> --- a/tools/thermal/tmon/Makefile
> +++ b/tools/thermal/tmon/Makefile
> @@ -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
> --
> 2.17.2
>

2018-10-30 09:28:54

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 08/10] tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command

ping

thanks,
jirka

On Tue, Oct 16, 2018 at 05:06:13PM +0200, Jiri Olsa wrote:
> So user could specify outside CFLAGS/LDFLAGS values.
>
> Cc: Len Brown <[email protected]>
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/power/x86/turbostat/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
> index 2ab25aa38263..1598b4fa0b11 100644
> --- a/tools/power/x86/turbostat/Makefile
> +++ b/tools/power/x86/turbostat/Makefile
> @@ -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 :
> --
> 2.17.2
>

2018-10-30 09:35:14

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH 10/10] tools gpio: Override CFLAGS assignments

ping

thanks,
jirka

On Mon, Oct 22, 2018 at 04:50:07PM +0200, Jiri Olsa wrote:
> On Tue, Oct 16, 2018 at 05:06:05PM +0200, Jiri Olsa wrote:
> > 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.
> >
> > thanks,
> > jirka
> >
> >
> > Cc: Arnaldo Carvalho de Melo <[email protected]>
> > Cc: Hartmut Knaack <[email protected]>
> > Cc: Jonathan Cameron <[email protected]>
> > Cc: Lars-Peter Clausen <[email protected]>
> > Cc: Len Brown <[email protected]>
> > Cc: Markus Mayer <[email protected]>
> > Cc: Shuah Khan <[email protected]>
> > Cc: Signed-off-by: Len Brown <[email protected]>
> > Cc: Steven Rostedt <[email protected]>
> > Cc: Thomas Renninger <[email protected]>
> > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > Cc: Zhang Rui <[email protected]>
> > ---
> > Jiri Olsa (10):
> > tools lib traceevent: Use LDFLAGS in the build commands
> > tools perf: Pass build flags to traceevent build
> > tools cpupower debug: Allow to use outside build flags
> > tools cpupower: Override CFLAGS assignments
> > 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
>
> the last one did not get post for some reason,
> attaching it now
>
> jirka
>
>
> ---
> So user could specify outside CFLAGS values.
>
> 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(-)
>
> diff --git a/tools/gpio/Makefile b/tools/gpio/Makefile
> index 240eda014b37..6ecdd1067826 100644
> --- a/tools/gpio/Makefile
> +++ b/tools/gpio/Makefile
> @@ -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))
> --
> 2.17.2
>

2018-11-16 13:03:16

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Wed, Oct 17, 2018 at 10:23:41AM -0400, Steven Rostedt wrote:
> On Tue, 16 Oct 2018 17:45:26 +0200
> Jiri Olsa <[email protected]> wrote:
>
> > On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> > > On Tue, 16 Oct 2018 17:06:06 +0200
> > > Jiri Olsa <[email protected]> wrote:
> > >
> > > > So user could specify outside LDFLAGS values.
> > > >
> > > > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > > > Cc: Steven Rostedt <[email protected]>
> > > > Signed-off-by: Jiri Olsa <[email protected]>
> > > > ---
> > > > tools/lib/traceevent/Makefile | 4 ++--
> > > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> > > > index 0b4e833088a4..e535073c94ce 100644
> > > > --- a/tools/lib/traceevent/Makefile
> > > > +++ b/tools/lib/traceevent/Makefile
> > > > @@ -174,7 +174,7 @@ $(TE_IN): force
> > > > $(Q)$(MAKE) $(build)=libtraceevent
> > > >
> > > > $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> > > > - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
> > > >
> > > > @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> > > > $(Q)$(MAKE) $(build)=$(plugin_obj)
> > > >
> > > > $(OUTPUT)%.so: $(OUTPUT)%-in.o
> > > > - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> > > > + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^
> > >
> > >
> > > I'm guessing that the CFLAGS are not needed here, but shouldn't that
> > > also be mentioned in the change log?
> >
> > yep, sry.. v2 attached
> >
>
> Acked-by: Steven Rostedt (VMware) <[email protected]>

Arnaldo,
could you pull in this one?

thanks,
jirka

2018-11-23 07:47:47

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Fri, Nov 16, 2018 at 02:01:58PM +0100, Jiri Olsa wrote:
> On Wed, Oct 17, 2018 at 10:23:41AM -0400, Steven Rostedt wrote:
> > On Tue, 16 Oct 2018 17:45:26 +0200
> > Jiri Olsa <[email protected]> wrote:
> >
> > > On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> > > > On Tue, 16 Oct 2018 17:06:06 +0200
> > > > Jiri Olsa <[email protected]> wrote:
> > > >
> > > > > So user could specify outside LDFLAGS values.
> > > > >
> > > > > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > > > > Cc: Steven Rostedt <[email protected]>
> > > > > Signed-off-by: Jiri Olsa <[email protected]>
> > > > > ---
> > > > > tools/lib/traceevent/Makefile | 4 ++--
> > > > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> > > > > index 0b4e833088a4..e535073c94ce 100644
> > > > > --- a/tools/lib/traceevent/Makefile
> > > > > +++ b/tools/lib/traceevent/Makefile
> > > > > @@ -174,7 +174,7 @@ $(TE_IN): force
> > > > > $(Q)$(MAKE) $(build)=libtraceevent
> > > > >
> > > > > $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> > > > > - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > > + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> > > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
> > > > >
> > > > > @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> > > > > $(Q)$(MAKE) $(build)=$(plugin_obj)
> > > > >
> > > > > $(OUTPUT)%.so: $(OUTPUT)%-in.o
> > > > > - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> > > > > + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^
> > > >
> > > >
> > > > I'm guessing that the CFLAGS are not needed here, but shouldn't that
> > > > also be mentioned in the change log?
> > >
> > > yep, sry.. v2 attached
> > >
> >
> > Acked-by: Steven Rostedt (VMware) <[email protected]>
>
> Arnaldo,
> could you pull in this one?

ping, thanks

jirka

2018-11-27 12:39:04

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

Em Thu, Nov 22, 2018 at 10:30:06AM +0100, Jiri Olsa escreveu:
> On Fri, Nov 16, 2018 at 02:01:58PM +0100, Jiri Olsa wrote:
> > On Wed, Oct 17, 2018 at 10:23:41AM -0400, Steven Rostedt wrote:
> > > On Tue, 16 Oct 2018 17:45:26 +0200
> > > Jiri Olsa <[email protected]> wrote:
> > > > On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> > > > > I'm guessing that the CFLAGS are not needed here, but shouldn't that
> > > > > also be mentioned in the change log?

> > > > yep, sry.. v2 attached

> > > Acked-by: Steven Rostedt (VMware) <[email protected]>

> > Arnaldo,
> > could you pull in this one?

> ping, thanks

Applied, thanks,

- Arnaldo

2018-11-28 13:58:52

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCHv2 01/10] tools lib traceevent: Use LDFLAGS in the build commands

Em Thu, Nov 22, 2018 at 10:30:06AM +0100, Jiri Olsa escreveu:
> On Fri, Nov 16, 2018 at 02:01:58PM +0100, Jiri Olsa wrote:
> > On Wed, Oct 17, 2018 at 10:23:41AM -0400, Steven Rostedt wrote:
> > > On Tue, 16 Oct 2018 17:45:26 +0200
> > > Jiri Olsa <[email protected]> wrote:
> > >
> > > > On Tue, Oct 16, 2018 at 11:21:36AM -0400, Steven Rostedt wrote:
> > > > > On Tue, 16 Oct 2018 17:06:06 +0200
> > > > > Jiri Olsa <[email protected]> wrote:
> > > > >
> > > > > > So user could specify outside LDFLAGS values.
> > > > > >
> > > > > > Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
> > > > > > Cc: Steven Rostedt <[email protected]>
> > > > > > Signed-off-by: Jiri Olsa <[email protected]>
> > > > > > ---
> > > > > > tools/lib/traceevent/Makefile | 4 ++--
> > > > > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> > > > > > index 0b4e833088a4..e535073c94ce 100644
> > > > > > --- a/tools/lib/traceevent/Makefile
> > > > > > +++ b/tools/lib/traceevent/Makefile
> > > > > > @@ -174,7 +174,7 @@ $(TE_IN): force
> > > > > > $(Q)$(MAKE) $(build)=libtraceevent
> > > > > >
> > > > > > $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
> > > > > > - $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > > > + $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
> > > > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so
> > > > > > @ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)
> > > > > >
> > > > > > @@ -193,7 +193,7 @@ $(PLUGINS_IN): force
> > > > > > $(Q)$(MAKE) $(build)=$(plugin_obj)
> > > > > >
> > > > > > $(OUTPUT)%.so: $(OUTPUT)%-in.o
> > > > > > - $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
> > > > > > + $(QUIET_LINK)$(CC) -shared $(LDFLAGS) -nostartfiles -o $@ $^
> > > > >
> > > > >
> > > > > I'm guessing that the CFLAGS are not needed here, but shouldn't that
> > > > > also be mentioned in the change log?
> > > >
> > > > yep, sry.. v2 attached
> > > >
> > >
> > > Acked-by: Steven Rostedt (VMware) <[email protected]>
> >
> > Arnaldo,
> > could you pull in this one?
>
> ping, thanks

9 11.28 android-ndk:r12b-arm : FAIL arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
10 15.53 android-ndk:r15c-arm : FAIL arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)

LD /tmp/build/perf/libtraceevent-in.o
MKDIR /tmp/build/perf/util/
LINK /tmp/build/perf/libtraceevent.a
CC /tmp/build/perf/util/block-range.o
MKDIR /tmp/build/perf/arch/
CC /tmp/build/perf/arch/common.o
LD /tmp/build/perf/plugin_mac80211-in.o
CC /tmp/build/perf/plugin_sched_switch.o
LD /tmp/build/perf/plugin_sched_switch-in.o
CC /tmp/build/perf/plugin_function.o
LD /tmp/build/perf/plugin_function-in.o
CC /tmp/build/perf/plugin_xen.o
MKDIR /tmp/build/perf/arch/arm/util/
CC /tmp/build/perf/arch/arm/util/pmu.o
LD /tmp/build/perf/plugin_xen-in.o
CC /tmp/build/perf/plugin_scsi.o
CC /tmp/build/perf/plugin_cfg80211.o
LD /tmp/build/perf/plugin_scsi-in.o
LD /tmp/build/perf/plugin_cfg80211-in.o
MKDIR /tmp/build/perf/arch/arm/util/
CC /tmp/build/perf/arch/arm/util/auxtrace.o
CC /tmp/build/perf/arch/arm/util/cs-etm.o
LINK /tmp/build/perf/plugin_jbd2.so
/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
collect2: error: ld returned 1 exit status
Makefile:196: recipe for target '/tmp/build/perf/plugin_jbd2.so' failed
make[3]: *** [/tmp/build/perf/plugin_jbd2.so] Error 1
Makefile.perf:669: recipe for target 'libtraceevent_plugins' failed
make[2]: *** [libtraceevent_plugins] Error 2
make[2]: *** Waiting for unfinished jobs....


[root@seventh fedora]# cat /tmp/dm.log*/android*12*
android-ndk:r12b-arm
Downloading http://192.168.86.9/perf/perf-4.20.0-rc3.tar.xz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1423k 100 1423k 0 0 71.4M 0 --:--:-- --:--:-- --:--:-- 77.2M
e1326b0cc430443c4560ff3079c8c10159743ae5
Using built-in specs.
COLLECT_GCC=/opt/android-ndk-r12b//toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapper
Target: arm-linux-androideabi
Configured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --with-sysroot=/tmp/59719db9ae19ff43aef46bbcb79596b6/sysroot --with-binutils-version=2.25 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/59719db9ae19ff43aef46bbcb79596b6/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default
Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (GCC)
make: Entering directory '/git/linux/tools/perf'

Without it, so far:

1 59.08 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
2 68.75 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
3 79.67 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
4 48.69 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0
5 46.89 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0
6 46.46 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0
7 38.46 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
8 44.69 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
9 41.88 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
10 46.24 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
11 22.22 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
12 35.54 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

- Arnaldo

2018-12-12 09:13:40

by Jiri Olsa

[permalink] [raw]
Subject: [PATCHv3 01/10] tools lib traceevent: Use LDFLAGS in the build commands

On Wed, Nov 28, 2018 at 10:56:41AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> LD /tmp/build/perf/libtraceevent-in.o
> MKDIR /tmp/build/perf/util/
> LINK /tmp/build/perf/libtraceevent.a
> CC /tmp/build/perf/util/block-range.o
> MKDIR /tmp/build/perf/arch/
> CC /tmp/build/perf/arch/common.o
> LD /tmp/build/perf/plugin_mac80211-in.o
> CC /tmp/build/perf/plugin_sched_switch.o
> LD /tmp/build/perf/plugin_sched_switch-in.o
> CC /tmp/build/perf/plugin_function.o
> LD /tmp/build/perf/plugin_function-in.o
> CC /tmp/build/perf/plugin_xen.o
> MKDIR /tmp/build/perf/arch/arm/util/
> CC /tmp/build/perf/arch/arm/util/pmu.o
> LD /tmp/build/perf/plugin_xen-in.o
> CC /tmp/build/perf/plugin_scsi.o
> CC /tmp/build/perf/plugin_cfg80211.o
> LD /tmp/build/perf/plugin_scsi-in.o
> LD /tmp/build/perf/plugin_cfg80211-in.o
> MKDIR /tmp/build/perf/arch/arm/util/
> CC /tmp/build/perf/arch/arm/util/auxtrace.o
> CC /tmp/build/perf/arch/arm/util/cs-etm.o
> LINK /tmp/build/perf/plugin_jbd2.so
> /opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
> /opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
> collect2: error: ld returned 1 exit status
> Makefile:196: recipe for target '/tmp/build/perf/plugin_jbd2.so' failed
> make[3]: *** [/tmp/build/perf/plugin_jbd2.so] Error 1
> Makefile.perf:669: recipe for target 'libtraceevent_plugins' failed
> make[2]: *** [libtraceevent_plugins] Error 2
> make[2]: *** Waiting for unfinished jobs....
>
>

SNIP

> 1 59.08 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
> 2 68.75 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
> 3 79.67 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
> 4 48.69 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0
> 5 46.89 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0
> 6 46.46 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0
> 7 38.46 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
> 8 44.69 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
> 9 41.88 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
> 10 46.24 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
> 11 22.22 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
> 12 35.54 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

ok, I shouldn't have taken out the CFLAGS,
some build scripts depends on it already

attaching v2

thanks,
jirka


---
So user could specify outside LDFLAGS values.

Keeping the CFLAGS in there as well, so we don't break
existing script.

Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Cc: Steven Rostedt <[email protected]>
Acked-by: Steven Rostedt (VMware) <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/lib/traceevent/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 67fe5d7ef190..941761d9923d 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -177,7 +177,7 @@ $(TE_IN): force
$(Q)$(MAKE) $(build)=libtraceevent

$(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
- $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+ $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
@ln -sf $(@F) $(OUTPUT)libtraceevent.so
@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)

@@ -196,7 +196,7 @@ $(PLUGINS_IN): force
$(Q)$(MAKE) $(build)=$(plugin_obj)

$(OUTPUT)%.so: $(OUTPUT)%-in.o
- $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
+ $(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^

define make_version.h
(echo '/* This file is automatically generated. Do not modify. */'; \
--
2.17.2


2018-12-12 12:42:29

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCHv3 01/10] tools lib traceevent: Use LDFLAGS in the build commands

Em Wed, Dec 12, 2018 at 10:12:14AM +0100, Jiri Olsa escreveu:
> On Wed, Nov 28, 2018 at 10:56:41AM -0300, Arnaldo Carvalho de Melo wrote:
> > /opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
> > /opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
> > collect2: error: ld returned 1 exit status
> > Makefile:196: recipe for target '/tmp/build/perf/plugin_jbd2.so' failed
> > make[3]: *** [/tmp/build/perf/plugin_jbd2.so] Error 1
> > Makefile.perf:669: recipe for target 'libtraceevent_plugins' failed
> > make[2]: *** [libtraceevent_plugins] Error 2
> > make[2]: *** Waiting for unfinished jobs....
>
> SNIP
>
> > 1 59.08 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
> > 2 68.75 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
> > 3 79.67 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
> > 4 48.69 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0
> > 5 46.89 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0
> > 6 46.46 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0
> > 7 38.46 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
> > 8 44.69 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
> > 9 41.88 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
> > 10 46.24 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
> > 11 22.22 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
> > 12 35.54 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

> ok, I shouldn't have taken out the CFLAGS,
> some build scripts depends on it already

> attaching v2

[acme@quaco arm]$ export PERF_TARBALL=http://192.168.124.1/perf/perf-4.20.0-rc3.tar.xz
[acme@quaco arm]$ dm android-ndk:{r12b,r15c}-arm
1 29.58 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
2 37.19 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
[acme@quaco arm]$

Applied,

Thanks

- Arnaldo

Subject: [tip:perf/core] tools lib traceevent: Use LDFLAGS in the build commands

Commit-ID: 41fa483aeee567cc34f9fc4c2e7035f2df25299d
Gitweb: https://git.kernel.org/tip/41fa483aeee567cc34f9fc4c2e7035f2df25299d
Author: Jiri Olsa <[email protected]>
AuthorDate: Wed, 12 Dec 2018 10:12:14 +0100
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 18 Dec 2018 12:23:57 -0300

tools lib traceevent: Use LDFLAGS in the build commands

So that the user can specify outside LDFLAGS values.

Keeping the CFLAGS in there as well, so we don't break existing scripts.

Signed-off-by: Jiri Olsa <[email protected]>
Acked-by: Steven Rostedt (VMware) <[email protected]>
Cc: Herton Krzesinski <[email protected]>
Cc: Tzvetomir Stoyanov (VMware) <[email protected]>
Link: http://lkml.kernel.org/r/20181212091214.GC17489@krava
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/lib/traceevent/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 67fe5d7ef190..941761d9923d 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -177,7 +177,7 @@ $(TE_IN): force
$(Q)$(MAKE) $(build)=libtraceevent

$(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
- $(QUIET_LINK)$(CC) --shared $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+ $(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
@ln -sf $(@F) $(OUTPUT)libtraceevent.so
@ln -sf $(@F) $(OUTPUT)libtraceevent.so.$(EP_VERSION)

@@ -196,7 +196,7 @@ $(PLUGINS_IN): force
$(Q)$(MAKE) $(build)=$(plugin_obj)

$(OUTPUT)%.so: $(OUTPUT)%-in.o
- $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
+ $(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^

define make_version.h
(echo '/* This file is automatically generated. Do not modify. */'; \