public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* tools/perf: libraries must come after objects
@ 2010-02-11  0:24 Jan Engelhardt
  2010-02-22 10:50 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2010-02-11  0:24 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Paul Mackerras, Ingo Molnar, Linux Kernel Mailing List

parent b4bdd73ce865213a5653dc424873e8da37e858cc (v2.6.32.7)
commit 588424af1a51fa41ea4811200889d6a03219c6fd
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Thu Feb 11 01:20:54 2010 +0100

tools/perf: libraries must come after objects

Link order matters, especially now since distributions are
using -Wl,--as-needed.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 tools/perf/Makefile |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7e190d5..9c688cd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -201,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
 
 CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
-LDFLAGS = -lpthread -lrt -lelf -lm
+LDLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
@@ -421,8 +421,8 @@ ifeq ($(uname_S),Darwin)
 	PTHREAD_LIBS =
 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) > /dev/null 2>&1 && 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) > /dev/null 2>&1 && 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 /dev/null $(LDFLAGS) $(LDLIBS) > /dev/null 2>&1 && 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 $(LDFLAGS) $(LDLIBS) > /dev/null 2>&1 && echo y"), y)
 		BASIC_CFLAGS += -DLIBELF_NO_MMAP
 	endif
 else
@@ -432,20 +432,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) -lbfd > /dev/null 2>&1 && 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 /dev/null $(LDFLAGS) $(LDLIBS) -lbfd > /dev/null 2>&1 && 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) -lbfd -liberty > /dev/null 2>&1 && 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 /dev/null $(LDFLAGS) $(LDLIBS) -lbfd -liberty > /dev/null 2>&1 && 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) -lbfd -liberty -lz > /dev/null 2>&1 && 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 /dev/null $(LDFLAGS) $(LDLIBS) -lbfd -liberty -lz > /dev/null 2>&1 && 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) -liberty > /dev/null 2>&1 && 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 /dev/null $(LDFLAGS) $(LDLIBS) -liberty > /dev/null 2>&1 && echo y")
 				ifeq ($(has_cplus_demangle),y)
 					EXTLIBS += -liberty
 					BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
@@ -677,7 +677,7 @@ prefix_SQ = $(subst ','\'',$(prefix))
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 
-LIBS = $(PERFLIBS) $(EXTLIBS)
+LIBS = $(PERFLIBS) $(LDLIBS) $(EXTLIBS)
 
 BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
 	$(COMPAT_CFLAGS)
-- 
# Created with git-export-patch


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

* Re: tools/perf: libraries must come after objects
  2010-02-11  0:24 tools/perf: libraries must come after objects Jan Engelhardt
@ 2010-02-22 10:50 ` Ingo Molnar
  2010-02-22 13:31   ` Jan Engelhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2010-02-22 10:50 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Peter Zijlstra, Paul Mackerras, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo,
	=?unknown-8bit?B?RnLDqWTDqXJpYw==?= Weisbecker


* Jan Engelhardt <jengelh@medozas.de> wrote:

> parent b4bdd73ce865213a5653dc424873e8da37e858cc (v2.6.32.7)
> commit 588424af1a51fa41ea4811200889d6a03219c6fd
> Author: Jan Engelhardt <jengelh@medozas.de>
> Date:   Thu Feb 11 01:20:54 2010 +0100
> 
> tools/perf: libraries must come after objects
> 
> Link order matters, especially now since distributions are
> using -Wl,--as-needed.
> 
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> ---
>  tools/perf/Makefile |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)

FYI, this patch doesnt apply to the latest version of perf:

 patching file tools/perf/Makefile
 Hunk #1 FAILED at 201.
 Hunk #2 FAILED at 421.
 Hunk #3 FAILED at 432.
 Hunk #4 succeeded at 770 (offset 93 lines).
 3 out of 4 hunks FAILED -- rejects in file tools/perf/Makefile

you can find the devel tree at:

  http://people.redhat.com/mingo/tip.git/README

Thanks,

	Ingo

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

* Re: tools/perf: libraries must come after objects
  2010-02-22 10:50 ` Ingo Molnar
@ 2010-02-22 13:31   ` Jan Engelhardt
  2010-02-22 13:47     ` Ingo Molnar
  2010-02-22 13:48     ` Peter Zijlstra
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Engelhardt @ 2010-02-22 13:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Paul Mackerras, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo, Fr??d??ric Weisbecker

On Monday 2010-02-22 11:50, Ingo Molnar wrote:
>> 
>> tools/perf: libraries must come after objects
>> 
>> Link order matters, especially now since distributions are
>> using -Wl,--as-needed.
>> 
>> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
>> ---
>>  tools/perf/Makefile |   16 ++++++++--------
>>  1 files changed, 8 insertions(+), 8 deletions(-)
>
>FYI, this patch doesnt apply to the latest version of perf:
>
> patching file tools/perf/Makefile
> Hunk #1 FAILED at 201.
> Hunk #2 FAILED at 421.
> Hunk #3 FAILED at 432.
> Hunk #4 succeeded at 770 (offset 93 lines).
> 3 out of 4 hunks FAILED -- rejects in file tools/perf/Makefile
>
>you can find the devel tree at:
>
>  http://people.redhat.com/mingo/tip.git/README

