* [RESEND PATCH 0/2] perf tools: Fix Android symbol resolution
@ 2016-04-07 10:24 Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
0 siblings, 2 replies; 6+ messages in thread
From: Wang Nan @ 2016-04-07 10:24 UTC (permalink / raw)
To: acme; +Cc: lizefan, pi3orama, wangnan0, linux-kernel
Hi Arnaldo,
These 2 patches are in my local tree for a long time. They are
mandatory for android users. Without them resoluting symbol for
Android platform is incorrect for many shared objects.
Namhyung has given his Acked-by to patch 2/2.
Thank you.
Wang Nan (2):
perf tools: Record text offset in dso to calculate objdump address
perf tools: Adjust symbol for shared objects
tools/perf/util/map.c | 14 ++++++++++++++
tools/perf/util/symbol-elf.c | 13 +++----------
2 files changed, 17 insertions(+), 10 deletions(-)
--
1.8.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RESEND PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address
2016-04-07 10:24 [RESEND PATCH 0/2] perf tools: Fix Android symbol resolution Wang Nan
@ 2016-04-07 10:24 ` Wang Nan
2016-04-13 7:19 ` [tip:perf/core] perf symbols: " tip-bot for Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
1 sibling, 1 reply; 6+ messages in thread
From: Wang Nan @ 2016-04-07 10:24 UTC (permalink / raw)
To: acme
Cc: lizefan, pi3orama, wangnan0, linux-kernel, Adrian Hunter,
Cody P Schafer, He Kuang, Jiri Olsa, Kirill Smelkov,
Masami Hiramatsu, Namhyung Kim
In this patch, the offset of '.text' section is stored into dso
and used here to re-calculate address to objdump.
In most of the cases, executable code is in '.text' section, so the
adjustment made to a symbol in dso__load_sym (using
sym.st_value -= shdr.sh_addr - shdr.sh_offset) should equal to
'sym.st_value -= dso->text_offset'. Therefore, adding text_offset back
get objdump address from symbol address (rip). However, it is not true
for kernel and kernel module since there could be multiple executable
sections with different offset. Exclude kernel for this reason.
After this patch, even dso->adjust_symbols is set to true for shared
objects, map__rip_2objdump() and map__objdump_2mem() would return
correct result, so perf behavior of annotate won't be changed.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/util/map.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 171b6d1..02c3186 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -431,6 +431,13 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
if (map->dso->rel)
return rip - map->pgoff;
+ /*
+ * kernel modules also have DSO_TYPE_USER in dso->kernel,
+ * but all kernel modules are ET_REL, so won't get here.
+ */
+ if (map->dso->kernel == DSO_TYPE_USER)
+ return rip + map->dso->text_offset;
+
return map->unmap_ip(map, rip) - map->reloc;
}
@@ -454,6 +461,13 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
if (map->dso->rel)
return map->unmap_ip(map, ip + map->pgoff);
+ /*
+ * kernel modules also have DSO_TYPE_USER in dso->kernel,
+ * but all kernel modules are ET_REL, so won't get here.
+ */
+ if (map->dso->kernel == DSO_TYPE_USER)
+ return map->unmap_ip(map, ip - map->dso->text_offset);
+
return ip + map->reloc;
}
--
1.8.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects
2016-04-07 10:24 [RESEND PATCH 0/2] perf tools: Fix Android symbol resolution Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan
@ 2016-04-07 10:24 ` Wang Nan
2016-04-07 20:06 ` Arnaldo Carvalho de Melo
2016-04-13 7:20 ` [tip:perf/core] perf symbols: " tip-bot for Wang Nan
1 sibling, 2 replies; 6+ messages in thread
From: Wang Nan @ 2016-04-07 10:24 UTC (permalink / raw)
To: acme
Cc: lizefan, pi3orama, wangnan0, linux-kernel, Adrian Hunter,
Cody P Schafer, He Kuang, Jiri Olsa, Kirill Smelkov,
Masami Hiramatsu
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 skipping adjustment is okay. However,
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.
Now nearly all types of ELF files should adjust symbols. Makes
ss->adjust_symbols default to true.
Steps to reproduce the problem:
$ cat ./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
$ cat ./buggy.c
int fib(int x)
{
return (x == 0) ? 1 : (x == 1) ? 1 : fib(x - 1) + fib(x - 2);
}
$ cat ./main.c
#include <stdio.h>
extern int fib(int x);
int main()
{
int i;
for (i = 0; i < 40; i++)
printf("%d\n", fib(i));
return 0;
}
$ make
$ perf record ./main
...
$ perf report --stdio
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
14.97% main libbuggy.so [.] 0x000000000000066c
8.68% main libbuggy.so [.] 0x00000000000006aa
8.52% main libbuggy.so [.] fib@plt
7.95% main libbuggy.so [.] 0x0000000000000664
5.94% main libbuggy.so [.] 0x00000000000006a9
5.35% main libbuggy.so [.] 0x0000000000000678
...
The correct result should be (after this patch):
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
91.47% main libbuggy.so [.] fib
8.52% main libbuggy.so [.] fib@plt
0.00% main [kernel.kallsyms] [k] kmem_cache_free
[1] http://lkml.kernel.org/g/1452567507-54013-1-git-send-email-hekuang@huawei.com
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/util/symbol-elf.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index bc229a7..3f9d679 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -709,17 +709,10 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
if (ss->opdshdr.sh_type != SHT_PROGBITS)
ss->opdsec = NULL;
- if (dso->kernel == DSO_TYPE_USER) {
- GElf_Shdr shdr;
- ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
- ehdr.e_type == ET_REL ||
- dso__is_vdso(dso) ||
- elf_section_by_name(elf, &ehdr, &shdr,
- ".gnu.prelink_undo",
- NULL) != NULL);
- } else {
+ if (dso->kernel == DSO_TYPE_USER)
+ ss->adjust_symbols = true;
+ else
ss->adjust_symbols = elf__needs_adjust_symbols(ehdr);
- }
ss->name = strdup(name);
if (!ss->name) {
--
1.8.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects
2016-04-07 10:24 ` [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
@ 2016-04-07 20:06 ` Arnaldo Carvalho de Melo
2016-04-13 7:20 ` [tip:perf/core] perf symbols: " tip-bot for Wang Nan
1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-04-07 20:06 UTC (permalink / raw)
To: Wang Nan
Cc: lizefan, pi3orama, linux-kernel, Adrian Hunter, Cody P Schafer,
He Kuang, Jiri Olsa, Kirill Smelkov, Masami Hiramatsu
Em Thu, Apr 07, 2016 at 10:24:31AM +0000, Wang Nan escreveu:
> 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 skipping adjustment is okay. However,
> 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
I saved the output of 'perf report' --tui and --stdio before this patch
and after it, it seems to have fixed a few issues with a 'fixdep' binary
generated by by the perf build, things like:
--- perf.hist.before 2016-04-07 16:44:18.220217602 -0300
+++ perf.hist.3 2016-04-07 16:51:18.320693627 -0300
@@ -3538,6 +3538,7 @@
0.01% 0.01% cc1 cc1 [.] cselib_hash_rtx
+ 0.01% 0.00% fixdep fixdep [.] main
0.01% 0.00% CompositorTileW chrome [.] 0xffffaaa40bca467f
@@ -3549,6 +3550,7 @@
0.01% 0.00% ld [unknown] [.] 0x0000559d84243798
+ 0.01% 0.00% fixdep fixdep [.] print_deps
0.01% 0.01% cc1 [kernel.vmlinux] [k] memset_erms
@@ -5916,8 +5918,6 @@
0.01% 0.00% grep [kernel.vmlinux] [k] handle_mm_fault
- 0.01% 0.00% fixdep fixdep [.] 0xffffffffffc00c09
- 0.01% 0.00% fixdep fixdep [.] 0xffffffffffc00c7c
0.01% 0.01% CompositorTileW chrome [.] 0x00000000013ba770
> This patch enables symbol adjustment for dynamic objects so the symbol
> address got from elfutils would be adjusted correctly.
>
> Now nearly all types of ELF files should adjust symbols. Makes
> ss->adjust_symbols default to true.
>
> Steps to reproduce the problem:
Followed them and found the same results as you describe, thanks a lot for doing this!
- Arnaldo
> $ cat ./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
>
> $ cat ./buggy.c
> int fib(int x)
> {
> return (x == 0) ? 1 : (x == 1) ? 1 : fib(x - 1) + fib(x - 2);
> }
>
> $ cat ./main.c
> #include <stdio.h>
>
> extern int fib(int x);
> int main()
> {
> int i;
>
> for (i = 0; i < 40; i++)
> printf("%d\n", fib(i));
> return 0;
> }
>
> $ make
> $ perf record ./main
> ...
> $ perf report --stdio
> # Overhead Command Shared Object Symbol
> # ........ ....... ................. ...............................
> #
> 14.97% main libbuggy.so [.] 0x000000000000066c
> 8.68% main libbuggy.so [.] 0x00000000000006aa
> 8.52% main libbuggy.so [.] fib@plt
> 7.95% main libbuggy.so [.] 0x0000000000000664
> 5.94% main libbuggy.so [.] 0x00000000000006a9
> 5.35% main libbuggy.so [.] 0x0000000000000678
> ...
>
> The correct result should be (after this patch):
>
> # Overhead Command Shared Object Symbol
> # ........ ....... ................. ...............................
> #
> 91.47% main libbuggy.so [.] fib
> 8.52% main libbuggy.so [.] fib@plt
> 0.00% main [kernel.kallsyms] [k] kmem_cache_free
>
> [1] http://lkml.kernel.org/g/1452567507-54013-1-git-send-email-hekuang@huawei.com
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Cody P Schafer <dev@codyps.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kirill Smelkov <kirr@nexedi.com>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Li Zefan <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
> tools/perf/util/symbol-elf.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index bc229a7..3f9d679 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -709,17 +709,10 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
> if (ss->opdshdr.sh_type != SHT_PROGBITS)
> ss->opdsec = NULL;
>
> - if (dso->kernel == DSO_TYPE_USER) {
> - GElf_Shdr shdr;
> - ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
> - ehdr.e_type == ET_REL ||
> - dso__is_vdso(dso) ||
> - elf_section_by_name(elf, &ehdr, &shdr,
> - ".gnu.prelink_undo",
> - NULL) != NULL);
> - } else {
> + if (dso->kernel == DSO_TYPE_USER)
> + ss->adjust_symbols = true;
> + else
> ss->adjust_symbols = elf__needs_adjust_symbols(ehdr);
> - }
>
> ss->name = strdup(name);
> if (!ss->name) {
> --
> 1.8.3.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:perf/core] perf symbols: Record text offset in dso to calculate objdump address
2016-04-07 10:24 ` [RESEND PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan
@ 2016-04-13 7:19 ` tip-bot for Wang Nan
0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Wang Nan @ 2016-04-13 7:19 UTC (permalink / raw)
To: linux-tip-commits
Cc: kirr, linux-kernel, hekuang, wangnan0, tglx, dev, jolsa, hpa,
acme, mingo, namhyung, lizefan, masami.hiramatsu.pt,
adrian.hunter
Commit-ID: a58f7033ba892b7d299954b94471450d72623039
Gitweb: http://git.kernel.org/tip/a58f7033ba892b7d299954b94471450d72623039
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Thu, 7 Apr 2016 10:24:30 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 8 Apr 2016 09:58:14 -0300
perf symbols: Record text offset in dso to calculate objdump address
In this patch, the offset of '.text' section is stored into dso
and used here to re-calculate address to objdump.
In most of the cases, executable code is in '.text' section, so the
adjustment made to a symbol in dso__load_sym (using
sym.st_value -= shdr.sh_addr - shdr.sh_offset) should equal to
'sym.st_value -= dso->text_offset'. Therefore, adding text_offset back
get objdump address from symbol address (rip). However, it is not true
for kernel and kernel module since there could be multiple executable
sections with different offset. Exclude kernel for this reason.
After this patch, even dso->adjust_symbols is set to true for shared
objects, map__rip_2objdump() and map__objdump_2mem() would return
correct result, so perf behavior of annotate won't be changed.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1460024671-64774-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/map.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 171b6d1..02c3186 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -431,6 +431,13 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
if (map->dso->rel)
return rip - map->pgoff;
+ /*
+ * kernel modules also have DSO_TYPE_USER in dso->kernel,
+ * but all kernel modules are ET_REL, so won't get here.
+ */
+ if (map->dso->kernel == DSO_TYPE_USER)
+ return rip + map->dso->text_offset;
+
return map->unmap_ip(map, rip) - map->reloc;
}
@@ -454,6 +461,13 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
if (map->dso->rel)
return map->unmap_ip(map, ip + map->pgoff);
+ /*
+ * kernel modules also have DSO_TYPE_USER in dso->kernel,
+ * but all kernel modules are ET_REL, so won't get here.
+ */
+ if (map->dso->kernel == DSO_TYPE_USER)
+ return map->unmap_ip(map, ip - map->dso->text_offset);
+
return ip + map->reloc;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [tip:perf/core] perf symbols: Adjust symbol for shared objects
2016-04-07 10:24 ` [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
2016-04-07 20:06 ` Arnaldo Carvalho de Melo
@ 2016-04-13 7:20 ` tip-bot for Wang Nan
1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Wang Nan @ 2016-04-13 7:20 UTC (permalink / raw)
To: linux-tip-commits
Cc: hekuang, linux-kernel, masami.hiramatsu.pt, kirr, hpa, jolsa,
acme, adrian.hunter, lizefan, mingo, wangnan0, namhyung, tglx,
dev
Commit-ID: 99e87f7bb7268cf644add87130590966fd5d0d17
Gitweb: http://git.kernel.org/tip/99e87f7bb7268cf644add87130590966fd5d0d17
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Thu, 7 Apr 2016 10:24:31 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 8 Apr 2016 09:58:15 -0300
perf symbols: Adjust symbol for shared objects
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 skipping adjustment is okay. However,
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.
Now nearly all types of ELF files should adjust symbols. Makes
ss->adjust_symbols default to true.
Steps to reproduce the problem:
$ cat ./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
$ cat ./buggy.c
int fib(int x)
{
return (x == 0) ? 1 : (x == 1) ? 1 : fib(x - 1) + fib(x - 2);
}
$ cat ./main.c
#include <stdio.h>
extern int fib(int x);
int main()
{
int i;
for (i = 0; i < 40; i++)
printf("%d\n", fib(i));
return 0;
}
$ make
$ perf record ./main
...
$ perf report --stdio
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
14.97% main libbuggy.so [.] 0x000000000000066c
8.68% main libbuggy.so [.] 0x00000000000006aa
8.52% main libbuggy.so [.] fib@plt
7.95% main libbuggy.so [.] 0x0000000000000664
5.94% main libbuggy.so [.] 0x00000000000006a9
5.35% main libbuggy.so [.] 0x0000000000000678
...
The correct result should be (after this patch):
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...............................
#
91.47% main libbuggy.so [.] fib
8.52% main libbuggy.so [.] fib@plt
0.00% main [kernel.kallsyms] [k] kmem_cache_free
[1] http://lkml.kernel.org/g/1452567507-54013-1-git-send-email-hekuang@huawei.com
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Cody P Schafer <dev@codyps.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kirill Smelkov <kirr@nexedi.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1460024671-64774-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol-elf.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index bc229a7..3f9d679 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -709,17 +709,10 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
if (ss->opdshdr.sh_type != SHT_PROGBITS)
ss->opdsec = NULL;
- if (dso->kernel == DSO_TYPE_USER) {
- GElf_Shdr shdr;
- ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
- ehdr.e_type == ET_REL ||
- dso__is_vdso(dso) ||
- elf_section_by_name(elf, &ehdr, &shdr,
- ".gnu.prelink_undo",
- NULL) != NULL);
- } else {
+ if (dso->kernel == DSO_TYPE_USER)
+ ss->adjust_symbols = true;
+ else
ss->adjust_symbols = elf__needs_adjust_symbols(ehdr);
- }
ss->name = strdup(name);
if (!ss->name) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-13 7:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-07 10:24 [RESEND PATCH 0/2] perf tools: Fix Android symbol resolution Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 1/2] perf tools: Record text offset in dso to calculate objdump address Wang Nan
2016-04-13 7:19 ` [tip:perf/core] perf symbols: " tip-bot for Wang Nan
2016-04-07 10:24 ` [RESEND PATCH 2/2] perf tools: Adjust symbol for shared objects Wang Nan
2016-04-07 20:06 ` Arnaldo Carvalho de Melo
2016-04-13 7:20 ` [tip:perf/core] perf symbols: " tip-bot for Wang Nan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).