[llvm] bbf8964 - [llvm-readobj] set --elf-cg-profile as alias of --cg-profile

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 17 11:24:53 PDT 2020


Author: Zequan Wu
Date: 2020-06-17T11:24:45-07:00
New Revision: bbf89644b5897c7d9508975c289fd861f60e0835

URL: https://github.com/llvm/llvm-project/commit/bbf89644b5897c7d9508975c289fd861f60e0835
DIFF: https://github.com/llvm/llvm-project/commit/bbf89644b5897c7d9508975c289fd861f60e0835.diff

LOG: [llvm-readobj] set --elf-cg-profile as alias of --cg-profile

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

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/llvm/docs/CommandGuide/llvm-readelf.rst b/llvm/docs/CommandGuide/llvm-readelf.rst
index 2868d0b59897..f74f02c9a667 100644
--- a/llvm/docs/CommandGuide/llvm-readelf.rst
+++ b/llvm/docs/CommandGuide/llvm-readelf.rst
@@ -52,7 +52,7 @@ OPTIONS
 
  Display the dynamic table.
 
-.. option:: --elf-cg-profile
+.. option:: --cg-profile
 
  Display the callgraph profile section.
 

diff  --git a/llvm/docs/CommandGuide/llvm-readobj.rst b/llvm/docs/CommandGuide/llvm-readobj.rst
index 46a4b87d3fbd..51cd266ff79e 100644
--- a/llvm/docs/CommandGuide/llvm-readobj.rst
+++ b/llvm/docs/CommandGuide/llvm-readobj.rst
@@ -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.
 

diff  --git a/llvm/test/MC/ELF/cgprofile.ll b/llvm/test/MC/ELF/cgprofile.ll
index bd437c3f3ec2..da29984e848c 100644
--- a/llvm/test/MC/ELF/cgprofile.ll
+++ b/llvm/test/MC/ELF/cgprofile.ll
@@ -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()
 

diff  --git a/llvm/test/MC/ELF/cgprofile.s b/llvm/test/MC/ELF/cgprofile.s
index 8f7f79a07b3e..ac2a2d2b1117 100644
--- a/llvm/test/MC/ELF/cgprofile.s
+++ b/llvm/test/MC/ELF/cgprofile.s
@@ -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", at progbits
 a: .word b

diff  --git a/llvm/test/Object/multiple-sections.yaml b/llvm/test/Object/multiple-sections.yaml
index 55b0ce84409d..07af9252e26a 100644
--- a/llvm/test/Object/multiple-sections.yaml
+++ b/llvm/test/Object/multiple-sections.yaml
@@ -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.
 

diff  --git a/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
index def70921a72d..dfd95ea46a06 100644
--- a/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
+++ b/llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
@@ -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
 

diff  --git a/llvm/test/tools/llvm-readobj/ELF/demangle.test b/llvm/test/tools/llvm-readobj/ELF/demangle.test
index 3a9b11a88efd..910b48f1c8e3 100644
--- a/llvm/test/tools/llvm-readobj/ELF/demangle.test
+++ b/llvm/test/tools/llvm-readobj/ELF/demangle.test
@@ -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

diff  --git a/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml b/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml
index 7885292a8d6b..db4f1901b14e 100644
--- a/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/call-graph-profile-section.yaml
@@ -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 {

diff  --git a/llvm/tools/llvm-readobj/llvm-readobj.cpp b/llvm/tools/llvm-readobj/llvm-readobj.cpp
index ab2b320c1f82..4c00b740de75 100644
--- a/llvm/tools/llvm-readobj/llvm-readobj.cpp
+++ b/llvm/tools/llvm-readobj/llvm-readobj.cpp
@@ -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",


        


More information about the llvm-commits mailing list