2016-11-26 22:20:57

by Peter Foley

[permalink] [raw]
Subject: [PATCH] Fix objtool with clang

Clang doesn't support multiple arguments being passed to -Wp, so split
them.

Fixes this error:
HOSTCC tools/objtool/fixdep.o
cat: tools/objtool/.fixdep.o.d: No such file or directory

Signed-off-by: Peter Foley <[email protected]>
---
tools/build/Build.include | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/build/Build.include b/tools/build/Build.include
index 1dcb95e76f70..83c7be908009 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -89,10 +89,10 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
# - per target C flags
# - per object C flags
# - BUILD_STR macro to allow '-D"$(variable)"' constructs
-c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
-cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
+c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
+cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))

###
## HOSTCC C flags

-host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
+host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
--
2.11.0.rc2


2016-11-27 16:14:59

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH] Fix objtool with clang

On Sat, Nov 26, 2016 at 05:20:35PM -0500, Peter Foley wrote:
> Clang doesn't support multiple arguments being passed to -Wp, so split
> them.
>
> Fixes this error:
> HOSTCC tools/objtool/fixdep.o
> cat: tools/objtool/.fixdep.o.d: No such file or directory
>
> Signed-off-by: Peter Foley <[email protected]>
> ---
> tools/build/Build.include | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/build/Build.include b/tools/build/Build.include
> index 1dcb95e76f70..83c7be908009 100644
> --- a/tools/build/Build.include
> +++ b/tools/build/Build.include
> @@ -89,10 +89,10 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
> # - per target C flags
> # - per object C flags
> # - BUILD_STR macro to allow '-D"$(variable)"' constructs
> -c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
> -cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
> +c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
> +cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))

could you please rebase this on Arnaldo's latest perf/core branch?
(git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git)

thanks,
jirka

2016-11-28 02:44:05

by Peter Foley

[permalink] [raw]
Subject: [PATCH v2] Fix objtool with clang

Clang doesn't support multiple arguments being passed to -Wp, so split
them.

Fixes this error:
HOSTCC tools/objtool/fixdep.o
cat: tools/objtool/.fixdep.o.d: No such file or directory

v2:
rebased onto perf/core branch.

Signed-off-by: Peter Foley <[email protected]>
---
tools/build/Build.include | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/build/Build.include b/tools/build/Build.include
index c4ae12a5d0a5..62dcf0c7aac2 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -89,12 +89,12 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
# - per target C flags
# - per object C flags
# - BUILD_STR macro to allow '-D"$(variable)"' constructs
-c_flags_1 = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
+c_flags_1 = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1))
c_flags = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2))
-cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
+cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))

###
## HOSTCC C flags

-host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
+host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
--
2.11.0.rc2

2016-11-28 11:39:38

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Sun, Nov 27, 2016 at 09:43:46PM -0500, Peter Foley wrote:
> Clang doesn't support multiple arguments being passed to -Wp, so split
> them.
>
> Fixes this error:
> HOSTCC tools/objtool/fixdep.o
> cat: tools/objtool/.fixdep.o.d: No such file or directory
>
> v2:
> rebased onto perf/core branch.
>
> Signed-off-by: Peter Foley <[email protected]>

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

thanks,
jirka

2016-11-28 15:00:36

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

Em Mon, Nov 28, 2016 at 12:39:28PM +0100, Jiri Olsa escreveu:
> On Sun, Nov 27, 2016 at 09:43:46PM -0500, Peter Foley wrote:
> > Clang doesn't support multiple arguments being passed to -Wp, so split
> > them.
> >
> > Fixes this error:
> > HOSTCC tools/objtool/fixdep.o
> > cat: tools/objtool/.fixdep.o.d: No such file or directory
> >
> > v2:
> > rebased onto perf/core branch.
> >
> > Signed-off-by: Peter Foley <[email protected]>
>
> Acked-by: Jiri Olsa <[email protected]>

After I applied this I started getting this:

CC /tmp/build/perf/tests/sw-clock.o
/tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
make[1]: *** Waiting for unfinished jobs....
CC /tmp/build/perf/tests/mmap-thread-lookup.o


If I remove the O= build dir and restart, I get it again:


[acme@jouet linux]$ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]

GEN /tmp/build/perf/common-cmds.h
HOSTCC /tmp/build/perf/fixdep.o
<SNIP>

CC /tmp/build/perf/util/pmu-bison.o
/tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
make[1]: *** Waiting for unfinished jobs....
CC /tmp/build/perf/util/parse-events.o
CC /tmp/build/perf/util/parse-events-flex.o

Trying to nuke my ccache dir:

Doesn't help:

