perf llvm: Specify features="+all" for aarch64
PATCH 1/1 perf llvm: Specify features="+all" for aarch64
This is consistent with what llvm-objdump does (see [1]) and allows the LLVM disassembler to disassemble instructions not in the base instruction set.
[1] https://reviews.llvm.org/D127741
--- tools/perf/util/llvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/llvm.c +8 -2
@@ -153,11 +153,17 @@ int symbol__disassemble_llvm(const char *filename, struct symbol *sym, /*get_op_info=*/NULL, symbol_lookup_callback); }else {char triplet[64 ]; +const char *features =NULL ;scnprintf (triplet,sizeof (triplet),"%s-linux-gnu" , args->arch->name); - disasm =LLVMCreateDisasm (triplet, &storage,/*tag_type=*/ 0 , -/*get_op_info=*/ NULL , symbol_lookup_callback); +if (args->arch->id.e_machine ==EM_AARCH64 ) + features ="+all" ; + disasm =LLVMCreateDisasmCPUFeatures (triplet,/*cpu=*/ "" , + features, &storage, +/*tag_type=*/ 0 , +/*get_op_info=*/ NULL , + symbol_lookup_callback); }if (disasm ==NULL )
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Quoted 9 lines · Peter Collingbourne
This is consistent with what llvm-objdump does (see [1]) and allows the LLVM disassembler to disassemble instructions not in the base instruction set.
Thanks,
Ian
Quoted 31 lines
--- tools/perf/util/llvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)tools/perf/util/llvm.c +8
-3@@ -153,11 +153,17 @@ int symbol__disassemble_llvm(const char *filename, struct symbol *sym, /*get_op_info=*/NULL, symbol_lookup_callback); }else {char triplet[64 ]; +const char *features =NULL ;scnprintf (triplet,sizeof (triplet),"%s-linux-gnu" , args->arch->name); - disasm =LLVMCreateDisasm (triplet, &storage,/*tag_type=*/ 0 , -/*get_op_info=*/ NULL , symbol_lookup_callback); +if (args->arch->id.e_machine ==EM_AARCH64 ) + features ="+all" ; + disasm =LLVMCreateDisasmCPUFeatures (triplet,/*cpu=*/ "" , + features, &storage, +/*tag_type=*/ 0 , +/*get_op_info=*/ NULL , + symbol_lookup_callback); }if (disasm ==NULL ) --2.53.0.473.g4a7958ca14-goog
Quoted 6 lines · Ian Rogers
Quoted 5 lines · Peter Collingbourne
This is consistent with what llvm-objdump does (see [1]) and allows the LLVM disassembler to disassemble instructions not in the base instruction set.
Quoted 6 lines
Quoted 4 lines
Reviewed-by Ian Rogers <[email protected]>
Namhyung, this should go to 7.1 (perf-tools-next),
Regards,
- Arnaldo
Quoted 8 lines · Peter Collingbourne
This is consistent with what llvm-objdump does (see [1]) and allows the LLVM disassembler to disassemble instructions not in the base instruction set.
[1] https://reviews.llvm.org/D127741
[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung