Sorry, wrong patch...

On Fri, Sep 5, 2014 at 11:38 AM, Tong Shen <endlessr...@google.com> wrote:
> 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



-- 
Best Regards, Tong Shen
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,

Reply via email to