03 Aug, 2020
1 commit
-
The '&&' command seems to have a bad effect when $(cmd_$(1)) exits with
non-zero effect: the command failure is masked (despite `set -e`) and all but
the first command of $(dep-cmd) is executed (successfully, as they are mostly
printfs), thus overall returning 0 in the end.This means in practice that despite compilation errors, tools's build Makefile
will return success. We see this very reliably with libbpf's Makefile, which
doesn't get compilation error propagated properly. This in turns causes issues
with selftests build, as well as bpftool and other projects that rely on
building libbpf.The fix is simple: don't use &&. Given `set -e`, we don't need to chain
commands with &&. The shell will exit on first failure, giving desired
behavior and propagating error properly.Fixes: 275e2d95591e ("tools build: Move dependency copy into function")
Signed-off-by: Andrii Nakryiko
Signed-off-by: Daniel Borkmann
Acked-by: Jiri Olsa
Link: https://lore.kernel.org/bpf/20200731024244.872574-1-andriin@fb.com
18 Jul, 2018
1 commit
-
In preparation for enabling command line CFLAGS, re-name HOSTCFLAGS to
KBUILD_HOSTCFLAGS as the internal use only flags. This should not have
any visible effects.Signed-off-by: Laura Abbott
Signed-off-by: Masahiro Yamada
12 Jul, 2018
2 commits
-
Commit 0c3b7e42616f ("tools build: Add support for host programs format")
introduced host_c_flags which referenced CHOSTFLAGS. The actual name of the
variable is HOSTCFLAGS. Fix this up.Fixes: 0c3b7e42616f ("tools build: Add support for host programs format")
Signed-off-by: Laura Abbott
Acked-by: Jiri Olsa
Signed-off-by: Masahiro Yamada -
In 2016 GNU Make made a backwards incompatible change to the way '#'
characters were handled in Makefiles when used inside functions or
macros:http://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57
Due to this change, when attempting to run `make prepare' I get a
spurious make syntax error:/home/earnest/linux/tools/objtool/.fixdep.o.cmd:1: *** missing separator. Stop.
When inspecting `.fixdep.o.cmd' it includes two lines which use
unescaped comment characters at the top:\# cannot find fixdep (/home/earnest/linux/tools/objtool//fixdep)
\# using basic dep dataThis is because `tools/build/Build.include' prints these '\#'
characters:printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \This completes commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files
for future Make").Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
Cc: Randy Dunlap
Cc: Rasmus Villemoes
Cc: stable@vger.kernel.org
Signed-off-by: Paul Menzel
Signed-off-by: Masahiro Yamada
10 Apr, 2018
1 commit
-
I tried building using a freshly built Make (4.2.1-69-g8a731d1), but
already the objtool build broke withorc_dump.c: In function ‘orc_dump’:
orc_dump.c:106:2: error: ‘elf_getshnum’ is deprecated [-Werror=deprecated-declarations]
if (elf_getshdrnum(elf, &nr_sections)) {Turns out that with that new Make, the backslash was not removed, so cpp
didn't see a #include directive, grep found nothing, and
-DLIBELF_USE_DEPRECATED was wrongly put in CFLAGS.Now, that new Make behaviour is documented in their NEWS file:
* WARNING: Backward-incompatibility!
Number signs (#) appearing inside a macro reference or function invocation
no longer introduce comments and should not be escaped with backslashes:
thus a call such as:
foo := $(shell echo '#')
is legal. Previously the number sign needed to be escaped, for example:
foo := $(shell echo '\#')
Now this latter will resolve to "\#". If you want to write makefiles
portable to both versions, assign the number sign to a variable:
C := \#
foo := $(shell echo '$C')
This was claimed to be fixed in 3.81, but wasn't, for some reason.
To detect this change search for 'nocomment' in the .FEATURES variable.This also fixes up the two make-cmd instances to replace # with $(pound)
rather than with \#. There might very well be other places that need
similar fixup in preparation for whatever future Make release contains
the above change, but at least this builds an x86_64 defconfig with the
new make.Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
Cc: Randy Dunlap
Signed-off-by: Rasmus Villemoes
Signed-off-by: Masahiro Yamada
06 Dec, 2016
3 commits
-
We've been hit several times by a Makefile bug where line indented by
tab was falsely considered as target command.We prevent this by always using space indentation for everything except
for the target commands.Signed-off-by: Jiri Olsa
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1480884178-8072-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Putting extra line between dependencies and cmd_* definition
to make it more readable.Before:
$ cat .builtin-top.o.cmd
...
/home/jolsa/kernel/linux-perf/tools/include/linux/stringify.h \
/home/jolsa/kernel/linux-perf/tools/include/linux/time64.h
cmd_builtin-top.o := gcc -Wp,-MD,./.builtin-top.o.d -Wp,-MT,builtin-...
...After:
$ cat .builtin-top.o.cmd
...
/home/jolsa/kernel/linux-perf/tools/include/linux/stringify.h \
/home/jolsa/kernel/linux-perf/tools/include/linux/time64.hcmd_builtin-top.o := gcc -Wp,-MD,./.builtin-top.o.d -Wp,-MT,builtin-...
...Signed-off-by: Jiri Olsa
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1480884178-8072-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
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 directorySigned-off-by: Peter Foley
Tested-by: Arnaldo Carvalho de Melo
Acked-by: Jiri Olsa
Cc: Wang Nan
Link: http://lkml.kernel.org/r/20161128024346.17371-1-pefoley2@pefoley.com
Signed-off-by: Arnaldo Carvalho de Melo
14 Nov, 2016
1 commit
-
Adding support to remove options from final CFLAGS for both object file
and build target. It's now possible to remove CFLAGS options like:CFLAGS_REMOVE_krava.o += -Wstrict-prototypes
Committer notes:
This comes from the kernel's kbuild infrastructure, the subset that is
supported in tools/ is being documented at tools/build/Documentation/Build.txt.Signed-off-by: Jiri Olsa
Tested-by: Stephane Eranian
Cc: Andi Kleen
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Cc: William Cohen
Link: http://lkml.kernel.org/r/1478093749-5602-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
06 Oct, 2016
1 commit
-
Add new rule to compile .cpp file to .o use g++. C++ support is required
for built-in clang and LLVM support.Linker side support will be introduced by following commits.
Signed-off-by: Wang Nan
Cc: Alexei Starovoitov
Cc: He Kuang
Cc: Jiri Olsa
Cc: Zefan Li
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1474874832-134786-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo
03 Oct, 2016
1 commit
-
In some cases, like for fixdep and shortly for jevents, we need to build a tool
to run on the host that will be used in building a tool, such as perf, that is
being cross compiled, so do like the kernel and provide HOSTCC, HOSTLD and HOSTAR
to do that.Signed-off-by: Jiri Olsa
Requested-by: Andi Kleen
Requested-and-Tested-by: Arnaldo Carvalho de Melo
Cc: Madhavan Srinivasan
Cc: Peter Zijlstra
Cc: Sukadev Bhattiprolu
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20160927141846.GA6589@krava
Signed-off-by: Arnaldo Carvalho de Melo
29 Sep, 2015
2 commits
-
Making the fixdep helper to be invoked within dep-cmd.
Each user of the build framework needs to make sure fixdep exists before
executing the build itself.If the build doesn't find fixdep, it falls back to the old style
dependency tracking.Signed-off-by: Jiri Olsa
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1443004442-32660-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
So it's easier to add more functionality in the following commit.
Signed-off-by: Jiri Olsa
Cc: David Ahern
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1443004442-32660-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
12 Feb, 2015
1 commit
-
Adding new build framework into 'tools/build' to be used by tools.
There's no change for actual building at this point, it comes in the
next patches.The idea and more details are explained in the
'tools/build/Documentation/Build.txt' file.I adopted everything from the kernel build system, with some changes to
allow for multiple binaries build definitions.While the kernel's build output is single image (forget modules) we need
to be able to build several binaries/libraries.The basic idea is that sser provides 'Build' files with objects
definitions like:perf-y += a.o
perf-y += b.o
libperf-y += c.o
libperf-y += d.oand the build framework outputs files:
perf-in.o # a.o, b.o compiled in
libperf-in.o # c.o, d.o compiled inSigned-off-by: Jiri Olsa
Tested-by: Sukadev Bhattiprolu
Tested-by: Will Deacon
Cc: Alexis Berlemont
Cc: Borislav Petkov
Cc: Corey Ashford
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Link: http://lkml.kernel.org/n/tip-fbj22h4av0otlxupwcmrxgpa@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo