public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix linking errors with --as-needed flag
@ 2010-07-18 10:45 Ozan Çağlayan
  2010-07-18 11:04 ` Ozan Çağlayan
  0 siblings, 1 reply; 11+ messages in thread
From: Ozan Çağlayan @ 2010-07-18 10:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: acme, mst, mingo

External shared libraries should never be appended to the LDFLAGS as
this messes the linking order. As EXTLIBS collects those libraries,
it seems that perl and python libraries  should also be appended
to EXTLIBS.

Also fix the broken linking order.

See:
  http://www.gentoo.org/proj/en/qa/asneeded.xml

Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
---
 tools/perf/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3d8f31e..98c537f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -580,7 +580,7 @@ endif
 ifneq ($(shell sh -c "(echo '\#include <EXTERN.h>'; echo '\#include <perl.h>'; echo 'int main(void) { perl_alloc(); return 0; }') | $(CC) -x c - $(PERL_EMBED_CCOPTS) -o $(BITBUCKET) $(PERL_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
 	BASIC_CFLAGS += -DNO_LIBPERL
 else
-	ALL_LDFLAGS += $(PERL_EMBED_LDOPTS)
+	EXTLIBS += $(PERL_EMBED_LDOPTS)
 	LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
 	LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
@@ -593,7 +593,7 @@ endif
 ifneq ($(shell sh -c "(echo '\#include <Python.h>'; echo 'int main(void) { Py_Initialize(); return 0; }') | $(CC) -x c - $(PYTHON_EMBED_CCOPTS) -o $(BITBUCKET) $(PYTHON_EMBED_LDOPTS) > /dev/null 2>&1 && echo y"), y)
 	BASIC_CFLAGS += -DNO_LIBPYTHON
 else
-	ALL_LDFLAGS += $(PYTHON_EMBED_LDOPTS)
+	EXTLIBS += $(PYTHON_EMBED_LDOPTS)
 	LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
 	LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
 endif
@@ -886,8 +886,8 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
 		$(ALL_CFLAGS) -c $(filter %.c,$^) -o $@
 
 $(OUTPUT)perf$X: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
-	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(OUTPUT)perf.o \
-		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
+	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
+		$(BUILTIN_OBJS) $(LIBS) -o $@
 
 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
-- 
1.7.1


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

end of thread, other threads:[~2010-08-30  8:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-18 10:45 [PATCH] perf tools: Fix linking errors with --as-needed flag Ozan Çağlayan
2010-07-18 11:04 ` Ozan Çağlayan
2010-08-21 17:24   ` Arnaldo Carvalho de Melo
2010-08-22  6:43     ` Tom Zanussi
2010-08-23  2:44       ` Tom Zanussi
2010-08-23 14:38         ` Arnaldo Carvalho de Melo
2010-08-23 21:22           ` Ozan Çağlayan
2010-08-23 23:23             ` Arnaldo Carvalho de Melo
2010-08-23 16:53         ` Kirill A. Shutemov
2010-08-24  5:23           ` Tom Zanussi
     [not found]             ` <tip-f2481f3df4521e731da36afe7f0fe19a5c93e46d@git.kernel.org>
2010-08-30  8:38               ` [tip:perf/core] " Kirill A. Shutemov

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