[acme@jouet linux]$ rm -rf ~/.ccache/
[acme@jouet linux]$ m
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
/tmp/build/perf/jvmti/.jvmti_agent.o.cmd:3: *** empty variable name. Stop.
Makefile.perf:566: recipe for target '/tmp/build/perf/jvmti/jvmti-in.o' failed
make[1]: *** [/tmp/build/perf/jvmti/jvmti-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
/tmp/build/perf/pmu-events/.jevents.o.cmd:3: *** empty variable name. Stop.
Makefile.perf:469: recipe for target '/tmp/build/perf/pmu-events/jevents-in.o' failed
make[1]: *** [/tmp/build/perf/pmu-events/jevents-in.o] Error 2
Makefile:108: recipe for target 'install-bin' failed
make: *** [install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'

Performance counter stats for 'make -k O=/tmp/build/perf -C tools/perf install-bin':

5,406,254,581 cycles:u
8,259,935,345 instructions:u # 1.53 insn per cycle

2.150027964 seconds time elapsed

[acme@jouet linux]$

2016-11-28 15:26:27

by Peter Foley

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Mon, Nov 28, 2016 at 7:00 AM, Arnaldo Carvalho de Melo
<[email protected]> wrote:
> After I applied this I started getting this:
>
> CC /tmp/build/perf/tests/sw-clock.o
> /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> make[1]: *** Waiting for unfinished jobs....
> CC /tmp/build/perf/tests/mmap-thread-lookup.o

Odd, I can't reproduce that...
Mind sending your gcc version + the output of make V=1 + the contents
of the .cmd file causing the error?

Thanks,

Peter

2016-11-28 16:59:10

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Mon, Nov 28, 2016 at 07:25:53AM -0800, Peter Foley wrote:
> On Mon, Nov 28, 2016 at 7:00 AM, Arnaldo Carvalho de Melo
> <[email protected]> wrote:
> > After I applied this I started getting this:
> >
> > CC /tmp/build/perf/tests/sw-clock.o
> > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> > CC /tmp/build/perf/tests/mmap-thread-lookup.o
>
> Odd, I can't reproduce that...
> Mind sending your gcc version + the output of make V=1 + the contents
> of the .cmd file causing the error?

same here, can't reproduce.. might be some race issue we experienced before

jirka

2016-11-28 19:36:05

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

Em Mon, Nov 28, 2016 at 07:25:53AM -0800, Peter Foley escreveu:
> On Mon, Nov 28, 2016 at 7:00 AM, Arnaldo Carvalho de Melo
> <[email protected]> wrote:
> > After I applied this I started getting this:
> >
> > CC /tmp/build/perf/tests/sw-clock.o
> > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> > CC /tmp/build/perf/tests/mmap-thread-lookup.o
>
> Odd, I can't reproduce that...
> Mind sending your gcc version + the output of make V=1 + the contents
> of the .cmd file causing the error?

I just updated to f25, lemme see if this still happens...

- Arnaldo

2016-11-28 19:41:04

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

Em Mon, Nov 28, 2016 at 05:58:59PM +0100, Jiri Olsa escreveu:
> On Mon, Nov 28, 2016 at 07:25:53AM -0800, Peter Foley wrote:
> > On Mon, Nov 28, 2016 at 7:00 AM, Arnaldo Carvalho de Melo
> > <[email protected]> wrote:
> > > After I applied this I started getting this:
> > >
> > > CC /tmp/build/perf/tests/sw-clock.o
> > > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > > make[1]: *** Waiting for unfinished jobs....
> > > CC /tmp/build/perf/tests/mmap-thread-lookup.o
> >
> > Odd, I can't reproduce that...
> > Mind sending your gcc version + the output of make V=1 + the contents
> > of the .cmd file causing the error?
>
> same here, can't reproduce.. might be some race issue we experienced before

Ok, fails in f25 as well, will try again later taking ccache out of the way, etc.

[acme@jouet linux]$ ccache -V
ccache version 3.3.3

Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2016 Joel Rosdahl

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
[acme@jouet linux]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC)
[acme@jouet linux]$ make -v
GNU Make 4.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[acme@jouet linux]$


[acme@jouet linux]$ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]

GEN /tmp/build/perf/common-cmds.h
HOSTCC /tmp/build/perf/fixdep.o
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/json.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/jsmn.o
CC /tmp/build/perf/perf-read-vdso32
HOSTCC /tmp/build/perf/pmu-events/jevents.o
MKDIR /tmp/build/perf/jvmti/
CC /tmp/build/perf/jvmti/libjvmti.o
PERF_VERSION = 4.9.rc6.g47bcdb
MKDIR /tmp/build/perf/ui/gtk/
<SNIP>
CC /tmp/build/perf/builtin-buildid-list.o
LD /tmp/build/perf/pmu-events/pmu-events-in.o
CC /tmp/build/perf/arch/x86/util/intel-bts.o
CC /tmp/build/perf/builtin-buildid-cache.o
CC /tmp/build/perf/builtin-list.o
LD /tmp/build/perf/arch/x86/util/libperf-in.o
MKDIR /tmp/build/perf/arch/x86/tests/
CC /tmp/build/perf/arch/x86/tests/regs_load.o
/tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
make[1]: *** Waiting for unfinished jobs....
MKDIR /tmp/build/perf/arch/x86/tests/
CC /tmp/build/perf/arch/x86/tests/arch-tests.o
<SNIP>
CC /tmp/build/perf/util/pmu.o
CC /tmp/build/perf/util/pmu-flex.o
LD /tmp/build/perf/util/libperf-in.o
LD /tmp/build/perf/libperf-in.o
Makefile:108: recipe for target 'install-bin' failed
make: *** [install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'
[acme@jouet linux]$

2016-11-28 20:09:14

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:

SNIP

> > same here, can't reproduce.. might be some race issue we experienced before
>
> Ok, fails in f25 as well, will try again later taking ccache out of the way, etc.
>
> [acme@jouet linux]$ ccache -V
> ccache version 3.3.3

is there some extra config needed for ccache?

> Copyright (C) 2002-2007 Andrew Tridgell
> Copyright (C) 2009-2016 Joel Rosdahl
>
> This program is free software; you can redistribute it and/or modify it under
> the terms of the GNU General Public License as published by the Free Software
> Foundation; either version 3 of the License, or (at your option) any later
> version.
> [acme@jouet linux]$ gcc -v

I'm on F25 with same gcc version

> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/lto-wrapper
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
> Thread model: posix
> gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC)
> [acme@jouet linux]$ make -v
> GNU Make 4.1
> Built for x86_64-redhat-linux-gnu
> Copyright (C) 1988-2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> [acme@jouet linux]$
>
>
> [acme@jouet linux]$ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
> make: Entering directory '/home/acme/git/linux/tools/perf'
> BUILD: Doing 'make -j4' parallel build