Do happen to have that as a faster git:// too?

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

* Re: tools/perf: libraries must come after objects
  2010-02-22 13:31   ` Jan Engelhardt
@ 2010-02-22 13:47     ` Ingo Molnar
  2010-02-23 23:54       ` Jan Engelhardt
  2010-02-22 13:48     ` Peter Zijlstra
  1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2010-02-22 13:47 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Peter Zijlstra, Paul Mackerras, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo, Fr??d??ric Weisbecker


* Jan Engelhardt <jengelh@medozas.de> wrote:

> On Monday 2010-02-22 11:50, Ingo Molnar wrote:
> >> 
> >> tools/perf: libraries must come after objects
> >> 
> >> Link order matters, especially now since distributions are
> >> using -Wl,--as-needed.
> >> 
> >> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> >> ---
> >>  tools/perf/Makefile |   16 ++++++++--------
> >>  1 files changed, 8 insertions(+), 8 deletions(-)
> >
> >FYI, this patch doesnt apply to the latest version of perf:
> >
> > patching file tools/perf/Makefile
> > Hunk #1 FAILED at 201.
> > Hunk #2 FAILED at 421.
> > Hunk #3 FAILED at 432.
> > Hunk #4 succeeded at 770 (offset 93 lines).
> > 3 out of 4 hunks FAILED -- rejects in file tools/perf/Makefile
> >
> >you can find the devel tree at:
> >
> >  http://people.redhat.com/mingo/tip.git/README
> 
> Do happen to have that as a faster git:// too?

Yes, the links for the -tip Git tree are in that file.

Thanks,

	Ingo

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

* Re: tools/perf: libraries must come after objects
  2010-02-22 13:31   ` Jan Engelhardt
  2010-02-22 13:47     ` Ingo Molnar
@ 2010-02-22 13:48     ` Peter Zijlstra
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2010-02-22 13:48 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Ingo Molnar, Paul Mackerras, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo, Fr??d??ric Weisbecker

On Mon, 2010-02-22 at 14:31 +0100, Jan Engelhardt wrote:
> 
> Do happen to have that as a faster git:// too?
> 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git


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

* Re: tools/perf: libraries must come after objects
  2010-02-22 13:47     ` Ingo Molnar
@ 2010-02-23 23:54       ` Jan Engelhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2010-02-23 23:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Paul Mackerras, Linux Kernel Mailing List,
	Arnaldo Carvalho de Melo, Fr??d??ric Weisbecker


On Monday 2010-02-22 14:47, Ingo Molnar wrote:
>> >> tools/perf: libraries must come after objects
>> >> 
>> >> Link order matters, especially now since distributions are
>> >> using -Wl,--as-needed.

>> >>  tools/perf/Makefile |   16 ++++++++--------
>> >>  1 files changed, 8 insertions(+), 8 deletions(-)
>> >
>> >FYI, this patch doesnt apply to the latest version of perf:
>> >  http://people.redhat.com/mingo/tip.git/README

Seems like it was already merged - half of it.

There is this perl linking error now remaining, because
libperf.a comes after the perl part, and I am not sure
how to fix cleanly that Makefile without making more
mess of it.

$ make CC=gcc-4.4
touch .perf.dev.null
gcc-4.4 -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement  -fstack-protector-all -Iutil/include -I/usr/include/libdwarf -DSHA1_HEADER='<openssl/sha.h>'  -o perf perf.o \
		 builtin-annotate.o builtin-bench.o bench/sched-messaging.o bench/sched-pipe.o bench/mem-memcpy.o builtin-diff.o builtin-help.o builtin-sched.o builtin-buildid-list.o builtin-buildid-cache.o builtin-list.o builtin-record.o builtin-report.o builtin-stat.o builtin-timechart.o builtin-top.o builtin-trace.o builtin-probe.o builtin-kmem.o builtin-lock.o  `perl -MExtUtils::Embed -e ldopts 2>/dev/null`  libperf.a -lpthread -lrt -lelf -lm -lelf -ldwarf -lbfd -liberty -lz 
libperf.a(trace-event-perl.o): In function `define_flag_value':
/home/jengelh/code/linux/tools/perf/util/trace-event-perl.c:125: undefined reference to `Perl_push_scope'
[...]
/home/jengelh/code/linux/tools/perf/Context.c:54: undefined reference to `Perl_croak_nocontext'
collect2: ld returned 1 exit status
make: *** [perf] Error 1
rm .perf.dev.null

$ perl -MExtUtils::Embed -e ldopts
-Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE
-L/usr/local/lib64
-L/usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE -lperl -lm
-ldl -lcrypt -lpthread

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

end of thread, other threads:[~2010-02-23 23:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11  0:24 tools/perf: libraries must come after objects Jan Engelhardt
2010-02-22 10:50 ` Ingo Molnar
2010-02-22 13:31   ` Jan Engelhardt
2010-02-22 13:47     ` Ingo Molnar
2010-02-23 23:54       ` Jan Engelhardt
2010-02-22 13:48     ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox