public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	acme@redhat.com, tzanussi@gmail.com, ozan@pardus.org.tr,
	tglx@linutronix.de
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:perf/core] perf tools: Fix linking errors with --as-needed flag
Date: Mon, 30 Aug 2010 11:38:44 +0300	[thread overview]
Message-ID: <20100830083844.GA7010@shutemov.name> (raw)
In-Reply-To: <tip-f2481f3df4521e731da36afe7f0fe19a5c93e46d@git.kernel.org>

On Mon, Aug 30, 2010 at 08:35:40AM +0000, tip-bot for Tom Zanussi wrote:
> Commit-ID:  f2481f3df4521e731da36afe7f0fe19a5c93e46d
> Gitweb:     http://git.kernel.org/tip/f2481f3df4521e731da36afe7f0fe19a5c93e46d
> Author:     Tom Zanussi <tzanussi@gmail.com>
> AuthorDate: Tue, 24 Aug 2010 00:23:50 -0500
> Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
> CommitDate: Wed, 25 Aug 2010 17:35:21 -0300
> 
> perf tools: Fix linking errors with --as-needed flag
> 
> 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.
> 
> This is a refresh of a patch by Ozan Çağlayan and improved by both Tom Zanussi
> and Kirill A. Shutemov.
> 
> Cc: Ozan Çağlayan <ozan@pardus.org.tr>
> Tested-by: Kirill A. Shutemov <kirill@shutemov.name>

I guess Signed-off-by is more appropriate here.

> Tested-by: Tom Zanussi <tzanussi@gmail.com>
> LKML-Reference: <1282627430.28324.8.camel@tropicana>
> Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/Makefile |   21 +++++++++++++++------
>  1 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 26a3f2e..fe1e307 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -313,6 +313,9 @@ TEST_PROGRAMS =
>  
>  SCRIPT_SH += perf-archive.sh
>  
> +grep-libs = $(filter -l%,$(1))
> +strip-libs = $(filter-out -l%,$(1))
> +
>  #
>  # No Perl scripts right now:
>  #
> @@ -588,14 +591,17 @@ endif
>  ifdef NO_LIBPERL
>  	BASIC_CFLAGS += -DNO_LIBPERL
>  else
> -	PERL_EMBED_LDOPTS = `perl -MExtUtils::Embed -e ldopts 2>/dev/null`
> +       PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
> +       PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
> +       PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
>  	PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
>  	FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
>  
>  	ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y)
>  		BASIC_CFLAGS += -DNO_LIBPERL
>  	else
> -		ALL_LDFLAGS += $(PERL_EMBED_LDOPTS)
> +               ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
> +               EXTLIBS += $(PERL_EMBED_LIBADD)
>  		LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
>  		LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
>  	endif
> @@ -604,13 +610,16 @@ endif
>  ifdef NO_LIBPYTHON
>  	BASIC_CFLAGS += -DNO_LIBPYTHON
>  else
> -	PYTHON_EMBED_LDOPTS = `python-config --ldflags 2>/dev/null`
> +       PYTHON_EMBED_LDOPTS = $(shell python-config --ldflags 2>/dev/null)
> +       PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
> +       PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
>  	PYTHON_EMBED_CCOPTS = `python-config --cflags 2>/dev/null`
>  	FLAGS_PYTHON_EMBED=$(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
>  	ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
>  		BASIC_CFLAGS += -DNO_LIBPYTHON
>  	else
> -		ALL_LDFLAGS += $(PYTHON_EMBED_LDOPTS)
> +               ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
> +               EXTLIBS += $(PYTHON_EMBED_LIBADD)
>  		LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
>  		LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
>  	endif
> @@ -919,8 +928,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) \

-- 
 Kirill A. Shutemov

      parent reply	other threads:[~2010-08-30  8:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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               ` Kirill A. Shutemov [this message]

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=20100830083844.GA7010@shutemov.name \
    --to=kirill@shutemov.name \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=ozan@pardus.org.tr \
    --cc=tglx@linutronix.de \
    --cc=tzanussi@gmail.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