All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: "Wangnan (F)" <wangnan0@huawei.com>
Cc: acme@kernel.org, adrian.hunter@intel.com, dev@codyps.com,
	hekuang@huawei.com, kirr@nexedi.com,
	linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Li Zefan <lizefan@huawei.com>,
	pi3orama@163.com
Subject: Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects
Date: Wed, 3 Feb 2016 22:55:51 +0900	[thread overview]
Message-ID: <20160203135551.GA2068@danjae.kornet> (raw)
In-Reply-To: <56B1621B.9070100@huawei.com>

Hi,

On Wed, Feb 03, 2016 at 10:12:43AM +0800, Wangnan (F) wrote:
> 
> 
> On 2016/2/2 23:18, Namhyung Kim wrote:
> >On Tue, Feb 02, 2016 at 08:56:06AM +0000, Wang Nan wrote:
> >>He Kuang reported a problem that perf fails to get correct symbol on
> >>Android platform in [1]. The problem can be reproduced on normal x86_64
> >>platform. I will describe the reproducing steps in detail at the end of
> >>commit message.
> >>
> >>The reason of this problem is the missing of symbol adjustment for normal
> >>shared objects. In most of the cases it works correctly, but when
> >>'.text' section have different 'address' and 'offset' the result is
> >>wrong. I checked all shared objects in my working platform, only wine
> >>dll objects and debug objects (in .debug) have this problem. However,
> >>it is common on Android. For example:
> >>
> >>  $ readelf -S ./libsurfaceflinger.so | grep \.text
> >>    [10] .text             PROGBITS         0000000000029030  00012030
> >>
> >>This patch enables symbol adjustment for dynamic objects so the symbol
> >>address got from elfutils would be adjusted correctly.
> >>
> >>Steps to reproduce the problem:
> >>
> >>  $ cat << EOF > ./Makefile
> >>PWD := $(shell pwd)
> >>LDFLAGS += "-Wl,-rpath=$(PWD)"
> >>CFLAGS += -g
> >>main: main.c libbuggy.so
> >>libbuggy.so: buggy.c
> >>	gcc -g -shared -fPIC -Wl,-Ttext-segment=0x200000 $< -o $@
> >>clean:
> >>	rm -rf main libbuggy.so *.o
> >>EOF
> >>
> >>  $ cat << EOF > ./buggy.c
> >>int fib(int x)
> >>{
> >>	return (x == 0) ? 1 : (x == 1) ? 1 : fib(x - 1) + fib(x - 2);
> >>}
> >>EOF
> >>
> >>  $ cat << EOF > ./main.c
> >>  #include <stdio.h>
> >>
> >>extern int fix(int x);
> >s/fix/fib/ ?
> 
> Thank you. Have you really tested this program?

Nope, but I've been thinking that the symbol resolution code needs to
be updated or fixed.

Thanks,
Namhyung

      reply	other threads:[~2016-02-03 13:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  8:56 [PATCH 0/2] perf tools: Fix symbol error on ARM64 Wang Nan
2016-02-02  8:56 ` [PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan
2016-02-02  8:56 ` [PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
2016-02-02 15:18   ` Namhyung Kim
2016-02-03  2:12     ` Wangnan (F)
2016-02-03 13:55       ` Namhyung Kim [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=20160203135551.GA2068@danjae.kornet \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dev@codyps.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=kirr@nexedi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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.