mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 04:03:58 +08:00
cae15db749
Rust demangling is another step after bfd demangling. Add a diagnosis to identify mangled Rust symbols based on the hash that the Rust mangler appends as the last path component, as well as other characteristics. Add a demangler to reconstruct the original symbol. Committer notes: How I tested it: Enabled COPR on Fedora 24 and then installed the 'rust-binary' package, with it: $ cat src/main.rs fn main() { println!("Hello, world!"); } $ cat Cargo.toml [package] name = "hello_world" version = "0.0.1" authors = [ "Arnaldo Carvalho de Melo <acme@kernel.org>" ] $ perf record cargo bench Compiling hello_world v0.0.1 (file:///home/acme/projects/hello_world) Running target/release/hello_world-d4b9dab4b2a47d75 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.096 MB perf.data (1457 samples) ] $ Before this patch: $ perf report --stdio --dsos librbml-e8edd0fd.so # dso: librbml-e8edd0fd.so # # Total Lost Samples: 0 # # Samples: 1K of event 'cycles:u' # Event count (approx.): 979599126 # # Overhead Command Symbol # ........ ....... ............................................................................................................. # 1.78% rustc [.] rbml::reader::maybe_get_doc::hb9d387df6024b15b 1.50% rustc [.] _$LT$reader..DocsIterator$LT$$u27$a$GT$$u20$as$u20$std..iter..Iterator$GT$::next::hd9af9e60d79a35c8 1.20% rustc [.] rbml::reader::doc_at::hc88107fba445af31 0.46% rustc [.] _$LT$reader..TaggedDocsIterator$LT$$u27$a$GT$$u20$as$u20$std..iter..Iterator$GT$::next::h0cb40e696e4bb489 0.35% rustc [.] rbml::reader::Decoder::_next_int::h66eef7825a398bc3 0.29% rustc [.] rbml::reader::Decoder::_next_sub::h8e5266005580b836 0.15% rustc [.] rbml::reader::get_doc::h094521c645459139 0.14% rustc [.] _$LT$reader..Decoder$LT$$u27$doc$GT$$u20$as$u20$serialize..Decoder$GT$::read_u32::h0acea2fff9669327 0.07% rustc [.] rbml::reader::Decoder::next_doc::h6714d469c9dfaf91 0.07% rustc [.] _ZN4rbml6reader10doc_as_u6417h930b740aa94f1d3aE@plt 0.06% rustc [.] _fini $ After: $ perf report --stdio --dsos librbml-e8edd0fd.so # dso: librbml-e8edd0fd.so # # Total Lost Samples: 0 # # Samples: 1K of event 'cycles:u' # Event count (approx.): 979599126 # # Overhead Command Symbol # ........ ....... ................................................................. # 1.78% rustc [.] rbml::reader::maybe_get_doc 1.50% rustc [.] <reader::DocsIterator<'a> as std::iter::Iterator>::next 1.20% rustc [.] rbml::reader::doc_at 0.46% rustc [.] <reader::TaggedDocsIterator<'a> as std::iter::Iterator>::next 0.35% rustc [.] rbml::reader::Decoder::_next_int 0.29% rustc [.] rbml::reader::Decoder::_next_sub 0.15% rustc [.] rbml::reader::get_doc 0.14% rustc [.] <reader::Decoder<'doc> as serialize::Decoder>::read_u32 0.07% rustc [.] rbml::reader::Decoder::next_doc 0.07% rustc [.] _ZN4rbml6reader10doc_as_u6417h930b740aa94f1d3aE@plt 0.06% rustc [.] _fini $ Signed-off-by: David Tolnay <dtolnay@gmail.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/5780B7FA.3030602@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
190 lines
5.7 KiB
Plaintext
190 lines
5.7 KiB
Plaintext
libperf-y += alias.o
|
|
libperf-y += annotate.o
|
|
libperf-y += build-id.o
|
|
libperf-y += config.o
|
|
libperf-y += ctype.o
|
|
libperf-y += db-export.o
|
|
libperf-y += env.o
|
|
libperf-y += event.o
|
|
libperf-y += evlist.o
|
|
libperf-y += evsel.o
|
|
libperf-y += evsel_fprintf.o
|
|
libperf-y += find_bit.o
|
|
libperf-y += kallsyms.o
|
|
libperf-y += levenshtein.o
|
|
libperf-y += llvm-utils.o
|
|
libperf-y += parse-events.o
|
|
libperf-y += perf_regs.o
|
|
libperf-y += path.o
|
|
libperf-y += rbtree.o
|
|
libperf-y += libstring.o
|
|
libperf-y += bitmap.o
|
|
libperf-y += hweight.o
|
|
libperf-y += quote.o
|
|
libperf-y += strbuf.o
|
|
libperf-y += string.o
|
|
libperf-y += strlist.o
|
|
libperf-y += strfilter.o
|
|
libperf-y += top.o
|
|
libperf-y += usage.o
|
|
libperf-y += dso.o
|
|
libperf-y += symbol.o
|
|
libperf-y += symbol_fprintf.o
|
|
libperf-y += color.o
|
|
libperf-y += header.o
|
|
libperf-y += callchain.o
|
|
libperf-y += values.o
|
|
libperf-y += debug.o
|
|
libperf-y += machine.o
|
|
libperf-y += map.o
|
|
libperf-y += pstack.o
|
|
libperf-y += session.o
|
|
libperf-$(CONFIG_AUDIT) += syscalltbl.o
|
|
libperf-y += ordered-events.o
|
|
libperf-y += comm.o
|
|
libperf-y += thread.o
|
|
libperf-y += thread_map.o
|
|
libperf-y += trace-event-parse.o
|
|
libperf-y += parse-events-flex.o
|
|
libperf-y += parse-events-bison.o
|
|
libperf-y += pmu.o
|
|
libperf-y += pmu-flex.o
|
|
libperf-y += pmu-bison.o
|
|
libperf-y += trace-event-read.o
|
|
libperf-y += trace-event-info.o
|
|
libperf-y += trace-event-scripting.o
|
|
libperf-y += trace-event.o
|
|
libperf-y += svghelper.o
|
|
libperf-y += sort.o
|
|
libperf-y += hist.o
|
|
libperf-y += util.o
|
|
libperf-y += xyarray.o
|
|
libperf-y += cpumap.o
|
|
libperf-y += cgroup.o
|
|
libperf-y += target.o
|
|
libperf-y += rblist.o
|
|
libperf-y += intlist.o
|
|
libperf-y += vdso.o
|
|
libperf-y += counts.o
|
|
libperf-y += stat.o
|
|
libperf-y += stat-shadow.o
|
|
libperf-y += record.o
|
|
libperf-y += srcline.o
|
|
libperf-y += str_error_r.o
|
|
libperf-y += data.o
|
|
libperf-y += tsc.o
|
|
libperf-y += cloexec.o
|
|
libperf-y += call-path.o
|
|
libperf-y += thread-stack.o
|
|
libperf-$(CONFIG_AUXTRACE) += auxtrace.o
|
|
libperf-$(CONFIG_AUXTRACE) += intel-pt-decoder/
|
|
libperf-$(CONFIG_AUXTRACE) += intel-pt.o
|
|
libperf-$(CONFIG_AUXTRACE) += intel-bts.o
|
|
libperf-y += parse-branch-options.o
|
|
libperf-y += parse-regs-options.o
|
|
libperf-y += term.o
|
|
libperf-y += help-unknown-cmd.o
|
|
libperf-y += mem-events.o
|
|
libperf-y += vsprintf.o
|
|
|
|
libperf-$(CONFIG_LIBBPF) += bpf-loader.o
|
|
libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
|
|
libperf-$(CONFIG_LIBELF) += symbol-elf.o
|
|
libperf-$(CONFIG_LIBELF) += probe-file.o
|
|
libperf-$(CONFIG_LIBELF) += probe-event.o
|
|
|
|
ifndef CONFIG_LIBELF
|
|
libperf-y += symbol-minimal.o
|
|
endif
|
|
|
|
libperf-$(CONFIG_DWARF) += probe-finder.o
|
|
libperf-$(CONFIG_DWARF) += dwarf-aux.o
|
|
|
|
libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
|
|
libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o
|
|
libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
|
|
libperf-$(CONFIG_LIBUNWIND_X86) += libunwind/x86_32.o
|
|
libperf-$(CONFIG_LIBUNWIND_AARCH64) += libunwind/arm64.o
|
|
|
|
libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
|
|
|
|
libperf-y += scripting-engines/
|
|
|
|
libperf-$(CONFIG_ZLIB) += zlib.o
|
|
libperf-$(CONFIG_LZMA) += lzma.o
|
|
libperf-y += demangle-java.o
|
|
libperf-y += demangle-rust.o
|
|
|
|
ifdef CONFIG_JITDUMP
|
|
libperf-$(CONFIG_LIBELF) += jitdump.o
|
|
libperf-$(CONFIG_LIBELF) += genelf.o
|
|
libperf-$(CONFIG_LIBELF) += genelf_debug.o
|
|
endif
|
|
|
|
CFLAGS_config.o += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
# avoid compiler warnings in 32-bit mode
|
|
CFLAGS_genelf_debug.o += -Wno-packed
|
|
|
|
$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
|
|
|
|
$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
|
|
|
|
$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
|
|
|
|
$(OUTPUT)util/pmu-bison.c: util/pmu.y
|
|
$(call rule_mkdir)
|
|
$(Q)$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -p perf_pmu_
|
|
|
|
CFLAGS_parse-events-flex.o += -w
|
|
CFLAGS_pmu-flex.o += -w
|
|
CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -w
|
|
CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
|
|
|
|
$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
|
|
$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
|
|
|
|
CFLAGS_bitmap.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
CFLAGS_find_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
CFLAGS_rbtree.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
CFLAGS_hweight.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
|
|
CFLAGS_parse-events.o += -Wno-redundant-decls
|
|
|
|
$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/libstring.o: ../lib/string.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/str_error_r.o: ../lib/str_error_r.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|
|
|
|
$(OUTPUT)util/vsprintf.o: ../lib/vsprintf.c FORCE
|
|
$(call rule_mkdir)
|
|
$(call if_changed_dep,cc_o_c)
|