All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools build: Clean CFLAGS and LDFLAGS for fixdep
@ 2015-11-19  7:46 Wang Nan
  2015-11-19 14:14 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Nan @ 2015-11-19  7:46 UTC (permalink / raw)
  To: acme, jolsa
  Cc: lizefan, pi3orama, linux-kernel, Wang Nan, Arnaldo Carvalho de Melo

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>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools build: Clean CFLAGS and LDFLAGS for fixdep
  2015-11-19  7:46 [PATCH] tools build: Clean CFLAGS and LDFLAGS for fixdep Wang Nan
@ 2015-11-19 14:14 ` Jiri Olsa
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Olsa @ 2015-11-19 14:14 UTC (permalink / raw)
  To: Wang Nan
  Cc: acme, jolsa, lizefan, pi3orama, linux-kernel, Arnaldo Carvalho de Melo

On Thu, Nov 19, 2015 at 07:46:01AM +0000, Wang Nan wrote:

SNIP

> 
> 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>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-19 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19  7:46 [PATCH] tools build: Clean CFLAGS and LDFLAGS for fixdep Wang Nan
2015-11-19 14:14 ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.