This is a note to let you know that I've just added the patch titled

    perf tools: Check if /dev/null can be used as the -o gcc argument

to the 2.6.32-longterm tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.32.git;a=summary

The filename of the patch is:
     perf-tools-check-if-dev-null-can-be-used-as-the-o-gc.patch
and it can be found in the queue-2.6.32 subdirectory.

If you, or anyone else, feels it should not be added to the 2.6.32 longterm 
tree,
please let <[email protected]> know about it.


From 94c4e78ef8cdb451621cc46993edfb27825c39fc Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue, 12 Jan 2010 08:58:30 -0200
Subject: perf tools: Check if /dev/null can be used as the -o gcc argument
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Arnaldo Carvalho de Melo <[email protected]>

commit 1703f2c321a8a531c393e137a82602e16c6061cb upstream.

At least on Debian PARISC64, using:

acme@parisc:~/git/linux-2.6-tip$ gcc -v
Using built-in specs.
Target: hppa-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
4.3.4-6' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr 
--disable-libssp --enable-checking=release --build=hppa-linux-gnu 
--host=hppa-linux-gnu --target=hppa-linux-gnu Thread model: posix gcc version 
4.3.4 (Debian 4.3.4-6)

there are issues about using 'gcc -o /dev/null':

/usr/bin/ld: final link failed: File truncated
collect2: ld returned 1 exit status

So we test that and use /dev/null in environments where it
works, while using an .INTERMEDIATE file on those where it can't
be used, so that the .perf.dev.null file can be used instead and
then deleted when make exits.

Researched-with: Kyle McMartin <[email protected]>
Researched-with: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frédéric Weisbecker <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
[bwh: Backport to 2.6.32]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 tools/perf/Makefile |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -258,7 +258,13 @@ else
        QUIET_STDERR = ">/dev/null 2>&1"
 endif
 
-ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c 
-c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), 
y)
+BITBUCKET = "/dev/null"
+
+ifneq ($(shell sh -c "(echo '\#include <stdio.h>'; echo 'int main(void) { 
return puts(\"hi\"); }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) 
"$(QUIET_STDERR)" && echo y"), y)
+       BITBUCKET = .perf.dev.null
+endif
+
+ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c 
-c -Werror -fstack-protector-all - -o $(BITBUCKET) "$(QUIET_STDERR)" && echo 
y"), y)
   CFLAGS := $(CFLAGS) -fstack-protector-all
 endif
 
@@ -430,12 +436,12 @@ ifeq ($(uname_S),Darwin)
        PTHREAD_LIBS =
 endif
 
-ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int 
main(void) { const char * version = gnu_get_libc_version(); return 
(long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" 
&& echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int 
main(void) { const char * version = gnu_get_libc_version(); return 
(long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE 
-D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) 
"$(QUIET_STDERR)" && echo y"), y)
        msg := $(error No gnu/libc-version.h found, please install 
glibc-dev[el]/glibc-static);
 endif
 
-ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf 
* elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - 
$(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null 
$(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
-       ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int 
main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; 
}') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 
-o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf 
* elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - 
$(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o $(BITBUCKET) 
$(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+       ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int 
main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; 
}') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 
-o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
                BASIC_CFLAGS += -DLIBELF_NO_MMAP
        endif
 else
@@ -445,20 +451,20 @@ endif
 ifdef NO_DEMANGLE
        BASIC_CFLAGS += -DNO_DEMANGLE
 else
-       has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int 
main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) 
-o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
+       has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int 
main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) 
-o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
 
        ifeq ($(has_bfd),y)
                EXTLIBS += -lbfd
        else
-               has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; 
echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - 
$(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty 
"$(QUIET_STDERR)" && echo y")
+               has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; 
echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - 
$(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty 
"$(QUIET_STDERR)" && echo y")
                ifeq ($(has_bfd_iberty),y)
                        EXTLIBS += -lbfd -liberty
                else
-                       has_bfd_iberty_z := $(shell sh -c "(echo '\#include 
<bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) 
-x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz 
"$(QUIET_STDERR)" && echo y")
+                       has_bfd_iberty_z := $(shell sh -c "(echo '\#include 
<bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) 
-x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty 
-lz "$(QUIET_STDERR)" && echo y")
                        ifeq ($(has_bfd_iberty_z),y)
                                EXTLIBS += -lbfd -liberty -lz
                        else
-                               has_cplus_demangle := $(shell sh -c "(echo 
'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { 
cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null 
$(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
+                               has_cplus_demangle := $(shell sh -c "(echo 
'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { 
cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o 
$(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
                                ifeq ($(has_cplus_demangle),y)
                                        EXTLIBS += -liberty
                                        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
@@ -706,7 +712,7 @@ export TAR INSTALL DESTDIR SHELL_PATH
 
 SHELL = $(SHELL_PATH)
 
-all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) 
PERF-BUILD-OPTIONS
+all:: .perf.dev.null shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) 
$(OTHER_PROGRAMS) PERF-BUILD-OPTIONS
 ifneq (,$X)
        $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) 
perf$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
 endif
@@ -1009,6 +1015,11 @@ clean:
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
 .PHONY: .FORCE-PERF-BUILD-OPTIONS
 
+.perf.dev.null:
+               touch .perf.dev.null
+
+.INTERMEDIATE: .perf.dev.null
+
 ### Make sure built-ins do not have dups and listed in perf.c
 #
 check-builtins::


Patches currently in longterm-queue-2.6.32 which might be from [email protected] 
are

/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-add-v-2-option-to-help-debug-config-issue.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-add-make-debug-1-to-remove-the-o6-cflag.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-symbols-allow-forcing-use-of-cplus_demangle.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-use-default-compiler-mode-by-default.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-suggest-static-libraries-as-well.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-move-quiet_stderr-def-to-before-first-use.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-support-static-build.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-check-if-dev-null-can-be-used-as-the-o-gc.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/perf-tools-display-better-error-messages-on-missing-.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to