Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325467

Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects
Date 2016-02-03 15:00 +0100
Message-ID <qY68s-2Gi-25@gated-at.bofh.it> (permalink)
References <qXEYy-8na-3@gated-at.bofh.it> <qXEYy-8na-13@gated-at.bofh.it> <qXKUi-4Qa-15@gated-at.bofh.it> <qXVd0-45u-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] perf tools: Fix symbol error on ARM64 Wang Nan <wangnan0@huawei.com> - 2016-02-02 10:00 +0100
  [PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan <wangnan0@huawei.com> - 2016-02-02 10:00 +0100
  [PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan <wangnan0@huawei.com> - 2016-02-02 10:00 +0100
    Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects Namhyung Kim <namhyung@kernel.org> - 2016-02-02 16:20 +0100
      Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects "Wangnan (F)" <wangnan0@huawei.com> - 2016-02-03 03:20 +0100
        Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects Namhyung Kim <namhyung@kernel.org> - 2016-02-03 15:00 +0100

csiph-web