All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Ian Munsie <imunsie@au1.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	tom.leiming@gmail.com
Subject: Re: [PATCH 2/3] perf: Allow strong and weak functions in LIB_OBJS
Date: Fri, 26 Nov 2010 19:18:36 -0200	[thread overview]
Message-ID: <20101126211836.GA5864@ghostprotocols.net> (raw)
In-Reply-To: <1290658375-10342-2-git-send-email-imunsie@au1.ibm.com>

Em Thu, Nov 25, 2010 at 03:12:54PM +1100, Ian Munsie escreveu:
> From: Ian Munsie <imunsie@au1.ibm.com>
> 
> When we build perf we place all of the .o files from the library files
> (util, arch/x/util, etc) into libperf.a which is then linked into perf.
> The problem is that the linker will by default only consider .o files
> within the .a archive if they are necessary to satisfy an unresolved
> symbol. As weak functions are not unresolved, it will not consider a .o
> file from the archive containing the strong versions of weak functions
> unless it requires it for another reason.
> 
> This patch adds the --whole-archive flags to the linker when passing in
> the libperf.a file to ensure that it will consider every .o file in the
> archive, not just what it believes that it needs. The end result is that
> weak functions can now be overridden by strong variants of them in the
> libperf.a file.

After I applied this patch I got this on a x86_64 Fedora 14 box:

    LINK /home/acme/git/build/perf/perf
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS): In function `pthread_atfork':
(.text+0x0): multiple definition of `__pthread_atfork'
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS):(.text+0x0): first defined here
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS): In function `pthread_atfork':
(.text+0x0): multiple definition of `pthread_atfork'
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS):(.text+0x0): first defined here
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS): In function `pthread_atfork':
(.text+0x0): multiple definition of `__pthread_atfork'
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS):(.text+0x0): first defined here
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS): In function `pthread_atfork':
(.text+0x0): multiple definition of `pthread_atfork'
/usr/lib64/libpthread_nonshared.a(pthread_atfork.oS):(.text+0x0): first defined here
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libiberty.a(choose-temp.o): In function `choose_temp_base':
(.text+0x57): warning: the use of `mktemp' is dangerous, better use `mkstemp'
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libiberty.a(strerror.o): In function `errno_max':
(.text+0x151): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../lib64/libiberty.a(xstrdup.o): In function `xstrdup':
(.text+0x0): multiple definition of `xstrdup'
/home/acme/git/build/perf/libperf.a(wrapper.o):/media/tbs/acme/git/linux/tools/perf/util/wrapper.c:15: first defined here
collect2: ld returned 1 exit status
make: *** [/home/acme/git/build/perf/perf] Error 1
make: Leaving directory `/media/tbs/acme/git/linux/tools/perf'
[acme@felicio linux]$

- Arnaldo

  reply	other threads:[~2010-11-26 21:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25  4:12 [PATCH 1/3] perf: Correct final kernel map guesses Ian Munsie
2010-11-25  4:12 ` [PATCH 2/3] perf: Allow strong and weak functions in LIB_OBJS Ian Munsie
2010-11-26 21:18   ` Arnaldo Carvalho de Melo [this message]
2010-11-29  0:53     ` Ian Munsie
2010-12-07  6:42       ` Ian Munsie
2010-12-07 14:55         ` Arnaldo Carvalho de Melo
2010-12-08  7:39       ` [tip:perf/core] perf makefile: " tip-bot for Ian Munsie
2010-11-25  4:12 ` [PATCH 3/3] perf, powerpc: Allow perf test to handle PowerPC symbol naming Ian Munsie
2010-12-10  4:47   ` Ian Munsie
2010-12-12 14:39   ` Arnaldo Carvalho de Melo
2010-12-13  0:30     ` Ian Munsie
2010-11-28  8:34 ` [tip:perf/core] perf symbols: Correct final kernel map guesses tip-bot for Ian Munsie

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=20101126211836.GA5864@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=imunsie@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=tom.leiming@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 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.