linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix Symbol Address for ET_DYN
@ 2014-09-05 18:38 Tong Shen
  2014-09-05 18:40 ` Tong Shen
  2014-09-11 15:01 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 11+ messages in thread
From: Tong Shen @ 2014-09-05 18:38 UTC (permalink / raw)
  To: linux-perf-users

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Hi linux-perf-users,

It's actually a patch, and I didn't find a development mailing list
for perf, so I just post it here. If this is not the right place to
post patches, could someone direct me to it? Thanks in advance!

In tools/perf/util/symbol-elf.c, we don't adjust symbol address for
ET_DYN type of ELF files because we think ET_DYN is always
relocatable.

But that's not necessarily true; there are some non-relocatable ET_DYN
ELF files. For those files, we should still adjust symbol address.

Suggested patch attached.

Thanks.

-- 
Best Regards, Tong Shen

[-- Attachment #2: perf.patch --]
[-- Type: text/x-patch, Size: 1328 bytes --]

Hi linux-perf-users,

It's actually a patch, and I didn't find a development mailing list for perf, so I just post it here. If this is not the right place to post patches, could someone direct me to it? Thanks in advance!

In tools/perf/util/symbol-elf.c, we don't adjust symbol address for ET_DYN type of ELF files because we think ET_DYN is always relocatable.

But that's not necessarily true; there are some non-relocatable ET_DYN ELF files. For those files, we should still adjust symbol address.

Thanks.

Suggested patch: (HTML subpart now allowed in this mailing list...)

diff --git a/perf-3.12.0/tools/perf/util/symbol-elf.c b/perf-3.12.0/tools/perf/util/symbol-elf.c
index a9c829b..0606c6f 100644
--- a/perf-3.12.0/tools/perf/util/symbol-elf.c
+++ b/perf-3.12.0/tools/perf/util/symbol-elf.c
@@ -915,7 +915,10 @@ int dso__load_sym(struct dso *dso, struct map *map,
 		}
 
 		if ((used_opd && runtime_ss->adjust_symbols)
-				|| (!used_opd && syms_ss->adjust_symbols)) {
+				|| (!used_opd && syms_ss->adjust_symbols)
+				|| (syms_ss->ehdr.e_type == ET_DYN
+					&& shdr.sh_addr != shdr.sh_offset
+					&& elf_sec__is_text(&shdr, secstrs))) {
 			pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " "
 				  "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__,
 				  (u64)sym.st_value, (u64)shdr.sh_addr,

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-09-29 18:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 18:38 Fix Symbol Address for ET_DYN Tong Shen
2014-09-05 18:40 ` Tong Shen
2014-09-11 15:01 ` Arnaldo Carvalho de Melo
2014-09-11 18:21   ` Tong Shen
2014-09-11 20:38     ` [PATCH 1/1] perf tools: " Arnaldo Carvalho de Melo
2014-09-15 18:06       ` Tong Shen
2014-09-25  0:28         ` Tong Shen
2014-09-26  5:45           ` Namhyung Kim
2014-09-26  5:53             ` Tong Shen
2014-09-29  2:33               ` Namhyung Kim
2014-09-29 18:13                 ` Tong Shen

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).