I'm building on 8 CPUs.. so not the race issue I guess

SNIP

> CC /tmp/build/perf/builtin-buildid-list.o
> LD /tmp/build/perf/pmu-events/pmu-events-in.o
> CC /tmp/build/perf/arch/x86/util/intel-bts.o
> CC /tmp/build/perf/builtin-buildid-cache.o
> CC /tmp/build/perf/builtin-list.o
> LD /tmp/build/perf/arch/x86/util/libperf-in.o
> MKDIR /tmp/build/perf/arch/x86/tests/
> CC /tmp/build/perf/arch/x86/tests/regs_load.o
> /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed

could you please post /tmp/build/perf/.plugin_jbd2.o.cmd file?

and 'make ... V=1' output?

thanks,
jirka

> make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> make[1]: *** Waiting for unfinished jobs....
> MKDIR /tmp/build/perf/arch/x86/tests/
> CC /tmp/build/perf/arch/x86/tests/arch-tests.o

SNIP

2016-11-29 09:32:29

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:

SNIP

> LD /tmp/build/perf/pmu-events/pmu-events-in.o
> CC /tmp/build/perf/arch/x86/util/intel-bts.o
> CC /tmp/build/perf/builtin-buildid-cache.o
> CC /tmp/build/perf/builtin-list.o
> LD /tmp/build/perf/arch/x86/util/libperf-in.o
> MKDIR /tmp/build/perf/arch/x86/tests/
> CC /tmp/build/perf/arch/x86/tests/regs_load.o
> /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> make[1]: *** Waiting for unfinished jobs....

ok, reproduced..

the commit changes the output of the depfile for some reason,
and our fixdep does not handle it correctly and produce wrong
cmd file that failed to parse.. checking for fix

depfile changes ('+' is after the change):

-plugin_jbd2.o: plugin_jbd2.c /usr/include/stdc-predef.h \
+plugin_jbd2.o plugin_jbd2.o: plugin_jbd2.c /usr/include/stdc-predef.h \

jirka

2016-11-29 09:58:49

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Tue, Nov 29, 2016 at 10:32:24AM +0100, Jiri Olsa wrote:
> On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
>
> SNIP
>
> > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > CC /tmp/build/perf/builtin-buildid-cache.o
> > CC /tmp/build/perf/builtin-list.o
> > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > MKDIR /tmp/build/perf/arch/x86/tests/
> > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > make[1]: *** Waiting for unfinished jobs....
>
> ok, reproduced..
>
> the commit changes the output of the depfile for some reason,
> and our fixdep does not handle it correctly and produce wrong
> cmd file that failed to parse.. checking for fix
>
> depfile changes ('+' is after the change):
>
> -plugin_jbd2.o: plugin_jbd2.c /usr/include/stdc-predef.h \
> +plugin_jbd2.o plugin_jbd2.o: plugin_jbd2.c /usr/include/stdc-predef.h \
>
> jirka

so Fedora 25 puts old target name in the generated dependencies
in case you split the -Wp options.. while Fedora 24 the old way

and both F24 and F25 shows me same gcc version 6.2.1
(note that just the first command output with 2 targets is wrong for us)

Fedora 25:
[root@intel-denlow-r-02 ~]# gcc -o ex.o -c -Wp,-MD,krava -Wp,-MT,krava -g ex.c
[root@intel-denlow-r-02 ~]# cat krava
ex.o krava: ex.c /usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h

[root@intel-denlow-r-02 ~]# gcc -o ex.o -c -Wp,-MD,krava,-MT,krava -g ex.c
[root@intel-denlow-r-02 ~]# cat krava
krava: ex.c /usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h


Fedora 24:
[jolsa@krava trash]$ gcc -o ex.o -c -Wp,-MD,krava -Wp,-MT,krava -g ex.c
[jolsa@krava trash]$ cat krava
krava: ex.c /usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h

[jolsa@krava trash]$ gcc -o ex.o -c -Wp,-MD,krava-Wp,-MT,krava -g ex.c
[jolsa@krava trash]$ cat krava
krava: ex.c /usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h


I'll make fixdep to deal with that and try to have someone from gcc to clarify on this

jirka

2016-11-29 14:28:20

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:

SNIP

> CC /tmp/build/perf/builtin-buildid-list.o
> LD /tmp/build/perf/pmu-events/pmu-events-in.o
> CC /tmp/build/perf/arch/x86/util/intel-bts.o
> CC /tmp/build/perf/builtin-buildid-cache.o
> CC /tmp/build/perf/builtin-list.o
> LD /tmp/build/perf/arch/x86/util/libperf-in.o
> MKDIR /tmp/build/perf/arch/x86/tests/
> CC /tmp/build/perf/arch/x86/tests/regs_load.o
> /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> make[1]: *** Waiting for unfinished jobs....
> MKDIR /tmp/build/perf/arch/x86/tests/
> CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> <SNIP>
> CC /tmp/build/perf/util/pmu.o
> CC /tmp/build/perf/util/pmu-flex.o
> LD /tmp/build/perf/util/libperf-in.o
> LD /tmp/build/perf/libperf-in.o
> Makefile:108: recipe for target 'install-bin' failed
> make: *** [install-bin] Error 2
> make: Leaving directory '/home/acme/git/linux/tools/perf'
> [acme@jouet linux]$

