[llvm-readobj] set --elf-cg-profile as alias of --cg-profile
authorZequan Wu <zequanwu@google.com>
Mon, 15 Jun 2020 17:21:47 +0000 (10:21 -0700)
committerZequan Wu <zequanwu@google.com>
Wed, 17 Jun 2020 18:24:45 +0000 (11:24 -0700)
Summary: Rename --elf-cg-profile to --cg-profile and keep --elf-cg-profile as an alias of --cg-profile.

Reviewers: jhenderson, MaskRay, espindola, hans

Reviewed By: jhenderson, MaskRay

Subscribers: emaste, rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81855

llvm/docs/CommandGuide/llvm-readelf.rst
llvm/docs/CommandGuide/llvm-readobj.rst
llvm/test/MC/ELF/cgprofile.ll
llvm/test/MC/ELF/cgprofile.s
llvm/test/Object/multiple-sections.yaml
llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
llvm/test/tools/llvm-readobj/ELF/demangle.test
llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml
llvm/tools/llvm-readobj/llvm-readobj.cpp

index 2868d0b..f74f02c 100644 (file)
@@ -52,7 +52,7 @@ OPTIONS
 
  Display the dynamic table.
 
-.. option:: --elf-cg-profile
+.. option:: --cg-profile
 
  Display the callgraph profile section.
 
index 46a4b87..51cd266 100644 (file)
@@ -168,7 +168,7 @@ The following options are implemented only for the ELF file format.
 
  Display the dynamic table.
 
-.. option:: --elf-cg-profile
+.. option:: --cg-profile
 
  Display the callgraph profile section.
 
index bd437c3..da29984 100644 (file)
@@ -1,6 +1,6 @@
 ; RUN: llc -filetype=asm %s -o - -mtriple x86_64-pc-linux-gnu | FileCheck %s
 ; RUN: llc -filetype=obj %s -o %t -mtriple x86_64-pc-linux-gnu
-; RUN: llvm-readobj --elf-cg-profile %t | FileCheck %s --check-prefix=OBJ
+; RUN: llvm-readobj --cg-profile %t | FileCheck %s --check-prefix=OBJ
 
 declare void @b()
 
index 8f7f79a..ac2a2d2 100644 (file)
@@ -1,4 +1,4 @@
-# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S --symbols --sd --elf-cg-profile | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -S --symbols --sd --cg-profile | FileCheck %s
 
   .section .test,"aw",@progbits
 a: .word b
index 55b0ce8..07af925 100644 (file)
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t.o
-# RUN: llvm-readobj -a --elf-cg-profile --addrsig %t.o | FileCheck %s
+# RUN: llvm-readobj -a --cg-profile --addrsig %t.o | FileCheck %s
 
 # Test that multiple sections with the same type does not trigger an error.
 
index def7092..dfd95ea 100644 (file)
@@ -1,6 +1,8 @@
 ## This test checks how we handle the --elf-cg-profile option.
 
 # RUN: yaml2obj %s -o %t.o
+# RUN: llvm-readobj %t.o --cg-profile | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readelf %t.o --cg-profile | FileCheck %s --check-prefix=GNU
 # 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
 
index 3a9b11a..910b48f 100644 (file)
@@ -5,20 +5,20 @@
 
 ## Check LLVM output style.
 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
-# RUN:              --elf-section-groups --elf-cg-profile --addrsig         \
+# RUN:              --elf-section-groups --cg-profile --addrsig         \
 # RUN:              --demangle %t.so > %t.llvm.long
 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
-# RUN:              --elf-section-groups --elf-cg-profile --addrsig         \
+# RUN:              --elf-section-groups --cg-profile --addrsig         \
 # RUN:              -C %t.so > %t.llvm.short
 # RUN: FileCheck %s --input-file %t.llvm.long --check-prefixes=LLVM-COMMON,LLVM-DEMANGLE
 # RUN: diff %t.llvm.long %t.llvm.short
 
 ## Check that default is no demangling.
 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
-# RUN:              --elf-section-groups --elf-cg-profile --addrsig         \
+# RUN:              --elf-section-groups --cg-profile --addrsig         \
 # RUN:              %t.so > %t.llvm.default
 # RUN: llvm-readobj --symbols --relocations --dyn-symbols --dyn-relocations \
-# RUN:              --elf-section-groups --elf-cg-profile --addrsig         \
+# RUN:              --elf-section-groups --cg-profile --addrsig         \
 # RUN:              --demangle=false %t.so > %t.llvm.nodemangle
 # RUN: FileCheck %s --input-file %t.llvm.default --check-prefixes=LLVM-COMMON,LLVM-MANGLED
 # RUN: diff %t.llvm.default %t.llvm.nodemangle
index 7885292..db4f190 100644 (file)
@@ -3,13 +3,13 @@
 ## Test that the content of SHT_LLVM_CALL_GRAPH_PROFILE sections
 ## for 32/64-bit little/big endian targets is correct.
 # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.le64
-# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
+# RUN: llvm-readobj --cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
 # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.be64                      
-# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
+# RUN: llvm-readobj --cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
 # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.le32                      
-# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
+# RUN: llvm-readobj --cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
 # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.be32                      
-# RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
+# RUN: llvm-readobj --cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
 
 # BASIC:        Name: .llvm.call-graph-profile
 # BASIC-NEXT:   Type: SHT_LLVM_CALL_GRAPH_PROFILE
@@ -111,7 +111,7 @@ Sections:
 
 ## Check we can refer to symbols by name.
 # RUN: yaml2obj --docnum=4 %s -o %t.sym
-# RUN: llvm-readobj --elf-cg-profile %t.sym | FileCheck %s --check-prefix=SYMBOL-NAMES
+# RUN: llvm-readobj --cg-profile %t.sym | FileCheck %s --check-prefix=SYMBOL-NAMES
 
 # SYMBOL-NAMES:      CGProfile [
 # SYMBOL-NAMES-NEXT:   CGProfileEntry {
index ab2b320..4c00b74 100644 (file)
@@ -345,8 +345,11 @@ namespace opts {
                            cl::desc("Alias for --elf-hash-histogram"),
                            cl::aliasopt(HashHistogram));
 
-  // --elf-cg-profile
-  cl::opt<bool> CGProfile("elf-cg-profile", cl::desc("Display callgraph profile section"));
+  // --cg-profile
+  cl::opt<bool> CGProfile("cg-profile",
+                          cl::desc("Display callgraph profile section"));
+  cl::alias ELFCGProfile("elf-cg-profile", cl::desc("Alias for --cg-profile"),
+                         cl::aliasopt(CGProfile));
 
   // -addrsig
   cl::opt<bool> Addrsig("addrsig",