From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: brueckner@linux.vnet.ibm.com, zvonko.kosic@de.ibm.com,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/2] perf report fix module symbol adjustment for s390x
Date: Wed, 2 Aug 2017 15:42:02 -0300 [thread overview]
Message-ID: <20170802184202.GK12201@kernel.org> (raw)
In-Reply-To: <20170724143514.55574-1-tmricht@linux.vnet.ibm.com>
Em Mon, Jul 24, 2017 at 04:35:13PM +0200, Thomas Richter escreveu:
> +++ b/tools/perf/util/symbol-elf.c
> @@ -793,6 +793,12 @@ static u64 ref_reloc(struct kmap *kmap)
> void __weak arch__sym_update(struct symbol *s __maybe_unused,
> GElf_Sym *sym __maybe_unused) { }
>
> +u64 __weak arch__sym_set_address(GElf_Sym *sym, GElf_Shdr *shdr,
> + struct map *map __maybe_unused)
> +{
> + return sym->st_value - (shdr->sh_addr - shdr->sh_offset);
> +}
> +
> int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
> struct symsrc *runtime_ss, int kmodule)
> {
> @@ -973,7 +979,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
>
> /* Adjust symbol to map to file offset */
> if (adjust_kernel_syms)
> - sym.st_value -= shdr.sh_addr - shdr.sh_offset;
> + sym.st_value = arch__sym_set_address(&sym, &shdr, map);
Since this is just used when "adjusting" the symbol wrt file offset,
can we have a more descriptive name? Like:
void __weak arch__adjust_sym_map_offset(GElf_Sym *sym, GElf_Shdr *shdr,
struct map *map __maybe_unused)
{
sym->st_value -= shdr->sh_addr - shdr->sh_offset;
}
Then have it as:
- /* Adjust symbol to map to file offset */
if (adjust_kernel_syms)
- sym.st_value -= shdr.sh_addr - shdr.sh_offset;
+ arch__adjust_sym_map_offset(&sym, &shdr, map);
I.e. the weak function name becomes the comment :-)
>
> if (strcmp(section_name,
> (curr_dso->short_name +
> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
> index 41ebba9..beb8737 100644
> --- a/tools/perf/util/symbol.h
> +++ b/tools/perf/util/symbol.h
> @@ -343,6 +343,9 @@ int setup_intlist(struct intlist **list, const char *list_str,
> #ifdef HAVE_LIBELF_SUPPORT
> bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
> void arch__sym_update(struct symbol *s, GElf_Sym *sym);
> +u64 arch__sym_set_address(GElf_Sym *sym,
> + GElf_Shdr *shdr __maybe_unused,
> + struct map *map __maybe_unused);
> #endif
>
> #define SYMBOL_A 0
> --
> 2.9.3
next prev parent reply other threads:[~2017-08-02 18:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 14:35 [PATCH 1/2] perf report fix module symbol adjustment for s390x Thomas Richter
2017-07-24 14:35 ` [PATCH 2/2] perf record: wrong size in perf_record_mmap for last kernel module Thomas Richter
2017-07-24 18:20 ` Arnaldo Carvalho de Melo
2017-07-25 8:45 ` Thomas-Mich Richter
2017-08-02 18:50 ` Arnaldo Carvalho de Melo
2017-08-03 9:41 ` Thomas-Mich Richter
2017-08-04 17:06 ` Arnaldo Carvalho de Melo
2017-08-07 7:26 ` Thomas-Mich Richter
2017-08-07 16:05 ` Arnaldo Carvalho de Melo
2017-08-08 7:16 ` Thomas-Mich Richter
2017-07-25 6:58 ` Namhyung Kim
2017-07-25 8:26 ` Thomas-Mich Richter
2017-07-25 6:14 ` [PATCH 1/2] perf report fix module symbol adjustment for s390x Namhyung Kim
2017-07-25 8:49 ` Thomas-Mich Richter
2017-07-25 10:32 ` Namhyung Kim
2017-07-25 14:20 ` Arnaldo Carvalho de Melo
2017-08-02 11:25 ` Thomas-Mich Richter
2017-08-02 18:42 ` Arnaldo Carvalho de Melo [this message]
2017-08-03 9:37 ` Thomas-Mich Richter
2017-08-03 12:45 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170802184202.GK12201@kernel.org \
--to=acme@kernel.org \
--cc=brueckner@linux.vnet.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=tmricht@linux.vnet.ibm.com \
--cc=zvonko.kosic@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.