how about following fix.. it gets rid of the -Wp,MT option completely
so it should address Peter's issue.. it also makes fixdep more robust
and makes it wait for first target before spitting out dependencies

I have some difficulties now with getting Fedora 25.. I'll test
and send this out within this week

jirka


---
diff --git a/tools/build/Build.include b/tools/build/Build.include
index c4ae12a5d0a5..63c898f089f7 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -89,12 +89,12 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
# - per target C flags
# - per object C flags
# - BUILD_STR macro to allow '-D"$(variable)"' constructs
-c_flags_1 = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
+c_flags_1 = -Wp,-MD,$(depfile) $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1))
c_flags = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2))
-cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
+cxx_flags = -Wp,-MD,$(depfile) $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))

###
## HOSTCC C flags

-host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
+host_c_flags = -Wp,-MD,$(depfile) $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
index 1521d36cef0d..734d1547cbae 100644
--- a/tools/build/fixdep.c
+++ b/tools/build/fixdep.c
@@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
char *end = m + len;
char *p;
char s[PATH_MAX];
- int is_target;
+ int is_target, has_target = 0;
int saw_any_target = 0;
int is_first_dep = 0;

@@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
if (is_target) {
/* The /next/ file is the first dependency */
is_first_dep = 1;
- } else {
+ has_target = 1;
+ } else if (has_target) {
/* Save this token/filename */
memcpy(s, m, p-m);
s[p - m] = 0;

2016-11-29 14:33:27

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

Em Tue, Nov 29, 2016 at 03:28:08PM +0100, Jiri Olsa escreveu:
> On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
>
> SNIP
>
> > CC /tmp/build/perf/builtin-buildid-list.o
> > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > CC /tmp/build/perf/builtin-buildid-cache.o
> > CC /tmp/build/perf/builtin-list.o
> > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > MKDIR /tmp/build/perf/arch/x86/tests/
> > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > make[1]: *** Waiting for unfinished jobs....
> > MKDIR /tmp/build/perf/arch/x86/tests/
> > CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> > <SNIP>
> > CC /tmp/build/perf/util/pmu.o
> > CC /tmp/build/perf/util/pmu-flex.o
> > LD /tmp/build/perf/util/libperf-in.o
> > LD /tmp/build/perf/libperf-in.o
> > Makefile:108: recipe for target 'install-bin' failed
> > make: *** [install-bin] Error 2
> > make: Leaving directory '/home/acme/git/linux/tools/perf'
> > [acme@jouet linux]$
>
> how about following fix.. it gets rid of the -Wp,MT option completely
> so it should address Peter's issue.. it also makes fixdep more robust
> and makes it wait for first target before spitting out dependencies

So this should replace Peter's patch? On top? I'm checking that now...

> I have some difficulties now with getting Fedora 25.. I'll test
> and send this out within this week
>
> jirka
>
>
> ---
> diff --git a/tools/build/Build.include b/tools/build/Build.include
> index c4ae12a5d0a5..63c898f089f7 100644
> --- a/tools/build/Build.include
> +++ b/tools/build/Build.include
> @@ -89,12 +89,12 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
> # - per target C flags
> # - per object C flags
> # - BUILD_STR macro to allow '-D"$(variable)"' constructs
> -c_flags_1 = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
> +c_flags_1 = -Wp,-MD,$(depfile) $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
> c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1))
> c_flags = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2))
> -cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
> +cxx_flags = -Wp,-MD,$(depfile) $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
>
> ###
> ## HOSTCC C flags
>
> -host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
> +host_c_flags = -Wp,-MD,$(depfile) $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
> diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
> index 1521d36cef0d..734d1547cbae 100644
> --- a/tools/build/fixdep.c
> +++ b/tools/build/fixdep.c
> @@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
> char *end = m + len;
> char *p;
> char s[PATH_MAX];
> - int is_target;
> + int is_target, has_target = 0;
> int saw_any_target = 0;
> int is_first_dep = 0;
>
> @@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
> if (is_target) {
> /* The /next/ file is the first dependency */
> is_first_dep = 1;
> - } else {
> + has_target = 1;
> + } else if (has_target) {
> /* Save this token/filename */
> memcpy(s, m, p-m);
> s[p - m] = 0;

2016-11-29 14:39:46

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Tue, Nov 29, 2016 at 12:33:15PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 29, 2016 at 03:28:08PM +0100, Jiri Olsa escreveu:
> > On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
> >
> > SNIP
> >
> > > CC /tmp/build/perf/builtin-buildid-list.o
> > > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > > CC /tmp/build/perf/builtin-buildid-cache.o
> > > CC /tmp/build/perf/builtin-list.o
> > > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > > make[1]: *** Waiting for unfinished jobs....
> > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> > > <SNIP>
> > > CC /tmp/build/perf/util/pmu.o
> > > CC /tmp/build/perf/util/pmu-flex.o
> > > LD /tmp/build/perf/util/libperf-in.o
> > > LD /tmp/build/perf/libperf-in.o
> > > Makefile:108: recipe for target 'install-bin' failed
> > > make: *** [install-bin] Error 2
> > > make: Leaving directory '/home/acme/git/linux/tools/perf'
> > > [acme@jouet linux]$
> >
> > how about following fix.. it gets rid of the -Wp,MT option completely
> > so it should address Peter's issue.. it also makes fixdep more robust
> > and makes it wait for first target before spitting out dependencies
>
> So this should replace Peter's patch? On top? I'm checking that now...

it's replacement.. also I'll put it into 2 patches

jirka

2016-11-29 14:49:18

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

Em Tue, Nov 29, 2016 at 03:39:35PM +0100, Jiri Olsa escreveu:
> On Tue, Nov 29, 2016 at 12:33:15PM -0200, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Nov 29, 2016 at 03:28:08PM +0100, Jiri Olsa escreveu:
> > > On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
> > >
> > > SNIP
> > >
> > > > CC /tmp/build/perf/builtin-buildid-list.o
> > > > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > > > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > > > CC /tmp/build/perf/builtin-buildid-cache.o
> > > > CC /tmp/build/perf/builtin-list.o
> > > > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > > > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > > > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > > > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > > > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > > > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > > > make[1]: *** Waiting for unfinished jobs....
> > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> > > > <SNIP>
> > > > CC /tmp/build/perf/util/pmu.o
> > > > CC /tmp/build/perf/util/pmu-flex.o
> > > > LD /tmp/build/perf/util/libperf-in.o
> > > > LD /tmp/build/perf/libperf-in.o
> > > > Makefile:108: recipe for target 'install-bin' failed
> > > > make: *** [install-bin] Error 2
> > > > make: Leaving directory '/home/acme/git/linux/tools/perf'
> > > > [acme@jouet linux]$
> > >
> > > how about following fix.. it gets rid of the -Wp,MT option completely
> > > so it should address Peter's issue.. it also makes fixdep more robust
> > > and makes it wait for first target before spitting out dependencies
> >
> > So this should replace Peter's patch? On top? I'm checking that now...
>
> it's replacement.. also I'll put it into 2 patches

Ok, just tested, Peter's patch works if I remove ccache, with your patch
replacing it, everything works, with and without ccache, on f25, and it
builds on f24 without ccache, in one of the containers I have.

- Arnaldo

2016-11-29 15:25:21

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v2] Fix objtool with clang

