mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>, <masami.hiramatsu.pt@hitachi.com>, <ast@kernel.org>
Cc: <lizefan@huawei.com>, <pi3orama@163.com>,
	<linux-kernel@vger.kernel.org>, Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 01/16] tools build: Clean CFLAGS and LDFLAGS for fixdep
Date: Tue, 24 Nov 2015 13:36:06 +0000	[thread overview]
Message-ID: <1448372181-151723-2-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1448372181-151723-1-git-send-email-wangnan0@huawei.com>

Sometimes variables passed to tools/build is dangerous. For example, on
my platform there is a gcc problem (gcc 4.8.1):

It passes stackprotector-all feature check:
 $ gcc -fstack-protector-all./test.c
 $ echo $?
 0

But requires LDFLAGS support if separete compiling and linking:
 $ gcc -fstack-protector-all -c ./test.c
 $ gcc ./test.o
 ./test.o: In function `main':
 test.c:(.text+0xb): undefined reference to `__stack_chk_guard'
 test.c:(.text+0x21): undefined reference to `__stack_chk_guard'
 collect2: error: ld returned 1 exit status
 $ gcc -fstack-protector-all ./test.o
 $ echo $?
 0
 $ gcc ./test.o -lssp
 $ echo $?
 0

In this environment perf building throws an error:

 $ make
   BUILD:   Doing 'make -j24' parallel build
 config/Makefile:344: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
 config/Makefile:403: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
 config/Makefile:418: slang not found, disables TUI support. Please install slang-devel or libslang-dev
 config/Makefile:432: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
 config/Makefile:564: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
 config/Makefile:606: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
   CC       fixdep.o
   LD       fixdep-in.o
   LINK     fixdep
 fixdep-in.o: In function `parse_dep_file':
 /kernel/tools/build/fixdep.c:47: undefined reference to `__stack_chk_guard'
 /kernel/tools/build/fixdep.c:117: undefined reference to `__stack_chk_guard'
 fixdep-in.o: In function `main':
 /kernel-hydrogen/tools/build/fixdep.c:156: undefined reference to `__stack_chk_guard'
 /kernel/tools/build/fixdep.c:168: undefined reference to `__stack_chk_guard'
 collect2: error: ld returned 1 exit status
 make[2]: *** [fixdep] Error 1
 make[1]: *** [fixdep] Error 2
 make: *** [all] Error 2

This is because CFLAGS in perf building pollutes CFLAGS used for fixdep,
passes -fstack-protector-all to fixdep builder which is obviously not
required. Since fixdep is a small host side tool, we should keep its
CFLAGS/LDFLAGS simple anc clean.

This patch clear CFLAGS and LDFLAGS passed to fixdep building, so such
gcc problem won't block perf building.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/Makefile.include b/tools/build/Makefile.include
index 4e09ad6..6254760 100644
--- a/tools/build/Makefile.include
+++ b/tools/build/Makefile.include
@@ -4,7 +4,7 @@ ifdef CROSS_COMPILE
 fixdep:
 else
 fixdep:
-	$(Q)$(MAKE) -C $(srctree)/tools/build fixdep
+	$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= fixdep
 endif
 
 .PHONY: fixdep
-- 
1.8.3.4


  reply	other threads:[~2015-11-24 13:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 13:36 [PATCH 00/16] perf tools: BPF related update Wang Nan
2015-11-24 13:36 ` Wang Nan [this message]
2015-11-26  8:21   ` [tip:perf/core] tools build: Clean CFLAGS and LDFLAGS for fixdep tip-bot for Wang Nan
2015-11-24 13:36 ` [PATCH 02/16] tools lib bpf: Don't feature check when cleaning Wang Nan
2015-11-26  8:22   ` [tip:perf/core] tools lib bpf: Don' t do a " tip-bot for Wang Nan
2015-11-24 13:36 ` [PATCH 03/16] bpf tools: Add helper function for updating bpf maps elements Wang Nan
2015-11-27  7:47   ` [tip:perf/core] " tip-bot for He Kuang
2015-11-24 13:36 ` [PATCH 04/16] bpf tools: Collect map definition in bpf_object Wang Nan
2015-11-26 20:56   ` Arnaldo Carvalho de Melo
2015-11-27  6:16     ` Wangnan (F)
2015-11-27  6:21       ` Wangnan (F)
2015-11-24 13:36 ` [PATCH 05/16] bpf tools: Extract and collect map names from BPF object file Wang Nan
2015-11-24 13:36 ` [PATCH 06/16] perf tools: Rename bpf config to program config Wang Nan
2015-11-24 13:36 ` [PATCH 07/16] perf tools: Add API to config maps in bpf object Wang Nan
2015-11-27  7:32   ` Wangnan (F)
2015-11-24 13:36 ` [PATCH 08/16] perf tools: Enable BPF object configure syntax Wang Nan
2015-11-24 13:36 ` [PATCH 09/16] perf record: Apply config to BPF objects before recording Wang Nan
2015-11-24 13:36 ` [PATCH 10/16] perf tools: Support perf event alias name Wang Nan
2015-11-24 13:36 ` [PATCH 11/16] perf tools: Enable passing event to BPF object Wang Nan
2015-11-24 13:36 ` [PATCH 12/16] perf tools: Support setting different slots in a BPF map separately Wang Nan
2015-11-27  7:31   ` Wangnan (F)
2015-11-24 13:36 ` [PATCH 13/16] perf tools: Enable indices setting syntax for BPF maps Wang Nan
2015-11-24 13:36 ` [PATCH 14/16] perf tools: Introduce bpf-output event Wang Nan
2015-11-24 13:36 ` [PATCH 15/16] perf data: Add u32_hex data type Wang Nan
2015-11-24 13:36 ` [PATCH 16/16] perf data: Support converting data from bpf_perf_event_output() Wang Nan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448372181-151723-2-git-send-email-wangnan0@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=pi3orama@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®