Messages in this thread | | | Date | Wed, 3 Feb 2016 22:55:51 +0900 | From | Namhyung Kim <> | Subject | Re: [PATCH 2/2] perf tools: Adjust symbol for shared objects |
| |
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
| |