On Tue, Nov 29, 2016 at 12:49:04PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 29, 2016 at 03:39:35PM +0100, Jiri Olsa escreveu:
> > On Tue, Nov 29, 2016 at 12:33:15PM -0200, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Nov 29, 2016 at 03:28:08PM +0100, Jiri Olsa escreveu:
> > > > On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
> > > >
> > > > SNIP
> > > >
> > > > > CC /tmp/build/perf/builtin-buildid-list.o
> > > > > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > > > > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > > > > CC /tmp/build/perf/builtin-buildid-cache.o
> > > > > CC /tmp/build/perf/builtin-list.o
> > > > > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > > > > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > > > > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > > > > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > > > > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > > > > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > > > > make[1]: *** Waiting for unfinished jobs....
> > > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > > CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> > > > > <SNIP>
> > > > > CC /tmp/build/perf/util/pmu.o
> > > > > CC /tmp/build/perf/util/pmu-flex.o
> > > > > LD /tmp/build/perf/util/libperf-in.o
> > > > > LD /tmp/build/perf/libperf-in.o
> > > > > Makefile:108: recipe for target 'install-bin' failed
> > > > > make: *** [install-bin] Error 2
> > > > > make: Leaving directory '/home/acme/git/linux/tools/perf'
> > > > > [acme@jouet linux]$
> > > >
> > > > how about following fix.. it gets rid of the -Wp,MT option completely
> > > > so it should address Peter's issue.. it also makes fixdep more robust
> > > > and makes it wait for first target before spitting out dependencies
> > >
> > > So this should replace Peter's patch? On top? I'm checking that now...
> >
> > it's replacement.. also I'll put it into 2 patches
>
> Ok, just tested, Peter's patch works if I remove ccache, with your patch
> replacing it, everything works, with and without ccache, on f25, and it
> builds on f24 without ccache, in one of the containers I have.

ok, I'll run my tests once I have the server and send it out

thanks,
jirka

2016-12-01 13:00:29

by Jiri Olsa

[permalink] [raw]
Subject: [PATCHv3] tools build: Make fixdep parsing wait for last target

