From 60e9b5888f75c3e33795e5a8c84f6e6c1c53116c Mon Sep 17 00:00:00 2001 From: Georgii Rymar Date: Thu, 6 Feb 2020 14:15:59 +0300 Subject: [PATCH] [llvm-readobj][test] - Add a test for --elf-cg-profile option. This adds a test to document --elf-cg-profile option we have. I am going to refactor this area, and this patch is mostly to create a base for a follow-up change. Differential revision: https://reviews.llvm.org/D74115 --- .../tools/llvm-readobj/ELF/call-graph-profile.test | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test diff --git a/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test new file mode 100644 index 0000000..def7092 --- /dev/null +++ b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test @@ -0,0 +1,40 @@ +## This test checks how we handle the --elf-cg-profile option. + +# RUN: yaml2obj %s -o %t.o +# RUN: llvm-readobj %t.o --elf-cg-profile | FileCheck %s --check-prefix=LLVM +# RUN: llvm-readelf %t.o --elf-cg-profile | FileCheck %s --check-prefix=GNU + +# LLVM: CGProfile [ +# LLVM-NEXT: CGProfileEntry { +# LLVM-NEXT: From: foo (1) +# LLVM-NEXT: To: bar (2) +# LLVM-NEXT: Weight: 89 +# LLVM-NEXT: } +# LLVM-NEXT: CGProfileEntry { +# LLVM-NEXT: From: bar (2) +# LLVM-NEXT: To: foo (1) +# LLVM-NEXT: Weight: 98 +# LLVM-NEXT: } +# LLVM-NEXT: ] + +# GNU: GNUStyle::printCGProfile not implemented + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 +Sections: + - Name: .llvm.call-graph-profile + Type: SHT_LLVM_CALL_GRAPH_PROFILE + Entries: + - From: foo + To: bar + Weight: 89 + - From: bar + To: foo + Weight: 98 +Symbols: + - Name: foo + - Name: bar -- 2.7.4