On Tue, Nov 29, 2016 at 12:49:04PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 29, 2016 at 03:39:35PM +0100, Jiri Olsa escreveu:
> > On Tue, Nov 29, 2016 at 12:33:15PM -0200, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Nov 29, 2016 at 03:28:08PM +0100, Jiri Olsa escreveu:
> > > > On Mon, Nov 28, 2016 at 05:40:46PM -0200, Arnaldo Carvalho de Melo wrote:
> > > >
> > > > SNIP
> > > >
> > > > > CC /tmp/build/perf/builtin-buildid-list.o
> > > > > LD /tmp/build/perf/pmu-events/pmu-events-in.o
> > > > > CC /tmp/build/perf/arch/x86/util/intel-bts.o
> > > > > CC /tmp/build/perf/builtin-buildid-cache.o
> > > > > CC /tmp/build/perf/builtin-list.o
> > > > > LD /tmp/build/perf/arch/x86/util/libperf-in.o
> > > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > > CC /tmp/build/perf/arch/x86/tests/regs_load.o
> > > > > /tmp/build/perf/.plugin_jbd2.o.cmd:3: *** empty variable name. Stop.
> > > > > Makefile:192: recipe for target '/tmp/build/perf/plugin_jbd2-in.o' failed
> > > > > make[2]: *** [/tmp/build/perf/plugin_jbd2-in.o] Error 2
> > > > > Makefile.perf:591: recipe for target '/tmp/build/perf/libtraceevent-dynamic-list' failed
> > > > > make[1]: *** [/tmp/build/perf/libtraceevent-dynamic-list] Error 2
> > > > > make[1]: *** Waiting for unfinished jobs....
> > > > > MKDIR /tmp/build/perf/arch/x86/tests/
> > > > > CC /tmp/build/perf/arch/x86/tests/arch-tests.o
> > > > > <SNIP>
> > > > > CC /tmp/build/perf/util/pmu.o
> > > > > CC /tmp/build/perf/util/pmu-flex.o
> > > > > LD /tmp/build/perf/util/libperf-in.o
> > > > > LD /tmp/build/perf/libperf-in.o
> > > > > Makefile:108: recipe for target 'install-bin' failed
> > > > > make: *** [install-bin] Error 2
> > > > > make: Leaving directory '/home/acme/git/linux/tools/perf'
> > > > > [acme@jouet linux]$
> > > >
> > > > how about following fix.. it gets rid of the -Wp,MT option completely
> > > > so it should address Peter's issue.. it also makes fixdep more robust
> > > > and makes it wait for first target before spitting out dependencies
> > >
> > > So this should replace Peter's patch? On top? I'm checking that now...
> >
> > it's replacement.. also I'll put it into 2 patches
>
> Ok, just tested, Peter's patch works if I remove ccache, with your patch
> replacing it, everything works, with and without ccache, on f25, and it
> builds on f24 without ccache, in one of the containers I have.
>

ok, so v3 actually ;-)

the v2 was tricky for the case when fixdep is not available,
so I decided to go with Peter's fix and fixing 'fixdep' tool
to properly parse out the target in case we hit the ccache
error.. we need to be able to do it anyway

please apply this patch before Peter's so we keep clean bisect

thanks,
jirka


---
The fixdep tool among other things replaces the target of
the object in the gcc generated dependency output file.

The parsing code assumes there's only single target in the
rule but this is not always the case as described in here:
https://gcc.gnu.org/ml/gcc-help/2016-11/msg00099.html

Making the fixdep code smart enough to skip all the possible
targets.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/build/fixdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
index 1521d36cef0d..734d1547cbae 100644
--- a/tools/build/fixdep.c
+++ b/tools/build/fixdep.c
@@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
char *end = m + len;
char *p;
char s[PATH_MAX];
- int is_target;
+ int is_target, has_target = 0;
int saw_any_target = 0;
int is_first_dep = 0;

@@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
if (is_target) {
/* The /next/ file is the first dependency */
is_first_dep = 1;
- } else {
+ has_target = 1;
+ } else if (has_target) {
/* Save this token/filename */
memcpy(s, m, p-m);
s[p - m] = 0;
--
2.7.4

2016-12-01 17:49:04

by Peter Foley

[permalink] [raw]
Subject: Re: [PATCHv3] tools build: Make fixdep parsing wait for last target

On Thu, Dec 1, 2016 at 5:00 AM, Jiri Olsa <[email protected]> wrote:
> ok, so v3 actually ;-)
>
> the v2 was tricky for the case when fixdep is not available,
> so I decided to go with Peter's fix and fixing 'fixdep' tool
> to properly parse out the target in case we hit the ccache
> error.. we need to be able to do it anyway
>
> please apply this patch before Peter's so we keep clean bisect
>
> thanks,
> jirka
>
>
> ---
> The fixdep tool among other things replaces the target of
> the object in the gcc generated dependency output file.
>
> The parsing code assumes there's only single target in the
> rule but this is not always the case as described in here:
> https://gcc.gnu.org/ml/gcc-help/2016-11/msg00099.html
>
> Making the fixdep code smart enough to skip all the possible
> targets.
>
> Link: http://lkml.kernel.org/n/[email protected]
> Signed-off-by: Jiri Olsa <[email protected]>
> ---
> tools/build/fixdep.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
> index 1521d36cef0d..734d1547cbae 100644
> --- a/tools/build/fixdep.c
> +++ b/tools/build/fixdep.c
> @@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
> char *end = m + len;
> char *p;
> char s[PATH_MAX];
> - int is_target;
> + int is_target, has_target = 0;
> int saw_any_target = 0;
> int is_first_dep = 0;
>
> @@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
> if (is_target) {
> /* The /next/ file is the first dependency */
> is_first_dep = 1;
> - } else {
> + has_target = 1;
> + } else if (has_target) {
> /* Save this token/filename */
> memcpy(s, m, p-m);
> s[p - m] = 0;
> --
> 2.7.4
>


Acked-by: Peter Foley <[email protected]>

2016-12-01 18:53:41

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCHv3] tools build: Make fixdep parsing wait for last target

Em Thu, Dec 01, 2016 at 09:48:40AM -0800, Peter Foley escreveu:
> On Thu, Dec 1, 2016 at 5:00 AM, Jiri Olsa <[email protected]> wrote:
> > ok, so v3 actually ;-)
> >
> > the v2 was tricky for the case when fixdep is not available,
> > so I decided to go with Peter's fix and fixing 'fixdep' tool
> > to properly parse out the target in case we hit the ccache
> > error.. we need to be able to do it anyway
> >
> > please apply this patch before Peter's so we keep clean bisect
> >
> > thanks,
> > jirka

Doesn't work with ccache installed, but then after reinstalling ccache to check
its version, I can't reproduce it anymore, go figure :-\

Can you guys please take a look at tmp.perf/fixdep in my tree and check that
the last two patches are the ones that should go upstream and that you are able
to build it _with_ ccache installed?

Thanks,

- Arnaldo

Checking ccache version _after_ reinstalling it.
[acme@jouet linux]$ rpm -q ccache
ccache-3.3.3-1.fc25.x86_64

Before removing ccache:

[acme@jouet linux]$ git log --oneline -2
53c0b5e56b0e Fix objtool with clang
b73bc98b88db tools build: Make fixdep parsing wait for last target
[acme@jouet linux]$

[acme@jouet linux]$ m
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
CC /tmp/build/perf/jvmti/libjvmti.o
CC /tmp/build/perf/jvmti/jvmti_agent.o
HOSTCC /tmp/build/perf/pmu-events/json.o
HOSTCC /tmp/build/perf/fixdep.o
HOSTCC /tmp/build/perf/pmu-events/jsmn.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
/bin/sh: /tmp/build/perf//fixdep: Permission denied
/home/acme/git/linux/tools/build/Makefile.build:91: recipe for target '/tmp/build/perf/pmu-events/jsmn.o' failed
make[2]: *** [/tmp/build/perf/pmu-events/jsmn.o] Error 1
Makefile.perf:469: recipe for target '/tmp/build/perf/pmu-events/jevents-in.o' failed
make[1]: *** [/tmp/build/perf/pmu-events/jevents-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
LD /tmp/build/perf/jvmti/jvmti-in.o
Makefile:108: recipe for target 'install-bin' failed
make: *** [install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'

Performance counter stats for 'make -k O=/tmp/build/perf -C tools/perf install-bin':

7,842,062,842 cycles:u
10,358,806,498 instructions:u # 1.32 insn per cycle

2.698261783 seconds time elapsed

[acme@jouet linux]$

Even if I try removing the build directory it fails:


[acme@jouet linux]$ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]

GEN /tmp/build/perf/common-cmds.h
HOSTCC /tmp/build/perf/fixdep.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/json.o
/bin/sh: /tmp/build/perf//fixdep: Permission denied
/home/acme/git/linux/tools/build/Makefile.build:91: recipe for target '/tmp/build/perf/pmu-events/json.o' failed
make[2]: *** [/tmp/build/perf/pmu-events/json.o] Error 1
Makefile.perf:469: recipe for target '/tmp/build/perf/pmu-events/jevents-in.o' failed
make[1]: *** [/tmp/build/perf/pmu-events/jevents-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
PERF_VERSION = 4.9.rc6.g628b2a
make[1]: *** wait: No child processes. Stop.
Makefile:108: recipe for target 'install-bin' failed
make: *** [install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'
[acme@jouet linux]$


2016-12-02 08:49:16

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv3] tools build: Make fixdep parsing wait for last target

On Thu, Dec 01, 2016 at 04:53:23PM -0200, Arnaldo Carvalho de Melo wrote:

SNIP

> [acme@jouet linux]$ m
> make: Entering directory '/home/acme/git/linux/tools/perf'
> BUILD: Doing 'make -j4' parallel build
> CC /tmp/build/perf/jvmti/libjvmti.o
> CC /tmp/build/perf/jvmti/jvmti_agent.o
> HOSTCC /tmp/build/perf/pmu-events/json.o
> HOSTCC /tmp/build/perf/fixdep.o
> HOSTCC /tmp/build/perf/pmu-events/jsmn.o
> HOSTLD /tmp/build/perf/fixdep-in.o
> LINK /tmp/build/perf/fixdep
> /bin/sh: /tmp/build/perf//fixdep: Permission denied
> /home/acme/git/linux/tools/build/Makefile.build:91: recipe for target '/tmp/build/perf/pmu-events/jsmn.o' failed

I think this is unrelated.. I think we're missing jevents fixdep dependency

I'll test patch below and send it separately

jirka

---
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 3cb1df43ad3e..5d968af132e2 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -465,7 +465,7 @@ $(PERF_IN): prepare FORCE
|| echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true
$(Q)$(MAKE) $(build)=perf

-$(JEVENTS_IN): FORCE
+$(JEVENTS_IN): fixdep FORCE
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=pmu-events obj=jevents

$(JEVENTS): $(JEVENTS_IN)

2016-12-02 09:15:44

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCHv3] tools build: Make fixdep parsing wait for last target

On Thu, Dec 01, 2016 at 04:53:23PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Thu, Dec 01, 2016 at 09:48:40AM -0800, Peter Foley escreveu:
> > On Thu, Dec 1, 2016 at 5:00 AM, Jiri Olsa <[email protected]> wrote:
> > > ok, so v3 actually ;-)
> > >
> > > the v2 was tricky for the case when fixdep is not available,
> > > so I decided to go with Peter's fix and fixing 'fixdep' tool
> > > to properly parse out the target in case we hit the ccache
> > > error.. we need to be able to do it anyway
> > >
> > > please apply this patch before Peter's so we keep clean bisect
> > >
> > > thanks,
> > > jirka
>
> Doesn't work with ccache installed, but then after reinstalling ccache to check
> its version, I can't reproduce it anymore, go figure :-\
>
> Can you guys please take a look at tmp.perf/fixdep in my tree and check that
> the last two patches are the ones that should go upstream and that you are able
> to build it _with_ ccache installed?

yep, works for me

thanks,
jirka

2016-12-02 15:11:07

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCHv3] tools build: Make fixdep parsing wait for last target

Em Fri, Dec 02, 2016 at 10:15:39AM +0100, Jiri Olsa escreveu:
> On Thu, Dec 01, 2016 at 04:53:23PM -0200, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Dec 01, 2016 at 09:48:40AM -0800, Peter Foley escreveu:
> > > On Thu, Dec 1, 2016 at 5:00 AM, Jiri Olsa <[email protected]> wrote:
> > > > ok, so v3 actually ;-)

> > > > the v2 was tricky for the case when fixdep is not available,
> > > > so I decided to go with Peter's fix and fixing 'fixdep' tool
> > > > to properly parse out the target in case we hit the ccache
> > > > error.. we need to be able to do it anyway

> > > > please apply this patch before Peter's so we keep clean bisect

> > Doesn't work with ccache installed, but then after reinstalling ccache to check
> > its version, I can't reproduce it anymore, go figure :-\
> >
> > Can you guys please take a look at tmp.perf/fixdep in my tree and check that
> > the last two patches are the ones that should go upstream and that you are able
> > to build it _with_ ccache installed?

> yep, works for me

So I saw it again, while processing Wang's eBPF/llvm patchkit, right after
removing the build dir and starting from scratch, doing that process one more
time made it work, so it looks like a race, and look it is in a HOSTCC bit,
related?

[acme@jouet linux]$ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ on ]
... glibc: [ on ]
... gtk2: [ on ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ on ]
... libpython: [ on ]
... libslang: [ on ]
... libcrypto: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ on ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]

GEN /tmp/build/perf/common-cmds.h
HOSTCC /tmp/build/perf/fixdep.o
HOSTLD /tmp/build/perf/fixdep-in.o
LINK /tmp/build/perf/fixdep
MKDIR /tmp/build/perf/pmu-events/
HOSTCC /tmp/build/perf/pmu-events/json.o
/bin/sh: /tmp/build/perf//fixdep: Permission denied
/home/acme/git/linux/tools/build/Makefile.build:91: recipe for target '/tmp/build/perf/pmu-events/json.o' failed
make[2]: *** [/tmp/build/perf/pmu-events/json.o] Error 1
Makefile.perf:469: recipe for target '/tmp/build/perf/pmu-events/jevents-in.o' failed
make[1]: *** [/tmp/build/perf/pmu-events/jevents-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
PERF_VERSION = 4.9.rc6.g165081a
make[1]: *** wait: No child processes. Stop.
Makefile:108: recipe for target 'install-bin' failed
make: *** [install-bin] Error 2
make: Leaving directory '/home/acme/git/linux/tools/perf'

Subject: [tip:perf/core] tools build: Make fixdep parsing wait for last target

Commit-ID: 1cd6472e3f8d3fdee0fd19f7088807b284d3080f
Gitweb: http://git.kernel.org/tip/1cd6472e3f8d3fdee0fd19f7088807b284d3080f
Author: Jiri Olsa <[email protected]>
AuthorDate: Thu, 1 Dec 2016 14:00:25 +0100
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 5 Dec 2016 15:51:42 -0300

tools build: Make fixdep parsing wait for last target

The fixdep tool, among other things, replaces the target of the object
in the gcc generated dependency output file.

The parsing code assumes there's only single target in the rule but this
is not always the case as described in here:

https://gcc.gnu.org/ml/gcc-help/2016-11/msg00099.html

Make the fixdep code smart enough to skip all the possible targets.

Signed-off-by: Jiri Olsa <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Acked-by: Peter Foley <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/20161201130025.GA16430@krava
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/build/fixdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
index 1521d36..734d154 100644
--- a/tools/build/fixdep.c
+++ b/tools/build/fixdep.c
@@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
char *end = m + len;
char *p;
char s[PATH_MAX];
- int is_target;
+ int is_target, has_target = 0;
int saw_any_target = 0;
int is_first_dep = 0;

@@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
if (is_target) {
/* The /next/ file is the first dependency */
is_first_dep = 1;
- } else {
+ has_target = 1;
+ } else if (has_target) {
/* Save this token/filename */
memcpy(s, m, p-m);
s[p - m] = 0;

Subject: [tip:perf/core] tools build: Fix objtool build with clang

Commit-ID: baa1973ebcf6a7bd15522a5b6a35a8fefd6cb232
Gitweb: http://git.kernel.org/tip/baa1973ebcf6a7bd15522a5b6a35a8fefd6cb232
Author: Peter Foley <[email protected]>
AuthorDate: Sun, 27 Nov 2016 21:43:46 -0500
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 5 Dec 2016 15:51:42 -0300

tools build: Fix objtool build with clang

Clang doesn't support multiple arguments being passed to -Wp, so split
them.

Fixes this error:
HOSTCC tools/objtool/fixdep.o
cat: tools/objtool/.fixdep.o.d: No such file or directory

Signed-off-by: Peter Foley <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/build/Build.include | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/build/Build.include b/tools/build/Build.include
index c4ae12a..62dcf0c 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -89,12 +89,12 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
# - per target C flags
# - per object C flags
# - BUILD_STR macro to allow '-D"$(variable)"' constructs
-c_flags_1 = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
+c_flags_1 = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1))
c_flags = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2))
-cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))
+cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj))

###
## HOSTCC C flags

-host_c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))
+host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CHOSTFLAGS) -D"BUILD_STR(s)=\#s" $(CHOSTFLAGS_$(basetarget).o) $(CHOSTFLAGS_$(obj))